|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #3423 dbmopen() not thread-safe
Submitted: 2000-02-07 22:52 UTC Modified: 2002-10-01 11:36 UTC
From: wagener at tnt dot psychologie dot uni-mannheim dot de Assigned:
Status: Not a bug Package: DBM/DBA related
PHP Version: 3.0.14 OS: Win NT 3.51
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
39 + 7 = ?
Subscribe to this entry?

 [2000-02-07 22:52 UTC] wagener at tnt dot psychologie dot uni-mannheim dot de
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 */
     $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!).


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-10-01 11:36 UTC]
some extensions are just not thread-safe as the underlying libs aren't :(

theres a way more general report requesting documentation on tread-safety status for extensions so i'm setting this
one to "Won't fix" (as we'll fix the documentation instead
of fixing all the differend underlying db* libs)

btw: flock() works on process-level only, as threads are part of the same process they all get positive results from flock if the lock is held by another thread in that process
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Sat Dec 09 10:01:28 2023 UTC