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

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

Harald Welte has posted comments on this change. ( )

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

Patch Set 1: Code-Review-2

(1 comment)
File stp/stp_main.c:
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
To unsubscribe, or for help writing mail filters, visit

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>
Gerrit-Reviewer: Harald Welte <laforge at>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Vadim Yanitskiy <axilirator at>
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: <>

More information about the gerrit-log mailing list