PHP 4.0 Bug #5122 Updated: db.c - call to flock() - lock relased too early when close() is called
| From: | Bug Database | Date: | Sun, 03 Sep 2000 23:49:51 +0000 |
| Subject: | PHP 4.0 Bug #5122 Updated: db.c - call to flock() - lock relased too early when close() is called | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-31876@lists.php.net to get a copy of this message | ||
ID: 5122
Updated by: sniper
Reported By: wcampbell@chello.com
Status: Feedback
Bug Type: DBM/DBA related
Assigned To:
Comments:
Could you provide some sample script to test this..?
--Jani
Previous Comments:
[2000-08-20 04:02:06] sniper@php.net
Does this problem still persist with more recent version of php (from CVS or http://snaps.php.net) ??
--Jani
---------------------------------------------------------------------------
[2000-06-19 14:01:05] wcampbell@chello.com
The function php_dbm_open() in db.c contains the following lines ...
if (lockfd) {
flock(lockfd,LOCK_EX);
close(lockfd);
} else {
php_error(E_WARNING, "Unable to establish lock: %s",filename);
}
I don't think that this will achieve what is intended - at least not under Solaris where PHP
implements flock() in terms of fnctl(). (I strongly suspect that this problem will also show itself
under other versions of UNIX).
The reason is that the lock will be released immediately after it is obtained by the call to
close().
I noticed this problem under PHP 3.0.12 but I have looked at the source code of PHP 4.0.0 to verify
that this problem hasn't been fixed there.
---------------------------------------------------------------------------
Full Bug description available at: http://bugs.php.net/?id=5122