Change in libosmo-sccp[master]: osmo-stp: refactor handling of both SIGINT and SIGTERM

Harald Welte gerrit-no-reply at lists.osmocom.org
Sun May 12 10:15:47 UTC 2019


Harald Welte has posted comments on this change. ( https://gerrit.osmocom.org/13971 )

Change subject: osmo-stp: refactor handling of both SIGINT and SIGTERM
......................................................................


Patch Set 1: Code-Review-2

(1 comment)

https://gerrit.osmocom.org/#/c/13971/1/stp/stp_main.c
File stp/stp_main.c:

https://gerrit.osmocom.org/#/c/13971/1/stp/stp_main.c@221
PS1, Line 221: /* Gracefully shut down SIGTRAN links */
             : 	osmo_signal_dispatch(SS_L_GLOBAL, S_L_GLOBAL_SHUTDOWN, NULL);
             : 	sleep(1); /* FIXME: do we really need to sleep() here? */
actually, that won't work.  All our code is running asynchronously from the select main loop.  So if the signal handlers are starting some activitiy that doesn't immediately timeout (e.g. sending an ASP-DOWN to the peer and waiting for the ACK), your sleep here won't help.

If we want to do graceful shutdown, we should
* receive the signal in the handler
* change some state (such as quit++)
* continue in the main loop
* send the signal from the main loop
* give the code some time (e.g. start a timer)
* shut down on timer expiration

If this fails for some reason, a second signal could be used to do quit++ and then cause a hard exit.



-- 
To view, visit https://gerrit.osmocom.org/13971
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I5d8618857c5119d4acca5d65cf1276ab02889c84
Gerrit-Change-Number: 13971
Gerrit-PatchSet: 1
Gerrit-Owner: Vadim Yanitskiy <axilirator at gmail.com>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Vadim Yanitskiy <axilirator at gmail.com>
Gerrit-Comment-Date: Sun, 12 May 2019 10:15:47 +0000
Gerrit-HasComments: Yes
Gerrit-HasLabels: Yes
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190512/1c94e65d/attachment.html>


More information about the gerrit-log mailing list