Doc #67336 [NEW]: blocking socket + signal handling
| From: | ignasimg at gmail dot com | Date: | Fri, 23 May 2014 13:20:22 +0000 |
| Subject: | Doc #67336 [NEW]: blocking socket + signal handling | ||
| Groups: | php.doc.bugs | ||
| Request: | Send a blank email to doc-bugs+get-11236@lists.php.net to get a copy of this message | ||
From: ignasimg at gmail dot com
Operating system: Linux
PHP version: Irrelevant
Package: Sockets related
Bug Type: Documentation Problem
Bug description:blocking socket + signal handling
Description:
------------
I'm using pcntl_signal to install a signal handler.
Then I setup a socket, and call socket_set_block to make it blocking.
Then I call sock_recvfrom.
And while the sock_recvfrom is blocked, the party starts...
*If it receives a signal which has not been installed previously with
pcntl_signal, the program wake up again and die (expected behaviour).
*If it receives a signal which has been installed with pcntl_signal, it
won't wake up, and will call the signal handler when the sock_recvfrom
wakes up.
*Finally the SIGALRM seems to be special, and no matter it has been
installed or not it'll wake up the process from the sock_recvfrom.
In my opinion it shall treat all the signals as SIGALRM, if somebody
wants to block some signals they can do it themselves with
pcntl_sigprocmask.
But my point is:
http://www.php.net/manual/en/function.socket-set-block.php
Says: "When an operation (e.g. receive, send, connect, accept, ...) is
performed on a blocking socket, the script will pause its execution
until it receives a signal or it can perform the operation. "
More on the SIGALRM workaround:
http://blog.andrewrose.co.uk/2008/02/php-getting-signals-through-to-blocking.html
--
Edit bug report at https://bugs.php.net/bug.php?id=67336&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=67336&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=67336&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=67336&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=67336&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=67336&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=67336&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=67336&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=67336&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=67336&r=support
Expected behavior: https://bugs.php.net/fix.php?id=67336&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=67336&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=67336&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=67336&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=67336&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=67336&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=67336&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=67336&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=67336&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=67336&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=67336&r=mysqlcfg