|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #67336 blocking socket + signal handling
Submitted: 2014-05-23 13:20 UTC Modified: 2014-05-24 04:06 UTC
Avg. Score:5.0 ± 0.0
Reproduced:6 of 8 (75.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: ignasimg at gmail dot com Assigned:
Status: Open Package: Sockets related
PHP Version: Irrelevant OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
Solve the problem:
39 - 25 = ?
Subscribe to this entry?

 [2014-05-23 13:20 UTC] ignasimg at gmail dot com
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:

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:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2014-05-24 04:06 UTC]
-Type: Documentation Problem +Type: Bug
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sat Nov 27 08:03:12 2021 UTC