php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #32199 php-cgi hanging
Submitted: 2005-03-05 15:35 UTC Modified: 2005-11-25 22:16 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (100.0%)
From: valenok at gmail dot com Assigned:
Status: Not a bug Package: CGI/CLI related
PHP Version: 5.0.3 OS: windows xp professional
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.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: valenok at gmail dot com
New email:
PHP Version: OS:

 

 [2005-03-05 15:35 UTC] valenok at gmail dot com
Description:
------------
i wrote a simple script, test.php which
does echo 'hello world'.
I start cmd.exe, and run "php-cgi test.php".

It returns normal HTML output, as suspected.

But if I do run the same line again and again,
it occasionally hangs. It shows the output, right,
but hangs so only task manager can kill php-cgi process.
pressing Ctrl-C, Ctrl-Z does not help.

This happens if I export CGI-specific variables as well.
path to php-cgi is set to global Path environment variable.

Why does it happen, and why does it happen unpredictably ?
Also, the same situation is with php.exe from 4.3 branch.

Reproduce code:
---------------
#!php-cgi

<html>

<?
	echo 'hello words!';
?>
</html>


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-03-06 14:34 UTC] valenok at gmail dot com
basically, the best way to test it is to make a
simple script that runs "php-cgi.exe test.php"
in an infinite loop.
Eventually, it will stuck.
 [2005-03-06 16:27 UTC] sniper@php.net
Exactly how have you configured PHP in httpd.conf ??

 [2005-03-06 16:30 UTC] valenok at gmail dot com
The reason I am reporting is I am writing HTTP server.
I have found that php pages sometimes do not 'return':
browser shows the output, but spinner still spins,
and php process is still running.
It never happens with other CGIs - perl, python, native
executables.
I never happened on unix.
So first thing I blamed was my server.
But. I have found that it hangs directly from command line,
also I have found other people reports about this kind
of issue (hanging on IIS, Xitami, etc, never on Apache).

This gave me a reason to suspect php itself.
 [2005-03-06 16:32 UTC] sniper@php.net
Exactly HOW do you run PHP on command line when it hangs?
What script?

 [2005-03-20 23:57 UTC] valenok at gmail dot com
I start new cmd.exe session, and run:
php-cgi test.php

this is the content of test.php:
#!php-cgi
<html>
<?
	echo 'hello words!';
?>
</html>
 [2005-03-21 08:27 UTC] sniper@php.net
Try removing the hashbang line ( #!php-cgi ) from the script.

 [2005-03-22 01:19 UTC] valenok at gmail dot com
removing hashbang makes no difference.

Please note that that hanging happens not on any machine.

I have win2000 in my network, that can run "php-cgi test.php" in an infinite loop for days without any hanging, so that problem is not repeatable on that machine.
And, since it is happening with php 4.3 and 5.0.2, (so I assume with any version of php), it is quite 'fundamental', so does exist for a long time. Problems that other people reported (with xitami, IIS hangup) confirm that assumption.

What can I do to debug that problem ?
Can I switch on tracing of resource allocation, and stuff like that ? Are there debug binary releases available ?
 [2005-03-22 18:42 UTC] sniper@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5-win32-latest.zip

There was some thread issue fixed.

 [2005-03-22 23:02 UTC] valenok at gmail dot com
with that latest release, 5.1.0-dev,
the script hangs every single time!
 [2005-03-23 23:57 UTC] sniper@php.net
You can build the debug version yourself,
see README.WIN32-BUILD-SYSTEM in the source snapshot package:

  http://snaps.php.net/php5-latest.tar.gz

 [2005-03-24 11:17 UTC] valenok at gmail dot com
thank you.
I will try it today evening.
 [2005-03-24 18:42 UTC] sniper@php.net
Let's keep the status at 'Feedback' until you can give some results. We're not interested in WHEN you might do it.

 [2005-11-24 17:52 UTC] valenok at gmail dot com
I think there is some race condition in php which
makes it hang. It is easy to debug by getting/building
debug version of php, run test, wait until it hangs,
and then see the call stack in a debugger.
After that the fun starts to find the race responsible
for the lock.

Sure I gonna investigate that when I have enough time and beer :-)
 [2005-11-25 21:02 UTC] sniper@php.net
Please don't litter this report with useless comments. 
Give the feedback we need or let this report rot.

 [2005-11-25 22:08 UTC] valenok at gmail dot com
This is you, Mr. sniper@php.net, who litter this report with useless comments. You *did* make posts even without reading. So please, let us sort out the bug without your *great help*.
 [2005-11-25 22:16 UTC] tony2001@php.net
.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 30 20:01:30 2024 UTC