Bug #68409 [Opn->Fbk]: exit hangs forever when running CLI script
| From: | ab@php.net | Date: | Wed, 12 Nov 2014 23:47:33 +0000 |
| Subject: | Bug #68409 [Opn->Fbk]: exit hangs forever when running CLI script | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-188572@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=68409&edit=1
ID: 68409
Updated by: ab@php.net
Reported by: grotagroten at hotmail dot com
Summary: exit hangs forever when running CLI script
-Status: Open
+Status: Feedback
Type: Bug
Package: *General Issues
Operating System: Windows/Linux
PHP Version: 5.6.2
Block user comment: N
Private report: N
New Comment:
I'm afraid there's not enough info. Please inspect the script and your setup. As
you're saying all the request shutdown looks like gets done, that could be anything like some
thread still polling on a connection which always stays open. I'd suggest the following
checklist:
- deactivate all the non core extensions
- deactivate some parts of the script or replace some mocks
- if it's using some connections - try to kill the counterpart processes (if you can control
them). If you see that EOF arrives - look for th ecorresponding code part.
- as last, check which core extensions you use, try deactivate one by one replacing the
corresponding parts with mocks
- if it happens on the pure core only, probably no another way then script debugging, deactivating
parts replacing them with mock and checking the result
That should be enough for the first time. Doing this you'll sure have some more perceptions to
go further.
Thanks
Previous Comments:
------------------------------------------------------------------------
[2014-11-12 12:43:58] grotagroten at hotmail dot com
Description:
------------
I have a CLI script that hangs on termination. The script will call exit when it is done, the
shutdown function will be called, destructors will be called, and then it just waits for nothing to
happen. I have to manually terminate the process to get it to exit. It does not consume any
resources, it just hangs forever. The same behaviour is observed with the die function. It appears
on both 5.5 and 5.6.
Test script:
---------------
I do not have a simple test script that can reproduce it at the moment, but I have a log from
running the script with strace.
I have uploaded the trace to the following location: http://www.filedropper.com/trace
The end of the trace looks like this, it seems to be polling for something.
fstat(12, {st_mode=S_IFREG|0777, st_size=1314, ...}) = 0
fstat(12, {st_mode=S_IFREG|0777, st_size=1314, ...}) = 0
fstat(12, {st_mode=S_IFREG|0777, st_size=1314, ...}) = 0
fstat(12, {st_mode=S_IFREG|0777, st_size=1314, ...}) = 0
mmap(NULL, 1314, PROT_READ, MAP_SHARED, 12, 0) = 0x7fc092237000
munmap(0x7fc092237000, 1314) = 0
close(12) = 0
close(3) = 0
close(4) = 0
write(6, "\1\0\0\0\0\0\0\0", 8) = 8
write(11, "\1\0\0\0\1", 5) = 5
shutdown(11, SHUT_RDWR) = 0
close(11) = 0
munmap(0x7fc087db9000, 266240) = 0
close(2) = 0
close(1) = 0
munmap(0x7fc092235000, 4096) = 0
close(0) = 0
munmap(0x7fc092236000, 4096) = 0
brk(0x2d38000) = 0x2d38000
munmap(0x7fc087d37000, 266240) = 0
munmap(0x7fc087d78000, 266240) = 0
munmap(0x7fc087e39000, 266240) = 0
munmap(0x7fc087e7a000, 266240) = 0
munmap(0x7fc087ebb000, 266240) = 0
munmap(0x7fc087efc000, 266240) = 0
munmap(0x7fc087f3d000, 266240) = 0
munmap(0x7fc087f7e000, 266240) = 0
munmap(0x7fc087fbf000, 266240) = 0
munmap(0x7fc08c035000, 266240) = 0
munmap(0x7fc08c076000, 266240) = 0
munmap(0x7fc08c0b7000, 266240) = 0
munmap(0x7fc092055000, 266240) = 0
write(10, "\1\0\0\0\0\0\0\0", 8) = 8
poll([{fd=5, events=POLLIN}], 1, 4294967295
Process 3037 detached
<detached ...>
Expected result:
----------------
Script should terminate on exit
Actual result:
--------------
Script hangs forever
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=68409&edit=1