Re: Async-unsafe functions in signal handlers - Mailing list pgsql-hackers

From Denis Smirnov
Subject Re: Async-unsafe functions in signal handlers
Date
Msg-id 214224BE-DF50-4BA0-9170-36DF813F2BEA@arenadata.io
Whole thread Raw
In response to Re: Async-unsafe functions in signal handlers  (Andres Freund <andres@anarazel.de>)
Responses Re: Async-unsafe functions in signal handlers  (Denis Smirnov <sd@arenadata.io>)
List pgsql-hackers
> 28 авг. 2021 г., в 07:05, Andres Freund <andres@anarazel.de> написал(а):
>
> However, we have a
> bandaid that deals with possible hangs, by SIGKILLing when processes don't
> shut down (at that point things have already gone quite south, so that's not
> an issue).

Thanks for the explanation. I can see that child process SIGKILL machinery was introduced by
82233ce7ea42d6ba519aaec63008aff49da6c7afcommit to fix a malloc() deadlock in quickdie() signal handler. As a result,
allchild processes that die too long are killed in the ServerLoop() with SIGKILL. But bgworker_die() is a problem as we
initializebgworkers right before ServerLoop(). So we can face malloc() deadlock on postmaster startup (before
ServerLoop()started). Maybe we should simply use write() and exit() instead of ereport() for bgworker_die()? 

Best regards,
Denis Smirnov | Developer
sd@arenadata.io
Arenadata | Godovikova 9-17, Moscow 129085 Russia




pgsql-hackers by date:

Previous
From: Stephen Frost
Date:
Subject: Re: automatic analyze: readahead - add "IO read time" log message
Next
From: Michael Paquier
Date:
Subject: Re: [PATCH] Disable bgworkers during servers start in pg_upgrade