|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #28055 pfsockopen hangs for 30 seconds if connection is established
Submitted: 2004-04-19 13:06 UTC Modified: 2004-04-19 15:08 UTC
From: chris at deviantart dot com Assigned: wez (profile)
Status: Closed Package: Sockets related
PHP Version: 4.3.6 OS: Linux 2.6.5
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: chris at deviantart dot com
New email:
PHP Version: OS:


 [2004-04-19 13:06 UTC] chris at deviantart dot com
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("")}, 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}

The following patch seems to fix it:

Maybe this needs backporting?

Reproduce code:
$fp = pfsockopen("rembrandt", 11211);
$fp = pfsockopen("rembrandt", 11211);


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2004-04-19 14:44 UTC]
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
Thank you for the report, and for helping us make PHP better.

Yep, it did - thanks for bringing this up.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 19:01:31 2024 UTC