News for hackers. Stuff that matters.
Re:Upgrading Executable on the Fly by nullify88 on Tuesday January 04, 2022 @04:12PM (#29800592)
Once the USR2 signal is received the master process forks, the child process inherits the parents file descriptors including listen(). One process stops accepting connections creating a queue in the kernel. The new process takes over and starts accepting connections.

You can follow the trail by searching for ngx_exec_new_binary in the nginx repo.

Re:Upgrading Executable on the Fly by krab on Tuesday January 04, 2022 @04:22PM (#29800719)
Just to add - Nginx normally spawns several worker processes that all process connections to the same port.
Re:Upgrading Executable on the Fly by nullify88 on Tuesday January 04, 2022 @04:55PM (#29801118)
Correct but to clarify, only the master process binds to the ports. The master process creates socketpairs to the workers for interprocess communication. The workers accept connections over the shared socket.

https://www.nginx.com/blog/socket-sharding-nginx-release-1-9...

Page also has an example of how SO_REUSEPORT effects flow.

Re:Upgrading Executable on the Fly by krab on Wednesday January 05, 2022 @02:46AM (#29806268)
Oh, thanks! I didn't know that. I supposed it worked by inheriting the listening socket but I didn't check.