<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div>My feeling is that the error is exactly what it says: the remote server closes the socket.</div><div>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.</div><div><br></div><div>Try to use HTTP/1.0 and an extra request header "Connection: close".</div><div>That might solve your problem.</div><div><br></div><div>Also check the server. Do you have a proxy in front of webmachine? Maybe check if the socket is closed after the first request?</div><div><br></div><div>- marc</div><div><br>Sent from my iPad</div><div><br>On 15 jan. 2015, at 22:05, Felix Gallo <<a href="mailto:felixgallo@gmail.com">felixgallo@gmail.com</a>> wrote:<br><br></div><blockquote type="cite"><div><div dir="ltr">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 (<a href="https://github.com/benoitc/hackney">https://github.com/benoitc/hackney</a>) or one of the lhttpc forks (<a href="https://github.com/Cloven/lhttpc">https://github.com/Cloven/lhttpc</a>).<div><br></div><div>F.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jan 15, 2015 at 11:49 AM, Shawn Debnath <span dir="ltr"><<a href="mailto:shawn@debnath.net" target="_blank">shawn@debnath.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word;color:rgb(0,0,0);font-size:14px;font-family:Calibri,sans-serif">
<div>
<div>
<div>
<div>Hi there,</div>
<div><br>
</div>
<div>Wondering if anyone can shed some light on this issue I am seeing. </div>
<div><br>
</div>
<div>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. </div>
<div><br>
</div>
<div>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.</div>
<div><br>
</div>
<div>Test source and output can be found at: <a href="http://pastebin.com/9DFzxLps" target="_blank">http://pastebin.com/9DFzxLps</a></div>
<div><br>
</div>
<div>Thanks,</div>
<div>Shawn</div>
</div>
<div><br>
</div>
<div>
<div></div>
</div>
</div>
</div>
</div>
<br>_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
<br></blockquote></div><br></div>
</div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>erlang-questions mailing list</span><br><span><a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a></span><br><span><a href="http://erlang.org/mailman/listinfo/erlang-questions">http://erlang.org/mailman/listinfo/erlang-questions</a></span><br></div></blockquote></body></html>