java - The connection pool for database has been unable to grant a connection to thread 602 (Binder_2) with flags 0x1 -


i've been trying figure out hours on why application database gets deadlocked.

i have app reads database activities , writes database service. pretty straight-forward.

i have database connection set instance:

public static synchronized museodatabase getinstance(context context){     if(sinstance == null){         sinstance = new museodatabase(context);     }     return sinstance; } 

the service

in service have runnable periodically updates database transaction. large chunks (300+ entries) of data.

in service have instance opened writing

final sqlitedatabase db = museodatabase.getinstance(getapplicationcontext()).getwritabledatabase(); 

the service works okay. updates database pretty nicely , there.

the problematic activity

now have activity accepts both rfid , numeric code input , both validated through 1 validatecode() method.

for open database instance in read mode

final sqlitedatabase db = museodatabase.getinstance(getapplicationcontext()).getreadabledatabase(); 

now funny part

as said above, both rfid uuid , numeric code validated through same method because value saved in same sqlite table.

when validate code, ok. correctly checks database code , if valid etc. if read rfid: deadlock , error:

the connection pool database has been unable grant connection thread 602 (binder_2) flags 0x1 

it causes rfid reader of app fail (no more rfid cards detected). numeric code has no issues when using rfid, plain fails although both sue same method.

after failrue due rfid card, numeric codes still continue function makes more weird.

where have gone wrong?


Comments