ID:               44942
 Comment by:       russell_anam at hotmail dot com
 Reported By:      inqualab1985 at gmail dot com
 Status:           No Feedback
 Bug Type:         Program Execution
 Operating System: Windows 2000 SP4
 PHP Version:      5.2.5
 New Comment:

I can indeed confirm that this bug exists in the latest PHP version
(PHP 5.2.8). exec() would randomly hang the Apache and the only solution
was to restart the whole server (service restart did not help). I can
also confirm that vlabella's solution INDEED worked for us. Since this
workaround works I think it's safe to say this is indeed a PHP bug that
needs to be fixed ASAP.


Previous Comments:
------------------------------------------------------------------------

[2009-01-29 18:21:30] rolinger1 at hotmail dot com

I came across this article searching for a similar problem. I am using
Perl 5.10 though but am having the same issue with Apache 2.2.  That
being said, I believe the issues are the same and that the problem is
with Apache and not php or perl.

With Perl I do a backtick call and Apache's CGI hangs.  The windows
system processes shows 1 cmd running and 1 perl app running for each
time I click on the called web script.  

Perl call:
@files = `dir ../configs /0:D /A:-D` ;

Somehow, apache uses the backtick command to launch a "cmd" console
process which in turn executes the system call "dir..."

I say the Apache CGI hangs because other PHP scripts (that don't do
system calls) all still seem to work.  But after the first CGI hang, all
other Perl calls hang - even scripts that don't have system calls in
them.  Scripts with system calls load another pair of cmd/perl processes
and return no data, scripts without system calls loads another perl
process but does return data.  

After the initial hang though, all related processes (cmd or perl)
remain in memory and eventually Apache just hangs altogether.  And when
that happens we are forced to do a system reboot - simply doing a
service restart has won't work.

------------------------------------------------------------------------

[2009-01-15 16:54:54] bill at sammer dot com

session_write_close fixes it for me too.  Thanks vlabella!

------------------------------------------------------------------------

[2008-12-04 04:35:44] dominic dot manley at det dot wa dot edu dot au

Big thanks to vlabella who led us to a work-around. This is one VERY
frustrating bug to track down!

We have an Apache/PHP 5.2.3/Win2003 setup and concurrent calls to a
script that exec()-ed the same command-line .exe caused the process to
get caught up on the server. Apache wouldn't let go of it and the only
way to kill the process and get the site/sometimes whole server back was
to restart Apache.

I never would have suspected sessions causing this issue... none of our
investigations led us close to that direction. However, vlabella got it
spot on...

Calling session_write_close() before an exec() (or simply never
initiating session support to start with using session_start()) works
around the issue.

------------------------------------------------------------------------

[2008-10-21 09:26:44] neododge at free dot fr

The same problem happens for me on PHP 5.2.6 / Apache 2.2.9, Apache
won't run any PHP after I try an exec/passthru/`` -no matter what
command I try. Only way to get PHP back seems to be closing all browser
windows that point to my server and waiting for a while before trying to
use a PHP page again.

------------------------------------------------------------------------

[2008-09-15 17:01:02] vlabella at uamail dot albany dot edu

We have been having the same issue for a long time on win2003 with php
version 5.2.X and apache 5.2.x calling both perl scripts and .exe with
the exec fuinction.  We found that it mostly happens when php runs exec
concurrently on the same process.  For example we would have ajax call
do an exec on the server to read some data and feed it back to the user
every 5 seconds.  In addition the user could do an ajax call to do
something as well on this page.  if the user call came at the same time
as the schdeduled call then php would hang and we would have to restart
apache.  We found it also happens on pages where there are multiple
exec() calls.  We find that all the scripts and programs we call run
fine its just that php hangs when they finish for some reason.  We have
our max_execution_time set to 30 minutes so its not a timeout issue.

We found that calling
session_write_close();
before each exec call seemed to resolve this issue.  But we are not
really sure why and what other effects session_write_close(); may have
on other processes.

Hope this helps resolve this issue.  it is a major headache for us for
the past 2 years!!

------------------------------------------------------------------------

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/44942

-- 
Edit this bug report at http://bugs.php.net/?id=44942&edit=1

Reply via email to