سؤال

I tried to increase file descriptors max limit on GNU/Linux:

$ ulimit -n 999999

and I'm starting the server with -env ERL_MAX_PORTS 4096.

Whenever I'm using test util, after 1012-1024 opened connection I'm getting the messages "Closed: socket_closed_remotely" and "Closed: emfile".

هل كانت مفيدة؟

المحلول

I found my mistake. I called ulimit for another shell.

نصائح أخرى

Try tweaking max option which is passed to mochiweb_socket_server:start/1 from your APPLICATION_web:start/1, where APPLICATION is the name of your application; for example your application called helloworld, then you will find the function start/1 in file ./src/helloworld_web.erl which looks like:

start(Options) ->
    {DocRoot, Options1} = get_option(docroot, Options),
    Loop = fun (Req) ->
              ?MODULE:loop(Req, DocRoot)
    end,
    mochiweb_http:start([{name, ?MODULE}, {loop, Loop} | Options1]).

Modify call to mochiweb_http:start/1 to include the option max:

    mochiweb_http:start([{max, 1000000}, {name, ?MODULE}, {loop, Loop} | Options1]).

Hope that helps.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top