<br><div class="gmail_extra"><div class="gmail_quote">On Wed, Dec 12, 2012 at 6:48 PM, Anthony Molinaro <span dir="ltr"><<a href="mailto:anthonym@alumni.caltech.edu" target="_blank">anthonym@alumni.caltech.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Okay, here's some more information, seems like the real error is<br>

<br>
{tcp_error,#Port<0.98735301>,emsgsize}<br>
<br>
earlier.  So maybe sometime between R14B04 and R15B02 the handling of<br>
emsgsize changed?<br></blockquote><div><br></div><div>Hi Anthony, any chance your app is dealing with some very long HTTP header lines? In November 2011 I submitted a patch that was intended to stop HTTP DOS attacks consisting of huge header lines. It's commit 5984409d, which came just after R14B04 was released in October 2011.</div>
<div><br></div><div>--steve</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<br>
I think what happens with mochiweb is it has a receive which matches several<br>
message types, then has a catch all.  The catch all gets the emsgsize error<br>
and the tcp_closed error is in the mailbox, then the code handling the catch<br>
all attempts to setopts on the socket and gets the einval error because<br>
the socket is closed.<br>
<br>
So I'm really curious what might have changed in the tcp driver that might<br>
have changed this behavior.  I'm trying to figure out how to reproduce so<br>
I can patch mochiweb to work around this (most likely by just adding a<br>
clause to the receive).<br>
<span class=""><font color="#888888"><br>
-Anthony<br>
</font></span><div class=""><div class="h5"><br>
On Wed, Dec 12, 2012 at 10:26:32AM -0800, Anthony Molinaro wrote:<br>
> Well, yes, I did see the tcp_closed message, my real question is I guess<br>
> related to your statement<br>
><br>
> "It may be that R15 is more accurate at reporting here than R14, so the older version just accepts the result blindly and then have the no change, whereas R15 actually reports the correct error."<br>
><br>
> Can anyone from OTP clarify if any work was done with regards to error<br>
> messages?  I did not find anything in the release notes which is why<br>
> I'm wondering.<br>
><br>
> I suppose I could attempt to git bisect this or something, but I'm not<br>
> sure how difficult that might be.<br>
><br>
> Thanks,<br>
><br>
> -Anthony<br>
><br>
> On Wed, Dec 12, 2012 at 05:18:57PM +0100, Jesper Louis Andersen wrote:<br>
> ><br>
> > On Dec 6, 2012, at 8:38 PM, Anthony Molinaro <<a href="mailto:anthonym@alumni.caltech.edu">anthonym@alumni.caltech.edu</a>> wrote:<br>
> ><br>
> > > 2012-12-01 00:01:33 =CRASH REPORT====<br>
> > >  crasher:<br>
> > >    initial call: mochiweb_acceptor:init/3<br>
> > >    pid: <0.2942.3599><br>
> > >    registered_name: []<br>
> > >    exception error: {{badmatch,{error,einval}},[{mochiweb_http,new_request,3,[]},{mochiweb_http,handle_invalid_request,3,[]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,227}]}]}<br>
> > >    ancestors: [webmachine_mochiweb,web_serve_sup,<0.619.0>]<br>
> > >    messages: [{tcp_closed,#Port<0.222190389>}]<br>
> > >    links: [<0.873.0>]<br>
> > >    dictionary: []<br>
> > >    trap_exit: false<br>
> > >    status: running<br>
> > >    heap_size: 987<br>
> > >    stack_size: 24<br>
> > >    reductions: 541<br>
> > >  neighbours:<br>
> ><br>
> > If you read through the Mochi code, you will see this:<br>
> ><br>
> > <a href="https://github.com/mochi/mochiweb/blob/master/src/mochiweb_http.erl#L125" target="_blank">https://github.com/mochi/mochiweb/blob/master/src/mochiweb_http.erl#L125</a><br>
> ><br>
> >     ok = mochiweb_socket:setopts(Socket, [{packet, raw}]),<br>
> ><br>
> > So assuming that is true, the problem is a posix() message einval (Invalid Argument), probably because the<br>
> > socket is long dead and gone. It may be that R15 is more accurate at reporting here than R14, so the older version just accepts the result blindly and then have the no change, whereas R15 actually reports the correct error.<br>

> ><br>
> > A thing supporting my hypothesis is that there is a tcp_closed message in your mailbox :)<br>
> ><br>
> ><br>
> > Jesper Louis Andersen<br>
> >   Erlang Solutions Ltd., Copenhagen<br>
> ><br>
> ><br>
> ><br>
><br>
> --<br>
> ------------------------------------------------------------------------<br>
> Anthony Molinaro                           <<a href="mailto:anthonym@alumni.caltech.edu">anthonym@alumni.caltech.edu</a>><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>
--<br>
------------------------------------------------------------------------<br>
Anthony Molinaro                           <<a href="mailto:anthonym@alumni.caltech.edu">anthonym@alumni.caltech.edu</a>><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>
</div></div></blockquote></div><br></div>