Hi, On 2023-02-03 20:34:36 +1300, Thomas Munro wrote: > What if we block signals, fork, then in the child, install the default > SIGTERM handler, then unblock, and then exec the shell?
Yep. I was momentarily wondering why we'd even need to unblock signals, but while exec (et al) reset the signal handler, they don't reset the mask... We could, for good measure, do PGSharedMemoryDetach() etc. But I don't think it's quite worth it if we're careful with signals. However ClosePostmasterPorts() might be a good idea? I think not doing it might cause issues like keeping the listen sockets alive after we shut down postmaster, preventing us from startup up again? Looks like PR_SET_PDEATHSIG isn't reset across an execve(). But that actually seems good? > If SIGTERM is delivered either before or after exec (but before > whatever is loaded installs a new handler) then the child is > terminated, but without running the handler. Isn't that what we want > here? Yep, I think so. Greetings, Andres Freund