[PATCH] Log message before aborting

Ondrej Zajicek santiago at crfreenet.org
Wed Jan 11 17:36:09 CET 2023


On Mon, Jan 09, 2023 at 07:35:57PM -0800, Mike Crute via Bird-users wrote:
> Signed-off-by: Mike Crute <mike at crute.us>
> ---
> 
> This is a really tiny patch but the behavior of aborting was very
> confusing to one of the Alpine Linux users and caused them to spend a
> lot of time creating and installing debug builds and tracing the BIRD
> process only to find a configuration error. Hopefully this patch will
> help to prevent such issues for future users while still providing
> proper debug info for developers.

Hi

Unfortunately it is more complicated:

1) vlog() (which is internally caled from bug()) is not safe to call from
a signal handler, as it internally takes a mutex, if the signal is received
when the interrupted thread is already in mutex, it will deadlock.

2) This alarm is here to ensure that BIRD does not hang, if there is some
issue withing logging (e.g. deadlock or long-term blocking on write), we
could hang on the logging, circumventing the watchdog.

3) bug() has slightly different meaning, so it is not really matching
here, but that is easily fixed by using log() and abort() separately.

These issues could be fixed, but more intricate approach has to be used.

-- 
Elen sila lumenn' omentielvo

Ondrej 'Santiago' Zajicek (email: santiago at crfreenet.org)
OpenPGP encrypted e-mails preferred (KeyID 0x11DEADC3, wwwkeys.pgp.net)
"To err is human -- to blame it on a computer is even more so."


More information about the Bird-users mailing list