Andres Freund <and...@anarazel.de> writes: > On 2023-02-01 16:21:16 +1300, Thomas Munro wrote: >> It's always in proc_exit() in StartupProcShutdownHandler(), a SIGTERM >> handler which is allowed to call that while in_restore_command is >> true.
> Ugh, no wonder we're getting crashes. This whole business seems bogus as > hell. Indeed :-( > I don't see a choice but to revert the recent changes. They need a > fairly large rewrite. 9a740f81e clearly made things a lot worse, but it wasn't great before. Can we see a way forward to removing the problem entirely? The fundamental issue is that we have no good way to break out of system(), and I think the original idea was that in_restore_command would be set *only* for the duration of the system() call. That's clearly been lost sight of completely, but maybe as a stopgap we could try to get back to that. regards, tom lane