changeset 7316:8f152ca81f5f

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.
author Maxim Dounin <mdounin@mdounin.ru>
date Thu, 12 Jul 2018 19:50:07 +0300
parents e7b2b907c0f8
children 6565f0dbe8c5
files src/event/ngx_event.c
diffstat 1 files changed, 15 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/event/ngx_event.c
+++ b/src/event/ngx_event.c
@@ -421,6 +421,21 @@ ngx_event_init_conf(ngx_cycle_t *cycle, 
         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;