ID: 25575 Comment by: robert at interjinn dot com Reported By: bill at baghead dot co dot uk Status: Open Bug Type: Sockets related Operating System: Redhat 9 PHP Version: 4CVS-2003-09-17 (stable) New Comment:
I've been directed here from bug #25616 with the indication that this is the same bug. I read this bug before I posted bug #25616 and the issues seems different. This one describes an issue with blocking mode, my bug describes an issue whith the script exitting successfully while in an infinite loop, which is contrary to the expected functionality of a while( 1 ) loop. I'm not sure why I was pointed here. Albeit my bug seemed to come into existence with the use of stream_set_blocking( $stdin, FALSE ) Previous Comments: ------------------------------------------------------------------------ [2003-09-18 04:15:44] bill at baghead dot co dot uk The case is with the original code stated, the code loops, and does not block on the fread - ie, it keeps returning instantly (even with nothing), which seems to me to be non blocking eventhough I'd told it to block.. If I remove the stream_set_blocking(STDIN,TRUE); altogether, fread appears to block - but instead of returning after receiving a block of data, it blocks until the buffer is filled up (in this case being 128 bytes) - *then* it returns.. ------------------------------------------------------------------------ [2003-09-17 18:37:38] [EMAIL PROTECTED] What you have just described is blocking IO, and that is precisely what I'd expect to happen when reading from STDIN. Now, when reading from a socket, you would expect the call to return at the end of a packet, but php doesn't yet have any idea that stdin is a socket, and that sounds like the cause of your problems. Can you confirm that this is the case, as your more recent comments don't seem to match up to your original report? ------------------------------------------------------------------------ [2003-09-17 18:35:41] [EMAIL PROTECTED] Comment sent from user by mail; please don't mail people directly; keep all info related to the bug in the database unless requested to do otherwise. ------------------------------ What exactly was the workaround? I did try removing the statement, and it kept reading the STDIN with the fread until the amount, in this case being 128 bytes is filled, rather than taking it to the end of the packet... ------------------------------------------------------------------------ [2003-09-17 13:14:14] [EMAIL PROTECTED] Will you please try the workaround I suggested? I'm not saying it isn't a bug, I'm just suggesting something that might help get your script working in the time it takes for this bug to get fixed. ------------------------------------------------------------------------ [2003-09-17 12:49:37] bill at baghead dot co dot uk Surely it wouldnt matter if xinetd opened the socket blocking or non-blocking, as the script opens STDIN which needs to be blocking.... as php is talking to stdin, *not* the socket directly.. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/25575 -- Edit this bug report at http://bugs.php.net/?id=25575&edit=1