[erlang-questions] Any tcp related changes in R15B* that might cause this?

Jesper Louis Andersen <>
Wed Dec 12 17:18:57 CET 2012


On Dec 6, 2012, at 8:38 PM, Anthony Molinaro <> 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






More information about the erlang-questions mailing list