(2014/08/27 4:17), Lennart Poettering wrote:
On Mon, 25.08.14 12:32, HATAYAMA Daisuke (d.hatay...@jp.fujitsu.com) wrote:
Hello,
Heya!
When trapping SIGTERM in a script and running systemctl from the
script, systemctl sometimes hangs with tty-ask-password agent process.
Hmm, so in general, if people invoke our tools with weird signal masks
I'd blame it on them, we shouldn't have to reset the signal masks in all
our tools all the time... I mean, of course, if SIGTERM then doesn't
work on the process, we can just blame the process that invoked us...
However in this case, where we fork off the agent process on our own,
and rely on sending SIGTERM to it, and actually work I think it's our
duty to fix things up, so that we don't leave processes around...
I have no idea whether systemd developpers think this is a bug or
not. If this is a bug, I have three ideas to fix this. This patch is
based on the 1).
1) Reset a signal handler for SIGTERM to the default before spawning
an agent process from systemctl.
Sounds like the right option here... I have now added a slightly
different patch (1dedb74a2e1d840b531b76b01a76979f3b57456b) that does
this.
Thanks! But this could still hang in very rare case becuase the reset is
done in a child process after fork(). Please consider the case where the
child process continue sleeping after fork() before resetting signal
handlers until it receives SIGTERM. For such reason, my patch resets
SIGTERM signal handler in the parent systemctl side.
--
Thanks.
HATAYAMA, Daisuke
_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel