Илья Шипицин
July 06, 2018 12:42AM
пт, 6 июл. 2018 г. в 6:32, Maxim Dounin <mdounin@mdounin.ru>:

> 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 <mdounin@mdounin.ru>
> # 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
> nginx-ru@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx-ru
_______________________________________________
nginx-ru mailing list
nginx-ru@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-ru
Subject Author Posted

"worker_connections are not enough" - обсудим ?

Илья Шипицин July 05, 2018 10:30AM

Re: "worker_connections are not enough" - обсудим ?

Maxim Dounin July 05, 2018 09:32PM

Re: "worker_connections are not enough" - обсудим ?

Илья Шипицин July 06, 2018 12:42AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 208
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready