[PHP-BUG] Bug #51580 [NEW]: socket_select randomly crashes when used together with fork and Unix signals

[email protected] ("marco at vmsoft-gbr dot de")
Newsgroups php.bugs
Message-ID <[email protected]>
From:             
Operating system: Debian Linux
PHP version:      5.3.2
Package:          PCNTL related
Bug Type:         Bug
Bug description:socket_select randomly crashes when used together with fork and Unix signals

Description:
------------
When firing unix signals onto a forked process with pcntl_signal handlers
active and a socket_select currently running, socket_select may crash.

Run the test script with php test.php 1339, and then launch some "kill -s
10 <child pid>" on it. After some, maybe just one, kill's, the script will
crash.

Test script:
---------------
http://php.pastebin.com/Td68vtMn

Expected result:
----------------
Installing signal handlers
Installing handler for signal 15
Installing handler for signal 10
child-pid 20030
running
marco@vs932:~/php_daemon$ kill -s 10 20030
got signal 10
marco@vs932:~/php_daemon$ kill -s 10 20030
got signal 10
marco@vs932:~/php_daemon$ kill -s 10 20030
got signal 10

(etc)

Actual result:
--------------
Installing signal handlers
Installing handler for signal 15
Installing handler for signal 10
child-pid 20030
running
marco@vs932:~/php_daemon$ kill -s 10 20030
got signal 10
marco@vs932:~/php_daemon$ kill -s 10 20030
got signal 10
marco@vs932:~/php_daemon$ kill -s 10 20030
got signal 10
marco@vs932:~/php_daemon$ kill -s 10 20030
marco@vs932:~/php_daemon$ PHP Warning:  socket_select(): unable to select
[4]: Interrupted system call in /home/marco/php_daemon/test.php on line 39
socket_select failed: Interrupted system call
end

marco@vs932:~/php_daemon$ 

-- 
Edit bug report at http://bugs.php.net/bug.php?id=51580&edit=1
-- 
Try a snapshot (PHP 5.2):            http://bugs.php.net/fix.php?id=51580&r=trysnapshot52
Try a snapshot (PHP 5.3):            http://bugs.php.net/fix.php?id=51580&r=trysnapshot53
Try a snapshot (PHP 6.0):            http://bugs.php.net/fix.php?id=51580&r=trysnapshot60
Fixed in SVN:                        http://bugs.php.net/fix.php?id=51580&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=51580&r=needdocs
Fixed in release:                    http://bugs.php.net/fix.php?id=51580&r=alreadyfixed
Need backtrace:                      http://bugs.php.net/fix.php?id=51580&r=needtrace
Need Reproduce Script:               http://bugs.php.net/fix.php?id=51580&r=needscript
Try newer version:                   http://bugs.php.net/fix.php?id=51580&r=oldversion
Not developer issue:                 http://bugs.php.net/fix.php?id=51580&r=support
Expected behavior:                   http://bugs.php.net/fix.php?id=51580&r=notwrong
Not enough info:                     http://bugs.php.net/fix.php?id=51580&r=notenoughinfo
Submitted twice:                     http://bugs.php.net/fix.php?id=51580&r=submittedtwice
register_globals:                    http://bugs.php.net/fix.php?id=51580&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=51580&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=51580&r=dst
IIS Stability:                       http://bugs.php.net/fix.php?id=51580&r=isapi
Install GNU Sed:                     http://bugs.php.net/fix.php?id=51580&r=gnused
Floating point limitations:          http://bugs.php.net/fix.php?id=51580&r=float
No Zend Extensions:                  http://bugs.php.net/fix.php?id=51580&r=nozend
MySQL Configuration Error:           http://bugs.php.net/fix.php?id=51580&r=mysqlcfg
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.