Keepalived Connections Reset after reloading the configuration (HUP Signal)

allenhe nginx-forum at forum.nginx.org
Thu Feb 18 08:14:08 UTC 2021


Looking into the big loop code, it may happen that the worker process may
close the keepalive connection before consuming any pending read events?

    for ( ;; ) {

        if (ngx_exiting) {
            if (ngx_event_no_timers_left() == NGX_OK) {
                ngx_log_error(NGX_LOG_NOTICE, cycle->log, 0, "exiting");
                ngx_worker_process_exit(cycle);
            }
        }

        ngx_log_debug0(NGX_LOG_DEBUG_EVENT, cycle->log, 0, "worker cycle");

        ngx_process_events_and_timers(cycle);

        if (ngx_terminate) {
            ngx_log_error(NGX_LOG_NOTICE, cycle->log, 0, "exiting");
            ngx_worker_process_exit(cycle);
        }

        if (ngx_quit) {
            ngx_quit = 0;
            ngx_log_error(NGX_LOG_NOTICE, cycle->log, 0,
                          "gracefully shutting down");
            ngx_setproctitle("worker process is shutting down");

            if (!ngx_exiting) {
                ngx_exiting = 1;
                ngx_set_shutdown_timer(cycle);
                ngx_close_listening_sockets(cycle);
                ngx_close_idle_connections(cycle);            <--what if a
read event is coming when goes here? 
            }
        }

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,197927,290794#msg-290794



More information about the nginx mailing list