php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #62071 CLI Programs Hang Forever
Submitted: 2012-05-19 14:44 UTC Modified: 2014-12-30 10:41 UTC
Votes:4
Avg. Score:4.0 ± 1.0
Reproduced:4 of 4 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: ewilde at bsmdevelopment dot com Assigned:
Status: No Feedback Package: *General Issues
PHP Version: 5.4.3 OS: CentOS 5.8
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: ewilde at bsmdevelopment dot com
New email:
PHP Version: OS:

 

 [2012-05-19 14:44 UTC] ewilde at bsmdevelopment dot com
Description:
------------
Scripts executed under the CLI never end.  For example, the following test script will run as long as you let it, until it is killed.  It doesn't appear to be looping, as it consumes no resources.  Rather, it appears to be blocked waiting for some signal that never happens.

Note that this may explain why the 5.4.3 build cannot be built with "--enable-phar" and why "make install" hangs forever at the end.

Build parms: ./configure --with-apxs2=/usr/share/httpd-2.4/bin/apxs --with-curl --with-gd --with-ldap --with-libxml-dir=/usr/local --with-mcrypt --with-mysql=/usr/local/mysql --with-mysqli=/usr/bin/mysql_config --with-openssl --with-pspell --with-unixODBC=/usr/local/unixODBC --enable-bcmath --disable-phar --enable-sockets


Test script:
---------------
#!/usr/bin/php
<script language="php">

  fwrite(STDOUT, "This is a test\n");

</script>


Expected result:
----------------
The CLI program exits.

Actual result:
--------------
The CLI program never exits.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-05-20 21:55 UTC] felipe@php.net
I can't reproduce it.
 [2012-05-21 18:57 UTC] ewilde at bsmdevelopment dot com
Well, that figures. Its way too simple a test to have slipped through your regression testing.

I have other programs that are more complicated which fail in exactly the same way. In all cases, absolutely all of the work, whatever it is, gets done to completion. All that happens is they hang on exit or when the code falls through the end of the script.

It sounds like one of those exec/wait problems whereby the wait in a mother task fails to complete when the daughter task, that's doing all of the work, ends. This could easily be OS-dependent or build-dependent and, hence, hard for you to reproduce.

If you want to contact me offline about where to look, I'll try to debug the problem on the test system where its failing.
 [2012-05-31 20:19 UTC] riptide dot tempora at opinehub dot com
Would I wrong in assuming that exit; or die(); would properly kill the program in your situation?
 [2012-07-08 13:40 UTC] ewilde at bsmdevelopment dot com
I tried both exit and die.

When I added "exit(1)" to the test program, it still hung.

When I added "die("The end")" to the test program, I saw the string "The end" but then the program hung after that.

It seems that the hang is in the program exit/cleanup code of PHP, not the logic of the program itself.

Any other ideas about what you'd like to test?
 [2013-06-28 07:30 UTC] shm@php.net
-Package: Reproducible crash +Package: *General Issues
 [2013-06-28 07:30 UTC] shm@php.net
May you strace the process?
 [2013-12-05 17:19 UTC] mike@php.net
-Status: Open +Status: Feedback
 [2013-12-05 17:19 UTC] mike@php.net
Yup, strace or it didn't happen.
 [2014-12-30 10:41 UTC] php-bugs 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-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 22:01:26 2024 UTC