You are not logged in.

#1 2013-10-30 06:37:56

orschiro
Member
Registered: 2009-06-04
Posts: 2,136
Website

[solved] Network Manager dispatcher script ends up with zombie process

Take this simple dispatcher script:

#!/bin/bash

INTERFACE=$1 # The interface which is brought up or down
STATUS=$2 # The new state of the interface

case "$STATUS" in
    up) # $INTERFACE is up        
            su -c "DISPLAY=:0 dropboxd &" orschiro
        ;;
    down) # $INTERFACE is down
        ;;
esac

All it does is to start dropbox daemon after a successful connection. The result is, however, that the dropbox tray icon appears for ~3 seconds before it disappears again.

A zombie process remains:

~ $ ps aux | grep dropbox
orschiro   779  0.0  0.0      0     0 tty1     Z    Okt29   0:23 [dropbox] <defunct>

Any idea why this is happening?

Last edited by orschiro (2013-11-04 11:44:55)

Offline

#2 2013-10-30 10:59:17

aesiris
Member
Registered: 2012-02-25
Posts: 97

Re: [solved] Network Manager dispatcher script ends up with zombie process

Why don't you use systemd to keep track of the daemon, instead of (failing to properly) orphan it?

systemctl start dropbox@orschiro.service

Offline

#3 2013-10-30 12:27:06

orschiro
Member
Registered: 2009-06-04
Posts: 2,136
Website

Re: [solved] Network Manager dispatcher script ends up with zombie process

I used to use the systemd dispatcher but sometimes encounter that the tray icon is not showing up correctly. Thus I wanted to test it with the (old) method and see if the problem remains the same.

Offline

#4 2013-10-31 21:21:54

Strike0
Member
From: Germany
Registered: 2011-09-05
Posts: 1,489

Re: [solved] Network Manager dispatcher script ends up with zombie process

It happens because NM-dispatcher is for short-lived scripts and there is a 3 sec timeout, which you have witnessed in your first post.  https://bugzilla.redhat.com/show_bug.cgi?id=982734

Offline

#5 2013-10-31 22:42:42

orschiro
Member
Registered: 2009-06-04
Posts: 2,136
Website

Re: [solved] Network Manager dispatcher script ends up with zombie process

@Strike0

Thanks for the report! I was never aware of that 3 seconds rule.

Is there any way for me to measure how long it takes to launch ` su -c "DISPLAY=:0 dropboxd &" orschiro`?

Then I can be certainly sure and seek for ways how to improve the script run time.

Offline

#6 2013-11-01 12:57:16

Strike0
Member
From: Germany
Registered: 2011-09-05
Posts: 1,489

Re: [solved] Network Manager dispatcher script ends up with zombie process

Maybe prepend "time" to the script command. But the problem may not be the script, but the dispatcher which gets 'cleaned' up after 3 secs leaving you the zombie. I had a similar problem and read somewhere that modding the dispatcher service by adding "RemainAFterExit=" might help, but still have to try that.

Offline

#7 2013-11-01 14:14:37

orschiro
Member
Registered: 2009-06-04
Posts: 2,136
Website

Re: [solved] Network Manager dispatcher script ends up with zombie process

Nice one!

I added `RemainAfterExit=Yes` to `/etc/systemd/system/dbus-org.freedesktop.nm-dispatcher.service` and so far my dispatcher script has not been killed!

I will test it a bit though before being too optimistic about it.

~ $ cat /etc/systemd/system/dbus-org.freedesktop.nm-dispatcher.service 
[Unit]
Description=Network Manager Script Dispatcher Service

[Service]
Type=dbus
BusName=org.freedesktop.nm_dispatcher
ExecStart=/usr/lib/networkmanager/nm-dispatcher.action
RemainAfterExit=yes

[Install]
Alias=dbus-org.freedesktop.nm-dispatcher.service

Offline

#8 2013-11-04 11:44:44

orschiro
Member
Registered: 2009-06-04
Posts: 2,136
Website

Re: [solved] Network Manager dispatcher script ends up with zombie process

After having tested it more deeply, I can confirm that it is proven workaround.

I created a respective Wiki section for it: https://wiki.archlinux.org/index.php/Ne … ds_timeout

Offline

Board footer

Powered by FluxBB