[erlang-questions] confusing returns from httpc:request/4
Ingela Andin
ingela.andin@REDACTED
Wed Oct 13 10:53:20 CEST 2010
Hi!
The only reason that the httpc-client will return the value {error,
socket_closed_remotely}
is that the connection is prematurely closed by the server.
Unfortunately that something
is sent on a tcp socket does not mean it has been sent on the wire
yet, and depending on
the circumstances it is possible for the socket to be closed before
all data has been sent
so occasionally a tcp_close can come before all data is delivered.
When you use ibrowse do you verify that you always get a correct body?
(compleate body) from what I can tell from the code ibrowse will on a
tcp_closed message always return whatever happens to be in the buffer
compleate or not.
Regards Ingela Erlang/OTP team - Ericsson AB
2010/10/7 Dan Kelley <djk121@REDACTED>:
> Hi,
>
> I've got a simple router that's talking to a remote HTTP load balancer via
> httpc:request/4. For every request that I get into the router, I spawn a
> new process then attempt to connect to the HTTP LB.
>
> That works well most of the time, but occasionally I get
> {error, socket_closed_remotely} instead of results. I had assumed that
> these corresponded to the HTTP LB prematurely closing the connection, but
> when I look at the logs for that process, it always thinks that it's
> returning clean responses (HTTP 200 code, appropriately-formed bodies, etc).
>
> Anyone seen anything like this before? What else might I do to debug this?
>
> Thanks,
>
> Dan
>
More information about the erlang-questions
mailing list