Would it be reasonable for fatal_exit() to dump core?

David Pfitzner dpfitzner at netflix.com
Tue Oct 15 03:33:49 UTC 2024


Recently, I have had cases where unbound (v1.20.0) occasionally exits with
a log message like:

  fatal error: event_dispatch returned error -1, errno is Bad file
descriptor

If that is a known issue I would be interested to hear, but that is not
actually my main point, which is: In this case it is not clear (at least to
me) what the detailed cause of the fatal error was, and so I think it would
be useful if unbound would generate a core file in cases like this, as that
might help to understand the problem. That is, for the fatal_exit()
function (which generates the above message) to call abort() rather than
exit(1). So my question is, would it be reasonable to modify fatal_exit()
to do that?

I could imagine possibly not, because fatal_exit() may be called in a lot
of cases, including, for example, bad configuration, and in many of those
cases the cause of the error may be immediately obvious, so a core file
could be considered superfluous.

Or, would such a feature be more palatable if it was enabled by some sort
of global config option or command-line parameter etc?

Alternatively, one could change just the code (in comm_base_dispatch())
which calls fatal_exit() with the above message, so that it dumps core
instead of calling fatal_exit(). But then I would worry that other calls to
fatal_exit() may have a similar problem in future.

Or, maybe there should be two functions, eg fatal_exit() and fatal_abort(),
and cases where the cause could be unclear could use the latter one.

Any thoughts?

I have applied a local change to make fatal_exit() dump core for me, but
was wondering whether something like that could be applied upstream.

Regards,
David Pfitzner
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nlnetlabs.nl/pipermail/unbound-users/attachments/20241015/13755b3a/attachment.htm>


More information about the Unbound-users mailing list