|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #53380 fgets() hangs on repetitive connection to same url
Submitted: 2010-11-22 19:39 UTC Modified: 2013-02-18 00:34 UTC
From: kontakt at beberlei dot de Assigned:
Status: No Feedback Package: Sockets related
PHP Version: 5.3.3 OS: Ubuntu 10.10
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: kontakt at beberlei dot de
New email:
PHP Version: OS:


 [2010-11-22 19:39 UTC] kontakt at beberlei dot de
I stumbled into this bug where fgets() hangs on me as long as the connection timeout with a http socket resource (CouchDB webserver).

The reproduce code is a bit longish as i think it has to do with the fetching of the same url twice. It makes no difference though if i use Keep Alive or close Connections after usage.

Xdebug Output:

Strace output is attached.


socketproblem.strace (last revision 2010-11-22 18:41 UTC by kontakt at beberlei dot de)

Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2010-11-23 04:39 UTC]
-Status: Open +Status: Feedback
 [2010-11-23 04:39 UTC]
I can't find anything wrong here.

The request is apparently successfully written (fwrite in PHP and the send() syscall return immediately, indicating it was put in the send buffer of the socket).

Then, the script calls fgets, which tries to read from the socket. However, this operation times out. Likely, the server was not able to respond in such a short period of time (1 second). I suggest you increase the timeout and try again.
 [2013-02-18 00:34 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Wed Dec 06 09:01:28 2023 UTC