I am using version 3.0.8 of sqlite.

In the course of trying to track down a strange error in my application where I very infrequently get a database is locked error (even though my busy timeout is set to some insanely large number, like a billion seconds), I was looking through the code is os_unix.c.

sqlite3OsOpenReadWrite calls
findLockInfo with the open fd which calls
threadThreadLockingBehavior

the thread locking behaviour test dups the fd and then creates two threads that try to get a shared lock and an exclusive lock respectively (and fail immediately if they cannot acquire the lock). If both of these calls succeed, then it is determined that the locks are process wide and not per fd.

It looks to me like this test assumes that no other process currently has a lock on this file. If any other process has any lock on this file, I believe one or both of the locking calls will fail which will trick sqlite into believing that the locks are fd specific, not process specific.

Am I reading this right?

Cheers,
Chris.

--
Christopher R. Palmer                     [EMAIL PROTECTED]
Chief Technology Officer                  www.vivisimo.com
Vivisimo, Inc.

Reply via email to