After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 725492 - Daemons started from dispatcher scripts get killed after 10 seconds
Daemons started from dispatcher scripts get killed after 10 seconds
Status: RESOLVED FIXED
Product: NetworkManager
Classification: Platform
Component: general
0.9.x
Other Linux
: Normal normal
: ---
Assigned To: NetworkManager maintainer(s)
NetworkManager maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2014-03-02 09:31 UTC by Tore Anderson
Modified: 2014-04-18 15:46 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Example dispatcher script that tries to start/stop named as connections go up/down (530 bytes, application/octet-stream)
2014-03-02 09:31 UTC, Tore Anderson
Details

Description Tore Anderson 2014-03-02 09:31:08 UTC
Created attachment 270687 [details]
Example dispatcher script that tries to start/stop named as connections go up/down

If I start a daemon from a dispatcher script, it gets killed after 10 seconds no matter what. I've seen this happen with several different daemons, like pppd, named, and tayga. Indeed I haven't seen any daemon surviving for long after beings started from a dispatcher script.

I'm attaching an example dispatcher script that simply start up named. With it installed, the following is logged when activating an connection:

Mar  2 10:21:04 sloth nm-dispatcher.action: (named dispatcher script) starting named...
Mar  2 10:21:04 sloth named[7147]: starting BIND 9.9.4-P2-RedHat-9.9.4-11.P2.fc20 -u named
[...snip many messages from named...]
Mar  2 10:21:04 sloth named[7147]: running
Mar  2 10:21:04 sloth nm-dispatcher.action: (named dispatcher script) ...success!
Mar  2 10:21:04 sloth nm-dispatcher.action: (named dispatcher script) reached end of script, exiting.
Mar  2 10:21:14 sloth named[7147]: shutting down

The messages above show that the named process did indeed daemonise and let the dispatcher script continue until it exited, so the problem can't be that NM is killing the dispatcher script for hanging around and not exiting.

NM version: NetworkManager-0.9.9.0-30.git20131003.fc20.x86_64
Comment 1 Thomas Haller 2014-03-02 13:47:24 UTC
after 10 seconds being idle, /usr/libexec/nm-dispatcher.action quits. It will be restarted by systemd when needed again.

I think, when the process ends, systemd also kills off all children.

You could probably change this by setting KillMode=process /usr/lib/systemd/system/NetworkManager-dispatcher.service . See http://www.freedesktop.org/software/systemd/man/systemd.kill.html

It might be even better to configure named as its own systemd service so that it runs independently from the dispatcher service.
Comment 2 Tore Anderson 2014-03-02 14:46:11 UTC
Indeed, setting KillMode=process does work. Consider this a wishlist for changing the default accordingly? Being able to start connection-specific processes from dispatcher scripts is a valid use-case, I think, and writing out a systemd service file and starting it in that way is pointless complexity (not to mention the fact that it won't work on distros not using systemd).

named was just a zero-configuration-needed example that was easy to reproduce, really, the real use-cases I've had for this is starting TAYGA (for 464xlat) and pppd (to establish a secondary data bearer whenever NM takes up the primary).

Tore
Comment 3 Thomas Haller 2014-03-02 18:59:42 UTC
Yes, adding KillMode=process is probably the right thing to do.
Comment 4 Dan Winship 2014-04-18 15:46:06 UTC
fixed in git master