Bug #3423: dbmopen() not thread-safe
| From: | wagener at tnt dot psychologie dot uni-mannheim dot de | Date: | Mon, 07 Feb 2000 21:52:53 +0000 |
| Subject: | Bug #3423: dbmopen() not thread-safe | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-15285@lists.php.net to get a copy of this message | ||
From: wagener@tnt.psychologie.uni-mannheim.de
Operating system: Win NT 3.51
PHP version: 3.0.14
PHP Bug Type: DBM/DBA related
Bug description: dbmopen() not thread-safe
The dbm unit isn't capable of handling multiple request on the same .db files more than once.
There's indeed some kind of "php-own-locking", but this just makes the whole php fail
when it's needed. The following code allows simulating multiple accesses on the same .db file
("shit" must have been created as dbm file before):
function shoot_dbm()
{ /* this loop should wait until the db is unlocked */
/* - but it makes the second instance crash */
do
{
$dbShit = dbmopen( "shit", "w" );
}
while( ! $dbShit );
sleep(5); /* simulate some activity in critical part */
dbmclose( $dbShit );
};
Running this part via two clients, the second get's an "server misconfiguration
error" page wit apache.
using a lock file via flock() to "protect" the dbm module from its dumbness doesn't
help also. Locking works fine, but the dbm still causes problems (quite strange!).