#23258 [Asn->Fbk]: fgets() hangs 15 seconds on EOF of a socket

From: Date: Mon, 28 Apr 2003 13:07:17 +0000
Subject: #23258 [Asn->Fbk]: fgets() hangs 15 seconds on EOF of a socket
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-38553@lists.php.net to get a copy of this message
ID: 23258 Updated by: wez@php.net Reported By: markus dot pfefferle at web dot de -Status: Assigned +Status: Feedback Bug Type: Sockets related Operating System: Windows 2000 PHP Version: 4.3.2-RC Assigned To: wez New Comment: Please try using this CVS snapshot: http://snaps.php.net/php4-STABLE-latest.tar.gz For Windows: http://snaps.php.net/win32/php4-win32-STABLE-latest.zip I can't reproduce this here under winxp with the latest stable snapshot. Does it work if you use the correct canonical line endings for your headers as specified by the HTTP spec ? "\n" is incorrect, "\r\n" is correct. Previous Comments: ------------------------------------------------------------------------ [2003-04-25 05:44:20] wez@php.net I must verify/fix this before 4.3.2 goes gold. ------------------------------------------------------------------------ [2003-04-23 07:15:07] markus dot pfefferle at web dot de Back from Eastern holiday. Downloaded and installed the CVS snapshot (phpinfo() says build 2195) and tried it again. Same error - 15 seconds pause at the last (failing) read from a socket: 1051099825 : string(1) "" 1051099825 : string(1) "" 1051099825 : string(1) "" 1051099825 : string(1) "" 1051099841 : string(0) "" So ticket still open. ------------------------------------------------------------------------ [2003-04-17 09:40:23] wez@php.net Please try using this CVS snapshot: http://snaps.php.net/php4-STABLE-latest.tar.gz For Windows: http://snaps.php.net/win32/php4-win32-STABLE-latest.zip ------------------------------------------------------------------------ [2003-04-17 09:23:54] markus dot pfefferle at web dot de Err, nevermind. I figured out why - var_dump() writes to the output buffer before echo does. But in the end, the 15 second-problem remains. Here with fread($fp, 1): 1050589160 : string(1) "\n" 1050589160 : string(1) "\n" 1050589160 : string(1) "\n" 1050589160 : string(1) "\n" 1050589175 : string(0) "" It takes fread() and fgets() in Blocking mode 15 seconds to realize that the connection has been severed. ------------------------------------------------------------------------ [2003-04-17 09:13:58] markus dot pfefferle at web dot de The "Array" is a mistake actually - an output from another place of my code. Yet still the mystery remains, why the loop goes through another cycle after the last call to fgets() has returned false and feof() is not reflecting the end of the connection. And why $r in this case does not check out as "false" in an expression to preliminary end the loop. ------------------------------------------------------------------------ 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/23258 -- Edit this bug report at http://bugs.php.net/?id=23258&edit=1

« previous php.bugs (#38553) next »