diff options
author | Maxim Dounin <mdounin@mdounin.ru> | 2018-07-12 19:50:07 +0300 |
---|---|---|
committer | Maxim Dounin <mdounin@mdounin.ru> | 2018-07-12 19:50:07 +0300 |
commit | 85b44b46fb851fc933e3c053ab2c45e5b92f85c9 (patch) | |
tree | dab8003b19e217b0d6e55a6fa773fe6c1d5a6bab /src | |
parent | 751bdd3bb2b6ff54be09c37ff328f258fed520fb (diff) | |
download | nginx-85b44b46fb851fc933e3c053ab2c45e5b92f85c9.tar.gz nginx-85b44b46fb851fc933e3c053ab2c45e5b92f85c9.zip |
Events: added configuration check on the number of connections.
There should be at least one worker connection for each listening socket,
plus an additional connection for channel between worker and master,
or starting worker processes will fail.
Diffstat (limited to 'src')
-rw-r--r-- | src/event/ngx_event.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/event/ngx_event.c b/src/event/ngx_event.c index a18b1132c..69c55d7a0 100644 --- a/src/event/ngx_event.c +++ b/src/event/ngx_event.c @@ -421,6 +421,21 @@ ngx_event_init_conf(ngx_cycle_t *cycle, void *conf) return NGX_CONF_ERROR; } + if (cycle->connection_n < cycle->listening.nelts + 1) { + + /* + * there should be at least one connection for each listening + * socket, plus an additional connection for channel + */ + + ngx_log_error(NGX_LOG_EMERG, cycle->log, 0, + "%ui worker_connections are not enough " + "for %ui listening sockets", + cycle->connection_n, cycle->listening.nelts); + + return NGX_CONF_ERROR; + } + #if (NGX_HAVE_REUSEPORT) ls = cycle->listening.elts; |