Nginx not removing stream socket

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

ok just found this - #753 (Nginx leaves UNIX domain sockets after SIGQUIT) – nginx

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

On Mon, Jul 4, 2016 at 7:05 PM, Anoop A. [email protected]
wrote:

[Service]
###########################
listen 127.0.0.1:3306;
Even on CentOS6 …if I do
Thanks,

Anoop P Alias


Anoop P Alias