пт, 6 июл. 2018 г. в 6:32, Maxim Dounin <[email protected]>: > Hello! > > On Thu, Jul 05, 2018 at 07:29:37PM +0500, Илья Шипицин wrote: > > [...] > > > # cat /var/log/nginx/error.log | tail -2 > > 2018/07/05 14:27:53 [alert] 1546#1546: 512 worker_connections are not > enough > > 2018/07/05 14:27:53 [alert] 1545#1545: worker process 1546 exited with > > fatal code 2 and cannot be respawned > > # > > > > > > кажется, что было бы логично отсекать такие ошибки во время "nginx -t" > > что думаете ? > > Кажется, ситуация не отличается принципиально от любой другой, > когда nginx'у не хватает соединений для нормальной работы. Но > можно попробовать какой-то такой патч, сколько-то ног он наверное > сохранит: >
попробовал, все получается так, как задумано [root@xxx nginx-1.15.1]# objs/nginx -t nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: [emerg] 512 worker_connections are not enough for nginx with 701 listening sockets nginx: configuration file /etc/nginx/nginx.conf test failed [root@xxx nginx-1.15.1]# nginx -t nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful [root@xxx nginx-1.15.1]# > > # HG changeset patch > # User Maxim Dounin <[email protected]> > # Date 1530840179 -10800 > # Fri Jul 06 04:22:59 2018 +0300 > # Node ID 7f4aa03a8a21164881429568bd2f70a311c5c599 > # Parent 54683f650cbdcd73f7f8d845c843295978da5a85 > 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 process will fail. > > diff --git a/src/event/ngx_event.c b/src/event/ngx_event.c > --- a/src/event/ngx_event.c > +++ b/src/event/ngx_event.c > @@ -416,6 +416,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 one connection for channel > + */ > + > + ngx_log_error(NGX_LOG_EMERG, cycle->log, 0, > + "%ui worker_connections are not enough " > + "for nginx with %ui listening sockets", > + cycle->connection_n, cycle->listening.nelts); > + > + return NGX_CONF_ERROR; > + } > + > return NGX_CONF_OK; > } > > > > -- > Maxim Dounin > http://mdounin.ru/ > _______________________________________________ > nginx-ru mailing list > [email protected] > http://mailman.nginx.org/mailman/listinfo/nginx-ru
_______________________________________________ nginx-ru mailing list [email protected] http://mailman.nginx.org/mailman/listinfo/nginx-ru
