Hello! While testing our application we occasionally got the "Unable to open database" error on several machines from time to time. Same problem is also discussed on http://sqlite.phxsoftware.com/forums/t/689.aspx. It was very hard to reproduce since it was timing dependent, but we managed to pin down the problem on one of our notebooks with the help of stress-test application and Process Monitor. To make the long story short here is the exact description of the problem:
- TSVNCache.exe monitors files and for whatever reason it opens them and performs some queries on them. - SQLite creates a journal file. - TSVNCache notices the new file and opens it. - SQLite deletes the journal file and it now enters the "Delete Pending" state since TSVNCache still has handle for it. - SQLite tries to recreate the journal for next transaction (3 times), but it always fails with the ERROR_DELETE_PENDING error. => CANTOPEN error is returned. - TSVNCache finally releases the file handle and the file gets deleted. The key reason for the problem happening only on Windows is the "delete pending" state that doesn't exist in *nix systems. While the file is in this state the name cannot be reused. Any ideas how to fix this issue? It could potentially affect a lot of people and cause unexpected errors when transactions are performed in rapid succession. Personally I can think only of a) renaming the journal file to unique name before deleting it b) using persistent journals (unfortunately the version of SQLite we use doesn't support them). Best regards, Filip Navara The relevant part of the log is TSVNCache.exe QueryOpen FAST IO DISALLOWED SQLiteTest.exe CloseFile SUCCESS TSVNCache.exe CreateFile SUCCESS SQLiteTest.exe CreateFile SUCCESS SQLiteTest.exe QueryAttributeTagFile SUCCESS SQLiteTest.exe SetDispositionInformationFile SUCCESS SQLiteTest.exe CloseFile SUCCESS SQLiteTest.exe QueryOpen FAST IO DISALLOWED SQLiteTest.exe CreateFile DELETE PENDING SQLiteTest.exe UnlockFileSingle SUCCESS SQLiteTest.exe UnlockFileSingle SUCCESS SQLiteTest.exe LockFile SUCCESS SQLiteTest.exe LockFile SUCCESS SQLiteTest.exe UnlockFileSingle SUCCESS SQLiteTest.exe QueryOpen FAST IO DISALLOWED SQLiteTest.exe CreateFile DELETE PENDING SQLiteTest.exe QueryStandardInformationFile SUCCESS SQLiteTest.exe ReadFile SUCCESS SQLiteTest.exe LockFile SUCCESS SQLiteTest.exe CreateFile DELETE PENDING SQLiteTest.exe CreateFile DELETE PENDING SQLiteTest.exe UnlockFileSingle SUCCESS SQLiteTest.exe UnlockFileSingle SUCCESS TSVNCache.exe QueryNetworkOpenInformationFile SUCCESS TSVNCache.exe CloseFile SUCCESS TSVNCache.exe QueryOpen FAST IO DISALLOWED TSVNCache.exe CreateFile NAME NOT FOUND dw20.exe CreateFile NAME NOT FOUND SQLiteTest.exe CloseFile SUCCESS _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users