synrc / n2o

⭕ N2O: Distributed WebSocket Application Server ISO 20922
https://ws.n2o.dev
Other
1.34k stars 168 forks source link

Problem about N2O application server run in background as service. #210

Closed whw987 closed 9 years ago

whw987 commented 9 years ago

hi, Mr Namdak Tonpa

3 days ago, I made my N2O application server run in background as service with your guide successfully. but another problem occurred, and the error message are same as our old start service method, now I copy some error message as follow.

=ERROR REPORT==== 29-Apr-2015::00:42:51 ===^M Too many processes^M ^M ^M =ERROR REPORT==== 29-Apr-2015::00:42:51 ===^M Error in process <0.147.3664> on node 'kvs@127.0.0.1' with exit value: {[{reason,system_limit},{mfa,{n2o_cowboy,handle,2}},{stacktrace,[{erlang,spawn,[erlang,apply,[#Fun,[]]],[]},{erlang,spawn,1,[]},{n2o_document,run,1,[{file,"/home/skyy/dev/skyy/n2o/deps/n2o/src/endpoints/n2o_document.erl"},{... ^M ^M ^M =ERROR REPORT==== 29-Apr-2015::00:42:51 ===^M Ranch listener http had connection process started with cowboy_protocol:start_link/4 at <0.147.3664> exit with reason: {[{reason,system_limit},{mfa,{n2o_cowboy,handle,2}},{stacktrace,[{erlang,spawn,[erlang,apply,[#Fun,[]]],[]},{erlang,spawn,1,[]},{n2o_document,run,1,[{file,"/home/skyy/dev/skyy/n2o/deps/n2o/src/endpoints/n2o_document.erl"},{line,10}]},{n2o_cowboy,handle,2,[{file,"/home/skyy/dev/skyy/n2o/deps/n2o/src/endpoints/cowboy/n2o_cowboy.erl"},{line,13}]},{cowboy_handler,handler_handle,4,[{file,"/home/skyy/dev/skyy/n2o/deps/cowboy/src/cowboy_handler.erl"},{line,111}]},{cowboy_protocol,execute,4,[{file,"/home/skyy/dev/skyy/n2o/deps/cowboy/src/cowboy_protocol.erl"},{line,442}]}]},{req,[{socket,#Port<0.272370>},{transport,ranch_tcp},{connection,close},{pid,<0.147.3664>},{method,<<"HEAD">>},{version,'HTTP/1.0'},{peer,{{192,168,36,1},38880}},{host,<<>>},{host_info,undefined},{port,80},{path,<<"/check.html">>},{path_info,undefined},{qs,<<>>},{qs_vals,undefined},{bindings,[]},{headers,[]},{p_headers,[]},{cookies,undefined},{meta,[]},{body_state,waiting},{buffer,<<>>},{multipart,undefined},{resp_compress,false},{resp_state,waiting},{resp_headers,[]},{resp_body,<<>>},{onresponse,undefined}]},{state,{state,undefined,undefined}}],[{cowboy_protocol,execute,4,[{file,"/home/skyy/dev/skyy/n2o/deps/cowboy/src/cowboy_protocol.erl"},{line,442}]}]}^M ^M =ERROR REPORT==== 29-Apr-2015::00:42:52 ===^M Too many processes^M ^M ^M =ERROR REPORT==== 29-Apr-2015::00:42:52 ===^M Error in process <0.147.3672> on node 'kvs@127.0.0.1' with exit value: {[{reason,system_limit},{mfa,{n2o_cowboy,handle,2}},{stacktrace,[{erlang,spawn,[erlang,apply,[#Fun,[]]],[]},{erlang,spawn,1,[]},{n2o_document,run,1,[{file,"/home/skyy/dev/skyy/n2o/deps/n2o/src/endpoints/n2o_document.erl"},{... ^M ^M

As a rule, after my app server run in background several hours, the above error message appeared.
can you help me to diagnose what reason cause this problem.

5HT commented 9 years ago

Too many processes and {reason,system_limit} say that your check ulimit settings or your host. Or your may run out of memory sue to some infinite or memory consumption loop.

whw987 commented 9 years ago

I think this problem maybe come from my mobile app. The app has a problem, a request to the server, then the serve must return the response to the app, but now in many cases the response has not received from the app, the app can issue many other request to the server, after several hours, the above error message speared. Do you think the problem possibility come from the the app.

5HT commented 9 years ago

You may try to read http://www.erlang-in-anger.com This is comprehensive book on debugging Erlang applications.

whw987 commented 9 years ago

Thank you.