From: chris at deviantart dot com Operating system: Linux 2.6.5 PHP version: 4.3.6 PHP Bug Type: Sockets related Bug description: pfsockopen hangs for 30 seconds if connection is established
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 bug report at http://bugs.php.net/?id=28055&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=28055&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=28055&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=28055&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=28055&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=28055&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=28055&r=needscript Try newer version: http://bugs.php.net/fix.php?id=28055&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=28055&r=support Expected behavior: http://bugs.php.net/fix.php?id=28055&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=28055&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=28055&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=28055&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=28055&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=28055&r=dst IIS Stability: http://bugs.php.net/fix.php?id=28055&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=28055&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=28055&r=float