Forum: NGINX nginx not removing stream socket

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
09f5f6b58be8300f6edcd6b1641a3574?d=identicon&s=25 Anoop Alias (Guest)
on 2016-07-04 15:36
(Received via mailing list)
Hi,

On CentOS7 . nginx is not removing the stream socket on shutdown
causing restarts to fail unless the socket file is manually removed.
nginx process itself exit .But becase of the file not being removed
nginx is unable to bind to the socket file on next start

systemd unit file
#######################

[Service]
Type=forking
PIDFile=/var/run/nginx.pid
ExecStartPre=/usr/sbin/nginx -t -c /etc/nginx/nginx.conf
ExecStart=/usr/sbin/nginx -c /etc/nginx/nginx.conf
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true

[Install]
WantedBy=multi-user.target
###########################

#nginx configuration

stream {
    upstream mysql_backend {
        server unix:/var/lib/mysql/mysql_original.sock;
        server x.x.x.x:13306 backup;
    }

    server {
        listen     127.0.0.1:3306;
        listen     unix:/var/lib/mysql/mysql.sock;
        proxy_pass mysql_backend;
    }
}
######################################

The same setting is working fine on a centos6 server with init .

which use the killproc function from /etc/rc.d/init.d/functions

Even on CentOS6 ..if I do

kill -QUIT <nginx_pid>

the binary exits without removing the socket.

What am I doing wrong?.

What is the correct signal to terminate the process and remove the
sockets bound.

Thanks,
--
Anoop P Alias
09f5f6b58be8300f6edcd6b1641a3574?d=identicon&s=25 Anoop Alias (Guest)
on 2016-07-04 15:53
(Received via mailing list)
ok just found this - https://trac.nginx.org/nginx/ticket/753

So shall i use SIGTERM instead of SIGQUIT in the systemd unit file?

On Mon, Jul 4, 2016 at 7:05 PM, Anoop Alias <anoopalias01@gmail.com>
wrote:
> [Service]
> ###########################
>         listen     127.0.0.1:3306;
> Even on CentOS6 ..if I do
> Thanks,
> --
> Anoop P Alias



--
Anoop P Alias
This topic is locked and can not be replied to.