RE: gdbm locking problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



http://us2.php.net/manual/en/function.dba-open.php 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
offense):

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:mjeung@xxxxxxxxxxx] 
Sent: Tuesday, October 26, 2004 1:31 PM
To: php-db@xxxxxxxxxxxxx
Subject:  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 
file.
   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 (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux