<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; color: rgb(0, 0, 0); font-size: 14px;">
<div>
<div style="font-family: Calibri, sans-serif;">Well looks like that was the issue. Using just HTTP/1.0
<b>without</b> the "Connection: close" header does the trick as it forces the connection close. Tried with “Connection: keep-alive” header without the HTTP/1.0 option but that was a no-go as well.</div>
<div style="font-family: Calibri, sans-serif;"><br>
</div>
<div style="font-family: Calibri, sans-serif;">Looks like its time to follow up with webmachine guys.</div>
<div style="font-family: Calibri, sans-serif;">
<div id="MAC_OUTLOOK_SIGNATURE"></div>
</div>
</div>
<div style="font-family: Calibri, sans-serif;"><br>
</div>
<div style="font-family: Calibri, sans-serif;">Thanks Marc and Felix.</div>
<div style="font-family: Calibri, sans-serif;"><br>
</div>
<span id="OLK_SRC_BODY_SECTION" style="font-family: Calibri, sans-serif;">
<div style="font-family:Calibri; font-size:12pt; text-align:left; color:black; BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; PADDING-LEFT: 0in; PADDING-RIGHT: 0in; BORDER-TOP: #b5c4df 1pt solid; BORDER-RIGHT: medium none; PADDING-TOP: 3pt">
<span style="font-weight:bold">From: </span>Marc Worrell<br>
<span style="font-weight:bold">Date: </span>Thursday, January 15, 2015 at 1:37 PM<br>
<span style="font-weight:bold">To: </span>Felix Gallo<br>
<span style="font-weight:bold">Cc: </span>Shawn Debnath, Erlang Questions<br>
<span style="font-weight:bold">Subject: </span>Re: [erlang-questions] inets/httpc bad match issue for 2 post requests<br>
</div>
<div><br>
</div>
<div>
<div 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>
</div>
</div>
</span>
</body>
</html>