php.net |  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
Votes:8
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
Have you experienced this issue?
Rate the importance of this bug to you:

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


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-05-24 04:06 UTC] sobak@php.net
-Type: Documentation Problem +Type: Bug
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 05:01:29 2024 UTC