FreeRADIUS/freeradius-server — pull request #823 by spbnick (2014-10-28 15:29:35+00:00)
Title: Ignore SIGTERM when firing stop and signal.term

Move firing "server.stop" and "server.signal.term" triggers beyond
setting SIGTERM action to SIG_IGN in main().

This way handler commands for these triggers don't receive SIGTERM with
the rest of the process group and don't possibly terminate before doing
their work. E.g. snmptrap manages to send the notifications.

This fixes serverStop and signalTerm SNMP notifications not being sent.

This is a somewhat crude fix, as we cannot be sure that the handler programs
don't enable SIGTERM and so could still be killed. A proper fix could be
perhaps to wait until handlers have completed and then send SIGTERM, or to
re-enable SIGTERM after sending it to the process group and then fire the
triggers.

However, the former could potentially delay termination and for the latter
we'll have to somehow know our own SIGTERM was delivered to our process,
before re-enabling it, which I haven't found how to do.