Problem with dba_open() on db4 database
| From: | Thorsten Göllner | Date: | Tue, 16 Jul 2013 08:46:30 +0000 |
| Subject: | Problem with dba_open() on db4 database | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-321619@lists.php.net to get a copy of this message | ||
Hi,
I am using a db4 database to store some values (on the local filesystem). Here the sample code:
$handle = dba_open("/var/cache/mydb.db", "cd", "db4");
[...]
$result = dba_replace($key, serialize($data), $handle);
[...]
dba_close($handle);
This Code is used in a CLI-Script (in an Asterisk-AGI-Script) and will be used by some processes in parallel. The online documentation (http://de1.php.net/manual/en/function.dba-open.php) shows, that the function should "wait" if more than a process has a lock on the database. This works fine if I use the script an execute it in differnt shells in parallel.
But SOMETIMES(!) I get (in the Asterisk-Environment) the following error message:
dba_open(/var/cache/mydb.db,cd): Driver initialization failed for handler: db4: Unable to establish lock (database file already open)
So it seems, that the function "dba_open()" returns immediatly without waiting for lock release. But I do not know why ... ?!
I am using the following versions:
Ubuntu 12.04. LTS (up to date) with PHP 5.3.10-1ubuntu3.6 with Suhosin-Patch
Any idea?
Thank in advance
-Thorsten-