ID: 44864 User updated by: fhoenig at kargo dot com Reported By: fhoenig at kargo dot com -Status: Feedback +Status: Open Bug Type: Streams related Operating System: FreeBSD 7.0 / AMD64 PHP Version: 5.2.5 Assigned To: fb-req-jani New Comment:
Yes and it does even more unpredictable things. It seems like I get the bytes I write to the socket back on the reads... I need to look more into it though. I just found that the problem does not exist on freebsd 7.0/i386. So it has to do with 64-bit land. Previous Comments: ------------------------------------------------------------------------ [2008-04-30 08:48:16] [EMAIL PROTECTED] Please try using this CVS snapshot: http://snaps.php.net/php5.2-latest.tar.gz For Windows (zip): http://snaps.php.net/win32/php5.2-win32-latest.zip For Windows (installer): http://snaps.php.net/win32/php5.2-win32-installer-latest.msi ------------------------------------------------------------------------ [2008-04-29 23:56:48] fhoenig at kargo dot com 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... ------------------------------------------------------------------------ [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