2

我用 Erlang 和 Mochiweb 制作了一个彗星聊天服务器。我运行“./start-dev.sh”来启动服务器。但大约 1 个月后,我收到以下错误:

=ERROR REPORT==== 26-Sep-2009::09:21:06 ===
{mochiweb_socket_server,235,
    {child_error,
        {badmatch,
            {error,
                [70,97,105,108,101,100,32,115,101,110,100,105,110,103,32,100,
                 97,116,97,32,111,110,32,115,111,99,107,101,116,32,58,32,
                 "closed"]}}}}
mysql: fetch "SELECT appKey FROM applications WHERE appID = 1" (id p1)

=CRASH REPORT==== 26-Sep-2009::09:21:10 ===
  crasher:
    initial call: mochiweb_socket_server:acceptor_loop/1
    pid: <0.4271.23>
    registered_name: []
    exception error: no match of right hand side value 
                     {error,[70,97,105,108,101,100,32,115,101,110,100,105,110,
                             103,32,100,97,116,97,32,111,110,32,115,111,99,
                             107,101,116,32,58,32,"closed"]}
      in function  moonwalker_web:loop/2
      in call from mochiweb_http:headers/5
    ancestors: [moonwalker_web,moonwalker_sup,<0.52.0>]
    messages: []
    links: [<0.54.0>,#Port<0.792854>]
    dictionary: [{mochiweb_request_body,
                      <<"appID=1&appKey=keyy&userID=8048943&nickName=bill&buddies=N%3B&timestamp=1253928070154">>},
                  {mochiweb_request_recv,true},
                  {mochiweb_request_post,
                      [{"appID","1"},
                       {"appKey","key"},
                       {"userID","8048943"},
                       {"nickName",[143,229,167,144]},
                       {"buddies","N;"},
                       {"timestamp","1253928070154"}]},
                  {mochiweb_request_path,"/online"}]
    trap_exit: false
    status: running
    heap_size: 2584
    stack_size: 24
    reductions: 1368
  neighbours:

=ERROR REPORT==== 26-Sep-2009::09:21:10 ===
{mochiweb_socket_server,235,
    {child_error,
        {badmatch,
            {error,
                [70,97,105,108,101,100,32,115,101,110,100,105,110,103,32,100,
                 97,116,97,32,111,110,32,115,111,99,107,101,116,32,58,32,
                 "closed"]}}}}

如果将以下数字变成字符

            [70,97,105,108,101,100,32,115,101,110,100,105,110,103,32,100,
             97,116,97,32,111,110,32,115,111,99,107,101,116,32,58,32,
             "closed"]}}}}

他们是

Failed sending data on socket :"closed"

这是否意味着我的 MySQL 连接或套接字有问题?我不知道这个错误是否与我的“./start-dev.sh”有关,或者我只是有一些错误的设置?

我还需要提供哪些信息来进行诊断?

感谢并期待您的回复?

4

1 回答 1

2

看起来在 loop/2 函数的某个地方,您没有处理函数调用的 {error,Error} 返回。这会导致导致进程崩溃的错误。如果没有代码,很难说出导致错误返回的原因。

于 2009-09-27T16:42:56.723 回答