Problem with dba_open() on db4 database

[email protected] (Thorsten Göllner)
Newsgroups php.general
Organization OVM Office Voice Media GmbH
Message-ID <[email protected]>
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-
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.