[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 2017-02-28 11:32:28 -05:00
parent 8ddb727d5c
commit 3399b0dd16
2 changed files with 4 additions and 1 deletions

View File

@ -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;
}

View File

@ -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 */