[LEDE-DEV] ubus/libubox: SIGTERM/SIGINT signals received during ubus_complete_request() calls are ignored
Alin Năstac
alin.nastac at gmail.com
Fri Feb 3 00:29:33 PST 2017
Hi Felix,
SIGTERM & SIGINT signals received during ubus_complete_request()
waiting for ubus_poll_data() to return are ignored due to
uloop_cancelled being restored to its previous value it had before
uloop_poll_data() was called.
The reproduction scenario is this:
1) cancelled local variable is set to false, current value of uloop_cancelled
2) while ubus_poll_data() is waiting for a read event, a SIGTERM is
received, so uloop_cancelled is set to true
3) after ubus_poll_data() returns, uloop_cancelled value gets
overwritten with false and SIGTERM signal ends up being ignored in the
uloop_run()
The whole uloop_cancelled related logic in the ubus_complete_request()
seems to be focused on getting out from the current recursion of
uloop_run(), but from what I see uloop_run() capability to be called
recursively is no longer used in ubus, so I wonder if it is still
necessary.
If the answer is no, the entire logic referring to uloop_cancelled and
uloop_end() should be removed from libubus-req.c. Otherwise an
additional uloop_cancelled_recursions bit mask would be needed that
will allow to control uloop_run() exit condition for each individual
recursion.
Please share your pov so I could prepare the necessary patches.
Thanks,
Alin
More information about the Lede-dev
mailing list