php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #43588 Deadlock-free exec function
Submitted: 2007-12-13 12:34 UTC Modified: -
Votes:2
Avg. Score:4.0 ± 1.0
Reproduced:2 of 2 (100.0%)
Same Version:0 (0.0%)
Same OS:2 (100.0%)
From: tstarling at wikimedia dot org Assigned:
Status: Open Package: Feature/Change Request
PHP Version: 5.2.5 OS: Windows
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: tstarling at wikimedia dot org
New email:
PHP Version: OS:

 

 [2007-12-13 12:34 UTC] tstarling at wikimedia dot org
Description:
------------
I would like to request the addition of a deadlock-free shell execution function to PHP on Windows. PHP already has one of these on the Linux platform, and I think it would be a useful addition to the Windows platform as well. 

PHP deadlocks whenever an exec function is called, if another thread is waiting for a file lock that the executing thread holds. This is the expected behaviour and is not a bug, see bug 42064. But some applications may benefit from the ability to call a shell execution function during a file-lock-protected critical section without risking a permanent deadlock of the participating threads. That is why I am making this feature request. 

Reproduce code:
---------------
<?php
if ( isset( $_REQUEST['f'] ) ) {
	$f = fopen( 'blah', 'w' );
	flock( $f, LOCK_EX );
	sleep( 1 );
	passthru( "echo Hello" );
} else {
	$self = $_SERVER['SCRIPT_NAME'];
	echo <<<EOT
<html>
<frameset rows="50%, 50%">
<frame src="$self?f=1"/>
<frame src="$self?f=2"/>
</frameset>
</html>
EOT;
}
?>

Expected result:
----------------
The two frames should both display "Hello", after a delay of 2 seconds.

Actual result:
--------------
The frames take forever to load. Requires a force quit of Apache. 

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-01-18 09:39 UTC] obones at free dot fr
Hello,

This would indeed be very convenient as right now it makes it very hard to understand why the server is down.
There are numerous reports of the freeze/hands with exec() and Apache under windows, two of which are those:

http://bugs.php.net/bug.php?id=44942
http://bugs.php.net/bug.php?id=44994

In my case, it's by using the SourceSVN plugin inside a Mantis installation that I stumbled across this very annoying behavior.
While someone imports the latest SVN changes, nobody can work with Apache anymore which is very very annoying, especially the need to force close the server.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Nov 23 09:01:28 2024 UTC