Bug #51680 [Dup]: Sqlite returns without waiting for timeout
| From: | ncoesel at dealogic dot nl | Date: | Mon, 07 Jun 2010 07:13:04 +0000 |
| Subject: | Bug #51680 [Dup]: Sqlite returns without waiting for timeout | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-151144@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=51680&edit=1
ID: 51680
User updated by: ncoesel at dealogic dot nl
Reported by: ncoesel at dealogic dot nl
Summary: Sqlite returns without waiting for timeout
Status: Duplicate
Type: Bug
Package: SQLite related
Operating System: Linux
PHP Version: Irrelevant
Assigned To: scottmac
New Comment:
I'm sorry but you are mistaken. Sqlite_busytimeout may be ignored by
Sqlite when two threads of the same process execute a query. This is
documented behaviour of Sqlite. See
http://www.sqlite.org/c3ref/busy_handler.html
in the 4th paragraph.
"The presence of a busy handler does not guarantee that it will be
invoked when there is lock contention. If SQLite determines that
invoking the busy handler could result in a deadlock, it will go ahead
and return SQLITE_BUSY or SQLITE_IOERR_BLOCKED instead of invoking the
busy handler."
I did very thourough research on this and my patch is a way to solve it
altough there is always a chance the database may be locked for too
long. If that is a problem one might have exceeded Sqlite's capabilities
:-)
Previous Comments:
------------------------------------------------------------------------
[2010-06-07 07:10:06] magicaltux@php.net
This bug is a duplicate of http://bugs.php.net/51295 (which
includes a
slightly
better way of fixing this).
------------------------------------------------------------------------
[2010-04-28 10:49:22] ncoesel at dealogic dot nl
Description:
------------
Sqlite has a protection mechanism that prevents firing two (or) more
queries from the same process and wait for the database to become
available.
The typical behaviour is that every now and then (depending on the
database load) a query exits immediately with "SQLSTATE[HY000]: General
error: 5 database is locked". Setting other busy timeout values doesn't
help.
I've attached a patch that solves the problem unless the database is
locked for a very long time (as usual some error . The patch is created
for an older version of PHP. I've checked the latest CVS version and I'm
quite sure the patch will still apply.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=51680&edit=1