[PATCH] Ensured SIGQUIT deletes listening UNIX socket files.

Maxim Dounin mdounin at mdounin.ru
Sun Apr 26 01:12:40 UTC 2020


Hello!

On Thu, Apr 16, 2020 at 04:51:04PM -0700, Thibault Charbonnier wrote:

> On 3/3/20 6:28 AM, Maxim Dounin wrote:
> > Checking for the oldpid file does not look like a reliable 
> > approach to me.  
> 
> Hi Maxim,
> 
> For this patch to cover TEST 3 in my previously attached test suite
> (cancel binary upgrade via SIGQUIT on the new binary), we need a way for
> a new binary to know whether an old binary is still running or not.

Sure.  The problem is that checking this via a filesystem which 
can be arbitrary modified by external means is not reliable.  
Further, if the pid file was changed in the configuration along 
with binary upgrade, there will be no oldpid file available from 
the very start of the new binary.

> Do you have another suggestion on how to achieve this? Checking for the
> existence of nginx.oldpid seems acceptable to me in this case.

A better approach might be to check parent's pid instead, much 
like we do when handling the changebin signal on unix (see 
src/os/unix/ngx_process.c).

-- 
Maxim Dounin
http://mdounin.ru/


More information about the nginx-devel mailing list