[erlang-questions] Any tcp related changes in R15B* that might cause this?
Steve Vinoski
vinoski@REDACTED
Thu Dec 13 01:22:37 CET 2012
On Wed, Dec 12, 2012 at 6:48 PM, Anthony Molinaro <
anthonym@REDACTED> wrote:
> Okay, here's some more information, seems like the real error is
>
> {tcp_error,#Port<0.98735301>,emsgsize}
>
> earlier. So maybe sometime between R14B04 and R15B02 the handling of
> emsgsize changed?
>
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.
--steve
>
> I think what happens with mochiweb is it has a receive which matches
> several
> message types, then has a catch all. The catch all gets the emsgsize error
> and the tcp_closed error is in the mailbox, then the code handling the
> catch
> all attempts to setopts on the socket and gets the einval error because
> the socket is closed.
>
> So I'm really curious what might have changed in the tcp driver that might
> have changed this behavior. I'm trying to figure out how to reproduce so
> I can patch mochiweb to work around this (most likely by just adding a
> clause to the receive).
>
> -Anthony
>
> On Wed, Dec 12, 2012 at 10:26:32AM -0800, Anthony Molinaro wrote:
> > Well, yes, I did see the tcp_closed message, my real question is I guess
> > related to your statement
> >
> > "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."
> >
> > Can anyone from OTP clarify if any work was done with regards to error
> > messages? I did not find anything in the release notes which is why
> > I'm wondering.
> >
> > I suppose I could attempt to git bisect this or something, but I'm not
> > sure how difficult that might be.
> >
> > Thanks,
> >
> > -Anthony
> >
> > On Wed, Dec 12, 2012 at 05:18:57PM +0100, Jesper Louis Andersen wrote:
> > >
> > > On Dec 6, 2012, at 8:38 PM, Anthony Molinaro <
> anthonym@REDACTED> wrote:
> > >
> > > > 2012-12-01 00:01:33 =CRASH REPORT====
> > > > crasher:
> > > > initial call: mochiweb_acceptor:init/3
> > > > pid: <0.2942.3599>
> > > > registered_name: []
> > > > 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}]}]}
> > > > ancestors: [webmachine_mochiweb,web_serve_sup,<0.619.0>]
> > > > messages: [{tcp_closed,#Port<0.222190389>}]
> > > > links: [<0.873.0>]
> > > > dictionary: []
> > > > trap_exit: false
> > > > status: running
> > > > heap_size: 987
> > > > stack_size: 24
> > > > reductions: 541
> > > > neighbours:
> > >
> > > If you read through the Mochi code, you will see this:
> > >
> > >
> https://github.com/mochi/mochiweb/blob/master/src/mochiweb_http.erl#L125
> > >
> > > ok = mochiweb_socket:setopts(Socket, [{packet, raw}]),
> > >
> > > So assuming that is true, the problem is a posix() message einval
> (Invalid Argument), probably because the
> > > 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.
> > >
> > > A thing supporting my hypothesis is that there is a tcp_closed message
> in your mailbox :)
> > >
> > >
> > > Jesper Louis Andersen
> > > Erlang Solutions Ltd., Copenhagen
> > >
> > >
> > >
> >
> > --
> > ------------------------------------------------------------------------
> > Anthony Molinaro <anthonym@REDACTED>
> > _______________________________________________
> > erlang-questions mailing list
> > erlang-questions@REDACTED
> > http://erlang.org/mailman/listinfo/erlang-questions
>
> --
> ------------------------------------------------------------------------
> Anthony Molinaro <anthonym@REDACTED>
> _______________________________________________
> 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/20121212/7c75ae33/attachment.htm>
More information about the erlang-questions
mailing list