php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #5122 db.c - call to flock() - lock relased too early when close() is called
Submitted: 2000-06-19 14:01 UTC Modified: 2000-10-02 22:28 UTC
From: wcampbell at chello dot com Assigned:
Status: Closed Package: DBM/DBA related
PHP Version: 4.0.0 Release OS: Solaris 2.6
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: wcampbell at chello dot com
New email:
PHP Version: OS:

 

 [2000-06-19 14:01 UTC] wcampbell at chello dot 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.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-08-20 04:02 UTC] sniper@php.net
Does this problem still persist with more recent version of php (from CVS or http://snaps.php.net) ??

--Jani
 [2000-09-03 19:49 UTC] sniper@php.net
Could you provide some sample script to test this..?

--Jani
 [2000-10-02 22:28 UTC] sniper@php.net
No feedback.

--Jani
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Oct 08 04:01:28 2024 UTC