DB concurrency problem
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenSatNav |
Fix Committed
|
Medium
|
Unassigned |
Bug Description
OSN is using threads in order to simultaneously:
- download tiles (5 threads in [1]OpenStreetMa
- load map tiles (2 threads in [2]OpenStreetMa
SQLite allows simultaneous SELECT in its database but not UPDATE.
That's why we have this kind of error sometimes:
<pre>
E/Database(24031): Failure 5 (database is locked) on 0xf1ee48 when executing 'UPDATE t_fscache SET countused = countused + 1 , used_timestamp = datetime('now') WHERE name_id = '/sdcard/
W/dalvikvm(24031): threadid=363: thread exiting with uncaught exception (group=0x4001b178)
I/global (24031): Default buffer size used in BufferedWriter constructor. It would be better to be explicit if an 8k-char buffer is required.
E/AndroidRuntim
E/AndroidRuntim
E/AndroidRuntim
E/AndroidRuntim
E/AndroidRuntim
E/AndroidRuntim
E/AndroidRuntim
E/AndroidRuntim
E/AndroidRuntim
</pre>
Both threads are calling OpenStreetMapTi
How to keep the treads without perturbing SQLite?
Changed in opensatnav: | |
milestone: | none → 1.0 |
Add a synchronized on the incrementUse() method ?