[erlang-questions] about socket_closed_remotely error on inets httpc:request/4

Allen Kim bighostkim@REDACTED
Sun Sep 25 08:53:11 CEST 2011


Hi,

First, forgive me my question is stupid because I don't have deep
knowledge of inets.
I am just eager to learn it.

I am building a erlang loadtest tool using inets,

My problem is when I send httpc:request/4, to our web server,
I see 5-10% of requests ends up with error, {error, socket_closed_remotely}.

It only happens if I send more than 200 transactions per second to a web server.

However, if I try other loadtest tool such as openload or tsung, I
don't see any errors at all.
So, I think our web server is fine, but the my loadtest client using
inets is not.

I see the following line on http_client/httpc_handler.erl,
and I don't understand from this code is, when From(request sender) is
a Pid, why it responds with error, socket_closed_remotely.

deliver_answer(#request{id = Id, from = From} = Request)
 when is_pid(From) ->
   Response = httpc_response:error(Request, socket_closed_remotely),
   ?hcrd("deliver answer", [{id, Id}, {from, From}, {response, Response}]),
   httpc_response:send(From, Response);
deliver_answer(Request) ->
   ?hcrd("skip deliver answer", [{request, Request}]),
   ok.

I thought that error is server-side socket is closed before the client
send a request to receive a message from the server.
It does not look like that case for me from the code above.

Am I wrong about this?

Thanks in advance

Allen



More information about the erlang-questions mailing list