#28055 [Asn->Csd]: pfsockopen hangs for 30 seconds if connection is established
| From: | wez@php.net | Date: | Mon, 19 Apr 2004 13:08:10 +0000 |
| Subject: | #28055 [Asn->Csd]: pfsockopen hangs for 30 seconds if connection is established | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-58372@lists.php.net to get a copy of this message | ||
ID: 28055
Updated by: wez@php.net
Reported By: chris at deviantart dot com
-Status: Assigned
+Status: Closed
Bug Type: Sockets related
Operating System: Linux 2.6.5
PHP Version: 4.3.6
Assigned To: wez
Previous Comments:
------------------------------------------------------------------------
[2004-04-19 14:44:33] wez@php.net
This bug has been fixed in CVS.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
Yep, it did - thanks for bringing this up.
------------------------------------------------------------------------
[2004-04-19 13:06:20] chris at deviantart dot com
Description:
------------
If a connection has already been established, pfsockopen will hang for
30 seconds before returning the correct persistent socket. strace
reports the following:
...
connect(3, {sa_family=AF_INET, sin_port=htons(11211),
sin_addr=inet_addr("10.0.0.16")}, 16) = -1 EINPROGRESS (Operation now
in progress)
select(4, [3], [3], [3], {60, 0}) = 1 (out [3], left {60, 0})
getsockopt(3, SOL_SOCKET, SO_ERROR, [0], [4]) = 0
fcntl64(3, F_SETFL, O_RDWR) = 0
select(4, [3], NULL, NULL, {60, 0}
*hang*
The following patch seems to fix it:
http://cvs.php.net/diff.php/php-src/main/network.c?sa=1&r1=1.83.2.21&r2=1.83.2.20&ty=u
Maybe this needs backporting?
http://cvs.php.net/cvs.php/php-src/main/streams/streams.c?sa=1#rev1.49
Reproduce code:
---------------
<?
$fp = pfsockopen("rembrandt", 11211);
$fp = pfsockopen("rembrandt", 11211);
?>
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=28055&edit=1