indicates (in an
entertaining little table) your second script should be in 'wait' status
until the first exits - so, the necessary logical questions (take no

1) are both scripts repeatedly printing their results, or does the
second not start until you stop the first? (gotta ask)
2) are the two test files in the same directory, or in some other
patentedly obvious way definitely opening the same database? (also had
to ask)
3) is it possible that the dba_open call in the second script is
returned something not false - 
to indicate the wait status?  The help says it returns false on fail,
and a database handle on success - but a wait is neither of those.
Realistically it shouldn't return until it hits one or the other, so
things are stranger still.

At the very least, you could attempt "wl" instead of "wd" for both - but
that may not get you anything either.  Strange behavior!

- Martin Norland, Database / Web Developer, International Outreach x3257
The opinion(s) contained within this email do not necessarily represent
those of St. Jude Children's Research Hospital.

-----Original Message-----
From: Michael Jeung [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, October 26, 2004 1:31 PM
Subject: [PHP-DB] gdbm locking problem

Hello everyone,

I am having trouble with gdbm locking.  I've written two very simple 
test scripts that I am running simultaneously and locking does not seem 
to be working properly.

1st Test Script - Opens a writer lock, then spins infinitely.
   dba_open("research.db", "wd", "gdbm");
   while(1) {
     echo "I have a writer lock on the file! \n";

2nd Test Script: - Spins infinitely, trying to get a write lock on the 
   while(1) {
     if(dba_open("research.db", "wd", "gdbm"))
       echo "I also have a write lock on the file! (using dba_open) \n";

Here is the problem: When I run Script 1 and then Script 2 (while 
Script 1 is running), both scripts claim to have a writer lock on 
research.db.  This doesn't seem right.  What am I missing?

I'm running both of the scripts in the same directory on the same 
machine under FreeBSD 4.10.

Thanks for your help!

Michael Jeung

PHP Database Mailing List (
To unsubscribe, visit:

PHP Database Mailing List (
To unsubscribe, visit:

Reply via email to