ID:               44864
 User updated by:  fhoenig at kargo dot com
 Reported By:      fhoenig at kargo dot com
 Status:           Open
 Bug Type:         Reproducible crash
 Operating System: FreeBSD 7.0 / AMD64
 PHP Version:      5.2.5
 New Comment:

Actually I cased down the problem a bit further.

socket_select under these conditions is not waiting even is the tv_sec
is set to NULL (in which case it should wait infinitely)

instead of sleep, put: $num_changed_streams = stream_select($rfd, $wfd,
$efd, NULL);

something is wrong with sockets here...


Previous Comments:
------------------------------------------------------------------------

[2008-04-29 21:25:52] fhoenig at kargo dot com

Description:
------------
The below code only works with sleeping in between
stream_socket_client() and the first IO on the socket. No error though.
Works on FreeBSD 6.2 and linux as well as OSX. Just not on Freebsd 7.0.
was installed through ports with default options.

What changed in freebsd 7 that could cause that? Fix through sysctl
option maybe?

Reproduce code:
---------------
$fp = stream_socket_client("tcp://www.google.com:80", $errno, $errstr,
0, STREAM_CLIENT_CONNECT | STREAM_CLIENT_ASYNC_CONNECT);

//sleep(1); <=== works only with sleep uncommented.

if (!$fp) {
    echo "$errstr ($errno)<br />\n";
} else {
    fwrite($fp, "GET / HTTP/1.0\r\nHost: www.example.com\r\nAccept:
*/*\r\n\r\n");
    while (!feof($fp)) {

        echo fgets($fp, 1024);
    }
    fclose($fp);
}



Expected result:
----------------
The html output from www.google.com/


Actual result:
--------------
Locks up after fwrite and never reads anything from the socket. No
error. 


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=44864&edit=1

Reply via email to