Browse Source

[core] default server.max-fds=4096 if unspecified (#2789)

x-ref:
  "lighttpd cores on AIX when nofiles is unlimited"
  https://redmine.lighttpd.net/issues/2789
personal/stbuehler/mod-csrf
Glenn Strauss 5 years ago
parent
commit
3399b0dd16
  1. 2
      src/fdevent.c
  2. 3
      src/server.c

2
src/fdevent.c

@ -23,7 +23,7 @@ fdevents *fdevent_init(server *srv, size_t maxfds, fdevent_handler_t type) {
ev->fdarray = calloc(maxfds, sizeof(*ev->fdarray));
if (NULL == ev->fdarray) {
log_error_write(srv, __FILE__, __LINE__, "SDS",
"server.max-fds too large? (", maxfds, ")");
"server.max-fds too large? (", maxfds-1, ")");
free(ev);
return NULL;
}

3
src/server.c

@ -1063,6 +1063,9 @@ static int server_main (server * const srv, int argc, char **argv) {
srv->max_fds = rlim.rlim_cur < (rlim_t)FD_SETSIZE - 200 ? (int)rlim.rlim_cur : (int)FD_SETSIZE - 200;
} else {
srv->max_fds = rlim.rlim_cur;
/*(default upper limit of 4k if server.max-fds not specified)*/
if (i_am_root && 0 == srv->srvconf.max_fds && rlim.rlim_cur > 4096)
srv->max_fds = 4096;
}
/* set core file rlimit, if enable_cores is set */

Loading…
Cancel
Save