Welcome! Log In Create A New Profile

Advanced

[nginx] Core: when changing binary, newly forked master process should not remove unix domain socket unless old master has quit.

Datong Sun via nginx-devel
December 02, 2016 04:24AM
# HG changeset patch
# User Datong Sun <dndx@idndx.com>
# Date 1480669905 21600
# Fri Dec 02 03:11:45 2016 -0600
# Node ID 92a7853a439708584bbc45b416df464c64ec446e
# Parent 1b7a6785d1f3c76f436a9dea5cb0fc86e1db5f2b
Core: when changing binary, newly forked master process should
not remove unix domain socket unless old master has quit.

This commit fixes a bug that during a binary change, when both
old and new master processes are running, sending TERM to the
new master process will accidently remove unix domain socket
from disk while old master is still listening on it.

diff -r 1b7a6785d1f3 -r 92a7853a4397 src/core/ngx_connection.c
--- a/src/core/ngx_connection.c Fri Dec 02 03:06:48 2016 -0600
+++ b/src/core/ngx_connection.c Fri Dec 02 03:11:45 2016 -0600
@@ -1007,7 +1007,8 @@

if (ls[i].sockaddr->sa_family == AF_UNIX
&& ngx_process <= NGX_PROCESS_MASTER
- && ngx_new_binary == 0)
+ && ngx_new_binary == 0
+ && getppid() == 1)
{
u_char *name = ls[i].addr_text.data + sizeof("unix:") - 1;

--
Datong Sun
dndx@idndx.com

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[nginx] Core: when changing binary, newly forked master process should not remove unix domain socket unless old master has quit.

Datong Sun via nginx-devel 1036 December 02, 2016 04:24AM

Re: [nginx] Core: when changing binary, newly forked master process should not remove unix domain socket unless old master has quit.

Maxim Dounin 331 December 07, 2016 10:50AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 132
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready