On Wed, Nov 04, 2009 at 05:19:11PM +0100, Nico Coesel scratched on the wall: > > > > I'm using the sqlite3_exec function to execute a query; this function > > > calls slite3_finalize at the end so this should release the locks. > > Yes, I check every return value. I also see errors from process B saying > the database is locked. In /proc/locks I can see process A still locked > the database. I also tried to use the command line tool to access the > database using the vacuum command but it also says the database is > locked.
There are situations when SQLite can dead-lock, where two processes will both sit and wait for the other to release its locks. It isn't just a matter of checking the return values, but also of doing the right thing. In specific, if you get any SQLITE_BUSY codes, you need to rollback the transaction and try again from the start. However, if you using sqlite3_exec() for all your SQL and you're NOT using explicit transactions, then that should take care of things for you. If you are using explicit transactions (sending a "BEING" and "END" or "COMMIT") you need to handle this situation yourself. Is process A cleanly exiting when the lock is left behind? What OS and filesystem are you using? -j -- Jay A. Kreibich < J A Y @ K R E I B I.C H > "Our opponent is an alien starship packed with atomic bombs. We have a protractor." "I'll go home and see if I can scrounge up a ruler and a piece of string." --from Anathem by Neal Stephenson _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users