|  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
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: ignasimg at gmail dot com
New email:
PHP Version: OS:


 [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-2024 The PHP Group
All rights reserved.
Last updated: Wed Jun 19 14:01:31 2024 UTC