|  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: -
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 Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: tstarling at wikimedia dot org
New email:
PHP Version: OS:


 [2007-12-13 12:34 UTC] tstarling at wikimedia dot org
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:
if ( isset( $_REQUEST['f'] ) ) {
	$f = fopen( 'blah', 'w' );
	flock( $f, LOCK_EX );
	sleep( 1 );
	passthru( "echo Hello" );
} else {
	$self = $_SERVER['SCRIPT_NAME'];
	echo <<<EOT
<frameset rows="50%, 50%">
<frame src="$self?f=1"/>
<frame src="$self?f=2"/>

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. 


Add a Patch

Pull Requests

Add a Pull Request


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

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:

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: Tue May 21 02:01:35 2024 UTC