php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #65922 Cannot configure keepalive time
Submitted: 2013-10-17 08:59 UTC Modified: 2014-09-15 12:13 UTC
From: nick dot r dot norton at gmail dot com Assigned: mike (profile)
Status: Wont fix Package: pecl_http (PECL)
PHP Version: Irrelevant OS: CentOS
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:
Package:
Bug Type:
Summary:
From: nick dot r dot norton at gmail dot com
New email:
PHP Version: OS:

 

 [2013-10-17 08:59 UTC] nick dot r dot norton at gmail dot com
Description:
------------
The connections my HttpRequest instances create appear to be getting reused in subsequent, entirely separate executions.  This eventually causes my connections to hang on subsequent requests seemingly at random because the connection to the remote server has gone away due to idling but my end was never closed.

I have a script that just calls a fixed external endpoint using the HttpRequest class with a timeout of 30 seconds, nothing else.  Most of the time it responds successfully (after around 600ms) but sometimes it throws a timeout.  Monitoring network traffic shows the underlying connection getting reused from previous requests but the remote end never accepts the request, it has hung up from inactivity.

This functionality appears to be a way to achieve keep-alive connections within PHP.  Adding the header "Connection: close" completely resolves this issue.  Of course, this isn't a good solution.

Curl has the option "--keepalive-time", can that be set with HttpRequest?  If so, how?  If not, please allow that.

I *love* this library but this little surprise has caused me a lot of trouble.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-10-17 09:44 UTC] mike@php.net
-Status: Open +Status: Assigned -Assigned To: +Assigned To: mike
 [2013-10-17 09:44 UTC] mike@php.net
Thanks for the report, I'll look into it!
 [2014-03-24 12:55 UTC] mike@php.net
There's actually no plan on adding features to pecl_http-v1.

TCP keepalive options are supported in v2, though:
http://devel-m6w6.rhcloud.com/mdref/http/Client/Curl#Networking
 [2014-09-15 12:13 UTC] mike@php.net
-Status: Assigned +Status: Wont fix
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 05:01:30 2024 UTC