[erlang-bugs] (please review) hanging http_transport:connect/3 call.

Matyas Markovics <>
Tue Feb 17 18:04:24 CET 2009


Hi,

I have found some interesting timeout problems in inets and ssl.

1. Http request timeout is ignored for the period of setting up the tcp
connection.
2. Ssl connection timeout is only used as a gen_server timeout when
calling ssl_server (ssl_broker process init and handle_call-s are ignored).

This way of timeout handling becomes critical when calling
inet:getaddr/2. This call can hang (i.e. in case of DNS issues) since
the timeout is 'infinity'/unset.

I've blundered into hidden infinity timeouts in http_transport:connect/3
(if IPv6 support enabled) and in ssl_broker:connect_prim/8. Both of
these functions call inet:getaddr/2.

I have seen cases where there were no {error, timeout} returned from
http:request/4. I reviewed the code of http_client in inets. It seems to
me that the only secure way of using http:request/4 is pure tcp
connection (no ssl) with ipv6 disabled. However it is still faulty. As I
mentioned above the Timeout that can be set in http:request/4 is only
activated once the TCP/SSL connection is established and the HTTP
request is sent.

I need to use https so I'll have to find a solution. In my understanding
the correct way of fixing this issues would be to handle timeouts with
external timers. For example activate timeout in
httpc_handler:send_first_request/3 before establishing the connection.

I am not sure about how the ssl:connect/3 should be fixed though. I
would appreciate any idea and suggestion. Thx.

BTW the source that I was looking at is R11B3.

//Matyas

-------------- next part --------------
A non-text attachment was scrubbed...
Name: matyas_markovics.vcf
Type: text/x-vcard
Size: 279 bytes
Desc: not available
URL: <http://erlang.org/pipermail/erlang-bugs/attachments/20090217/118a42aa/attachment.vcf>


More information about the erlang-bugs mailing list