[erlang-questions] inets/httpc bad match issue for 2 post requests

Marc Worrell marc@REDACTED
Thu Jan 15 22:37:58 CET 2015

My feeling is that the error is exactly what it says: the remote server closes the socket.
Adding a debug statement gives httpc the time to catch that close. Without the debug statement httpc will try to reuse the open connection to the server, at the moment the server is closing the connection.

Try to use HTTP/1.0 and an extra request header "Connection: close".
That might solve your problem.

Also check the server. Do you have a proxy in front of webmachine? Maybe check if the socket is closed after the first request?

- marc

Sent from my iPad

> On 15 jan. 2015, at 22:05, Felix Gallo <felixgallo@REDACTED> wrote:
> httpc has some heisenbugs which I wish I had time to examine and try to fix.  The fact that a debug print statement makes the problem goes away suggests it's a race condition of some kind.  The smart money is on trying to use either hackney (https://github.com/benoitc/hackney) or one of the lhttpc forks (https://github.com/Cloven/lhttpc).
> F.
>> On Thu, Jan 15, 2015 at 11:49 AM, Shawn Debnath <shawn@REDACTED> wrote:
>> Hi there,
>> Wondering if anyone can shed some light on this issue I am seeing. 
>> I am trying to understand what may be causing **error:{badmatch,{error,socket_closed_remotely}} when using the same inets process to do 2 POST/PUT requests. The same code works just fine when issuing the same rest API calls to two separate inets processes or when issuing 2 GET requests to the same inets process. 
>> Using webmachine on the server side which is not reporting any errors, and looking at the WMTRACEs, it correctly returns HTTP 401 error, which is expected.
>> Test source and output can be found at: http://pastebin.com/9DFzxLps
>> Thanks,
>> Shawn
>> _______________________________________________
>> erlang-questions mailing list
>> erlang-questions@REDACTED
>> http://erlang.org/mailman/listinfo/erlang-questions
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20150115/d4d54d6d/attachment.htm>

More information about the erlang-questions mailing list