<HTML xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:p="urn:schemas-microsoft-com:office:powerpoint" xmlns:a="urn:schemas-microsoft-com:office:access" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882" xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:b="urn:schemas-microsoft-com:office:publisher" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:c="urn:schemas-microsoft-com:office:component:spreadsheet" xmlns:odc="urn:schemas-microsoft-com:office:odc" xmlns:oa="urn:schemas-microsoft-com:office:activation" xmlns:html="http://www.w3.org/TR/REC-html40" xmlns:q="http://schemas.xmlsoap.org/soap/envelope/" xmlns:rtc="http://microsoft.com/officenet/conferencing" xmlns:D="DAV:" xmlns:Repl="http://schemas.microsoft.com/repl/" xmlns:mt="http://schemas.microsoft.com/sharepoint/soap/meetings/" xmlns:x2="http://schemas.microsoft.com/office/excel/2003/xml" xmlns:ppda="http://www.passport.com/NameSpace.xsd" xmlns:ois="http://schemas.microsoft.com/sharepoint/soap/ois/" xmlns:dir="http://schemas.microsoft.com/sharepoint/soap/directory/" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:dsp="http://schemas.microsoft.com/sharepoint/dsp" xmlns:udc="http://schemas.microsoft.com/data/udc" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:sub="http://schemas.microsoft.com/sharepoint/soap/2002/1/alerts/" xmlns:ec="http://www.w3.org/2001/04/xmlenc#" xmlns:sp="http://schemas.microsoft.com/sharepoint/" xmlns:sps="http://schemas.microsoft.com/sharepoint/soap/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:udcs="http://schemas.microsoft.com/data/udc/soap" xmlns:udcxf="http://schemas.microsoft.com/data/udc/xmlfile" xmlns:udcp2p="http://schemas.microsoft.com/data/udc/parttopart" xmlns:wf="http://schemas.microsoft.com/sharepoint/soap/workflow/" xmlns:dsss="http://schemas.microsoft.com/office/2006/digsig-setup" xmlns:dssi="http://schemas.microsoft.com/office/2006/digsig" xmlns:mdssi="http://schemas.openxmlformats.org/package/2006/digital-signature" xmlns:mver="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns:mrels="http://schemas.openxmlformats.org/package/2006/relationships" xmlns:spwp="http://microsoft.com/sharepoint/webpartpages" xmlns:ex12t="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:ex12m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:pptsl="http://schemas.microsoft.com/sharepoint/soap/SlideLibrary/" xmlns:spsl="http://microsoft.com/webservices/SharePointPortalServer/PublishedLinksService" xmlns:Z="urn:schemas-microsoft-com:" xmlns:tax="http://schemas.microsoft.com/sharepoint/taxonomy/soap/" xmlns:tns="http://schemas.microsoft.com/sharepoint/soap/recordsrepository/" xmlns:spsup="http://microsoft.com/webservices/SharePointPortalServer/UserProfileService" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:st="" xmlns="http://www.w3.org/TR/REC-html40">
<HEAD><!-- Template generated by Exclaimer Template Editor on 04:13:13 Thursday, 7 March 2019 -->
<STYLE type=text/css>P.64240f2a-6266-479f-a8a0-10047947cd24 {
MARGIN: 0cm 0cm 0pt
}
LI.64240f2a-6266-479f-a8a0-10047947cd24 {
MARGIN: 0cm 0cm 0pt
}
DIV.64240f2a-6266-479f-a8a0-10047947cd24 {
MARGIN: 0cm 0cm 0pt
}
TABLE.64240f2a-6266-479f-a8a0-10047947cd24Table {
MARGIN: 0cm 0cm 0pt
}
DIV.Section1 {
page: Section1
}
</STYLE>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="Generator" content="Microsoft Word 14 (filtered medium)" />
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
p
{mso-style-priority:99;
mso-margin-top-alt:auto;
margin-right:0in;
mso-margin-bottom-alt:auto;
margin-left:0in;
font-size:12.0pt;
font-family:"Times New Roman","serif";}
p.82951262-ef1c-4a24-83c3-c58b78badb87, li.82951262-ef1c-4a24-83c3-c58b78badb87, div.82951262-ef1c-4a24-83c3-c58b78badb87
{mso-style-name:82951262-ef1c-4a24-83c3-c58b78badb87;
margin:0in;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman","serif";}
span.EmailStyle18
{mso-style-type:personal;
font-family:"Calibri","sans-serif";
color:#1F497D;}
span.EmailStyle20
{mso-style-type:personal-reply;
font-family:"Calibri","sans-serif";
color:#1F497D;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</HEAD>
<BODY lang="EN-US" link="blue" vlink="purple">
<P>
<div class="WordSection1">
<p class="MsoNormal"><span style=font-size:11.0pt;font-family:"Calibri","sans-serif">Hi Lukas, All,<o:p></o:p></span></p>
<p class="MsoNormal"><span style=font-size:11.0pt;font-family:"Calibri","sans-serif"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style=font-size:11.0pt;font-family:"Calibri","sans-serif">Was there any progress in this?<o:p></o:p></span></p>
<p class="MsoNormal"><span style=font-size:11.0pt;font-family:"Calibri","sans-serif">You mentioned a major rewrite of gen_tcp below, possibly breaking backwards compatibility. Where can I find more info about the plans and progress?<o:p></o:p></span></p>
<p class="MsoNormal"><span style=font-size:11.0pt;font-family:"Calibri","sans-serif"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style=font-size:11.0pt;font-family:"Calibri","sans-serif">Thanks,<o:p></o:p></span></p>
<p class="MsoNormal"><span style=font-size:11.0pt;font-family:"Calibri","sans-serif"> Andras<o:p></o:p></span></p>
<p class="MsoNormal"><span style=font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D><o:p> </o:p></span></p>
<p class="MsoNormal"><span style=font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style=font-size:10.0pt;font-family:"Tahoma","sans-serif">From:</span></b><span style=font-size:10.0pt;font-family:"Tahoma","sans-serif"> erlang-questions-bounces@erlang.org [mailto:erlang-questions-bounces@erlang.org]
<b>On Behalf Of </b>Bekes, Andras G<br />
<b>Sent:</b> Friday, August 31, 2018 12:43 PM<br />
<b>To:</b> Lukas Larsson<br />
<b>Cc:</b> Erlang Questions<br />
<b>Subject:</b> <Unverified Sender>Re: [erlang-questions] {error,closed} vs. {error,econnreset}<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p>Note: This e-mail has been flagged because although the sender appears to be internal, the e-mail originated outside the Firm. The senders address may have been forged, which can be an indicator of malicious activity. If you have any concerns about the content
or sender of this e-mail, please report it immediately via the Spam Report button in Outlook or email spambutton@ms.com<o:p></o:p></p>
<div>
<p class="MsoNormal"><span style=font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D>Hi Lukas, All,<o:p></o:p></span></p>
<p class="MsoNormal"><span style=font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D><o:p> </o:p></span></p>
<p class="MsoNormal"><span style=font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D>I do not have TCP dump, but according to strace, the error is:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D"><... writev resumed> ) = -1 ENOTCONN (Transport endpoint is not connected)<o:p></o:p></span></p>
<p class="MsoNormal"><span style=font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D>The error indeed happens on a write, and on the Erlang side this is reported as a normal close, at the next gen_tcp:recv call.<o:p></o:p></span></p>
<p class="MsoNormal"><span style=font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D><o:p> </o:p></span></p>
<p class="MsoNormal"><span style=font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D>Let us not go into discussing what can cause this error on a socket (unix domain BTW). It is irrelevant here.<o:p></o:p></span></p>
<p class="MsoNormal"><span style=font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D>The important here is that this socket error, and any other socket error shall not be confused with an orderly shutdown of the socket.<o:p></o:p></span></p>
<p class="MsoNormal"><span style=font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D><o:p> </o:p></span></p>
<p class="MsoNormal"><span style=font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D>I support the below mentioned proposal of making the default behavior report all errors, and the masking behavior explicitly selected with an option.<o:p></o:p></span></p>
<p class="MsoNormal"><span style=font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D><o:p> </o:p></span></p>
<p class="MsoNormal"><span style=font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D>Regards,<o:p></o:p></span></p>
<p class="MsoNormal"><span style=font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D> Andras<o:p></o:p></span></p>
<p class="MsoNormal"><span style=font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D><o:p> </o:p></span></p>
<p class="MsoNormal"><b><span style=font-size:10.0pt;font-family:"Tahoma","sans-serif">From:</span></b><span style=font-size:10.0pt;font-family:"Tahoma","sans-serif"> Lukas Larsson [mailto:lukas@erlang.org]
<br />
<b>Sent:</b> Thursday, August 16, 2018 2:37 PM<br />
<b>To:</b> Bekes, Andras G (IST)<br />
<b>Cc:</b> Erlang Questions<br />
<b>Subject:</b> Re: [erlang-questions] {error,closed} vs. {error,econnreset}<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<div>
<p class="MsoNormal" style=margin-bottom:12.0pt>Hello,<o:p></o:p></p>
<div>
<div>
<p class="MsoNormal">On Mon, 6 Aug 2018, 10:49 Bekes, Andras G, wrote:<o:p></o:p></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0in;margin-bottom:5.0pt">
<p class="MsoNormal">Hi All,<br />
<br />
Reviving this old thread again, because I am getting more and more convinced that we need further changes.<br />
We're still observing connection close events when an error should be reported to gen_tcp level.<br />
It can be a reset error somehow still not reported as 'econnreset', but I suspect it must be some other error.<o:p></o:p></p>
</blockquote>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">I suppose that you have not managed to catch the error in a tcp dump as Rory asked for?<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0in;margin-bottom:5.0pt">
<p class="MsoNormal"><br />
I checked the code in inet_drv.c. The function<br />
static int tcp_recv(tcp_descriptor* desc, int request_len)<br />
seems to work properly -- a reset is either reported as closed or econnreset, depending on show_econnreset, all other errors are reported as errors.<br />
<br />
However, the function<br />
static int tcp_send_or_shutdown_error(tcp_descriptor* desc, int err)<br />
hides errors. Connection reset errors are properly handled (either reported as closed or econnreset, depending on show_econnreset), but all other errors are just reported as closed.<br />
Active and passive modes have independent code paths, but I think both do the same: all errors are reported as normal close -- except for econnreset.<o:p></o:p></p>
</blockquote>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">There is a merge of error codes happening in tcp_send_error, so some other errors get mapped into econnreset before tcp_send_or_shutdown_error is called.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0in;margin-bottom:5.0pt">
<p class="MsoNormal"><br />
Apparently I need to detect all errors.<br />
Is it possible to implement a show_errors (or show_all_errors) flag, too?<br />
<br />
Actually, this new flag could replace the current show_econnreset flag.<br />
Having two separate flags for econnreset & others requires more complex code, but having a single show_errors flag would simplify the current that provides special treatment for econnreset.<br />
I am not sure if it makes much sense to expose connection reset errors but still mask all other errors as normal close events.<br />
<br />
From a farther point of view, it seems there are network-programming tasks (there is at least one!), for which Erlang seems not suitable. This sounds rather sad.<br />
Luckily the fix doesn't seem difficult.<br />
<br />
What do you think?<o:p></o:p></p>
</blockquote>
</div>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">I agree that it should be possible to get the original error from the tcp stack. Given the discussions here <a href="https://github.com/erlang/otp/pull/731">https://github.com/erlang/otp/pull/731</a>, maybe it is time to reverse the options
so that returning the original error becomes the default and you have to set an option to get the backwards compatible behaviour?<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">We are currently in the process of a major overhaul of gen_tcp and friends, so maybe this can be changed while doing that, as we are bound to break backwards compatibility in various ways during that rewrite anyways.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Lukas<o:p></o:p></p>
</div>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div class="MsoNormal" align="center" style=text-align:center>
<hr size="2" width="100%" align="center" id="HR1" />
</div>
</div>
</div>
<BR />
<HR id=HR1 />
<P></P>
<P></P>
<P></P>
<P></P></P></BODY>
</HTML>
--_000_EEDCCA33995F1A42894A53C0E0B655969C89FF77OZWEX0209N2msad_--