php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #63996 Possible race condition
Submitted: 2013-01-15 19:26 UTC Modified: 2016-12-25 04:22 UTC
From: tom at sl dot cm Assigned:
Status: No Feedback Package: dio (PECL)
PHP Version: 5.4.10 OS: 3.6.11-gentoo-xxxx-std-ipv6-64
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2013-01-15 19:26 UTC] tom at sl dot cm
Description:
------------
I run three very active machines which all use dio to lock files on an NFS export.

Several times a day, one of the php instances randomly locks up and spins with 
100% CPU, and this will complete.

I've traced the issue down to dio_open - which, for some reason, sometimes causes 
the CPU to spin away and it never returns.



Test script:
---------------
Here's the code block that the issue occurs in. PLEASE NOTE:  This code works 99.9999% of the time - the issue, unfortunately, cannot be reliably reproduced.

$flags = O_RDONLY;
$locktype = F_RDLCK;
$locked = false;

while($locked === false)
{
	$this->handle = @dio_open($filename, $flags, 0777);	
	if ($this->handle===false) break;
	$res = @dio_fcntl($this->handle, F_SETLK, Array("type"=>$locktype));
	if ($res!=-1)
	{
		$locked = true;	
	}
	else
	{
		@dio_close($this->handle);
		$this->handle=false;	
		usleep(250000);
	}
}	


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-01-15 19:27 UTC] tom at sl dot cm
"and this will complete." should be "and won't stop until killed."
 [2016-12-13 07:06 UTC] remi@php.net
-Status: Open +Status: Feedback
 [2016-12-13 07:06 UTC] remi@php.net
Does this still exists with latest 0.0.8 ?
 [2016-12-25 04:22 UTC] pecl-dev at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Thu Sep 16 16:03:37 2021 UTC