Skip to content


Subversion checkout URL

You can clone with
Download ZIP


connections are never closed #11

jclopes opened this Issue · 10 comments

2 participants


ibrowse never timesout on a open connection if the server never closes the connection.
This will cause an application that connects to several different domains to eventually exhaust all file descriptors.

I suggest the use of some sort of argument to explicitly pass a timeout in seconds or infinity to a send_req.
The connection should be closed after the timeout has expired.


Have you tried using the inactivity_timeout option?


no I haven't where and how should I set this option?


It was supposed to be used like this.

ibrowse:send_req(Host, Port, Method, Headers, [{inactivity_timeout, 5000} | Other_options]).

But it only works if a request is in progress. But that is a bit silly, it should work even if all requests on that connection are done and the connection is idle. I'll make a patch and let you know. Thanks for reporting it.


Here is a patch against ibrowse-2.0.1

The connection will close after 10 seconds of inactivity on the connection. You can control this timeout value by the ibrowse application variable inactivity_timeout (either set in or your sys.config file)


The updated patch at the link below supports specifying this config in ibrowse.conf as well.


I'll give it a try. thanks


I applyed your patch but I get this error:

** When Server state == undefined
** Reason for termination == 
** {function_clause,[{ibrowse_http_client,do_close,[undefined]},

looks like the state is being set to undefined somewhere.


I added this two lines to the set_inac_timer/2 to solve the problem:

+set_inac_timer(State, infinity) ->
+    State;

After some debugging I noticed that get_inac_timeout/1 was returning infinity and that would cause set_inac_timer/2 to return 'undefined'.

let me know if this is the right way to solve the problem.


That's great, thanks very much. I'll commit it soon...


It works thanks.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.