ID: 34654 User updated by: sebastian dot forsman at gmail dot com Reported By: sebastian dot forsman at gmail dot com Status: Bogus Bug Type: Sockets related Operating System: Linux 2.4.28 PHP Version: 5.0.5 New Comment:
As I mentioned in my post, yes, you can always set the socket non-blocking. But it's only a workaround, not a fix to the problem. And besides the loop will then consume all of the CPU. Right, you can use sleep(), but hey, come on. If PHP is supposed to support signals properly etc, as any process should, this behavior has to be changed. It is no excuse that the control is yield to the socket library. Previous Comments: ------------------------------------------------------------------------ [2005-09-27 14:18:08] [EMAIL PROTECTED] Sorry, but your problem does not imply a bug in PHP itself. For a list of more appropriate places to ask for help using PHP, please visit http://www.php.net/support.php as this bug system is not the appropriate forum for asking support questions. Due to the volume of reports we can not explain in detail here why your report is not a bug. The support channels will be able to provide an explanation for you. Thank you for your interest in PHP. Nothing strange about this--it's not called blocking for lack of a better name. When a socket enters blocking mode, the application yields control to the socket library, from where it does not return until a socket event takes place. If you want more control, you need to set your sockets to non-blocking mode. ------------------------------------------------------------------------ [2005-09-27 10:52:21] sebastian dot forsman at gmail dot com Description: ------------ I am not sure if this is a bug or a 'feature', but when PHP is blocking, registered tick functions aren't run. It also delays handling of the Unix signals (which use ticks). Reproduce code: --------------- http://pastebin.com/375512 Expected result: ---------------- (You need Linux, posix-, pcntl- and socket-functions to run the script.) The code snippet will start a simple single-client server. Try sending a "kill <pid>" from the shell to the process. It won't react to the signal in any way, until a connection is received (try "telnet localhost 22500"). Same applies to registered tick functions. If you modify the code and register a tick function, it is not run at all when socket_accept() is waiting for a connection. Yes of course you can set the socket non-blocking, but then you are missing the point. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=34654&edit=1