5 ms·
The underlying problem is that POSIX Advisory Locks are broken by design. They are per-process, rather than per-file-descriptor locks. So, if you have two fil
by SQLite 12y ago
The underlying problem is that POSIX Advisory Locks are broken by design. They are per-process, rather than per-file-descriptor locks.
So, if you have two file descriptors open on the same file in the same process, a lock on one file descriptor is unable to control access to the file from the second file descriptor. POSIX locks only work if the two file descriptors are in separate processes.
There is a large of code in SQLite that works around this bug. And that code works well. But that code requies access to global variables.
The problem that Eric describes comes up when you link in two separate copies of SQLite, and thus have two distinct sets of global variables for managing the locks. These two separate copies of SQLite have no why of knowing about each other, and hence have no way of coordinating their lock behavior in order to avoid problems.