Opened 2 years ago

Last modified 2 years ago

#4743 new

Zombie [sh] processes caused by Inadyn (workaround in comments)

Reported by: Specimen Owned by:
Keywords: inadyn zombie dnsomatic Cc: Specimen

Description

Router: ASUS RT-N10+ (B1) (Ralink) build: r27506

One of the cron jobs I have is this:

*/10 * * * * root wget -T 30 -qO - http://www.unotelly.com/unodns/auto_auth/hash_update/updateip.php?user_hash=(myhashgoeshere)

This is taken from: http://help.unotelly.com/support/solutions/articles/18635-dd-wrt-using-cronjob-to-update-your-ip

I often get zombie process in ps:

 1499 root         0 Z    [sh]

Because I also have DDNS running, by looking at DDNS log I've noticed that every time external IP changes I get a zombie process, this can be 10-20 zombie processes in just one night (the ISP seems to have a timeout and the IP tends to change a lot when there are no computers running on the network).

I don't know if this is related but cron seems to be running as an orphan for some reason:

Jan  1 00:01:43 petinga user.info syslog: cron : cron daemon successfully started
Jan  1 00:01:43 petinga cron.info cron[1252]: (CRON) STARTUP (fork ok)
Jan  1 00:01:43 petinga cron.info cron[1252]: (crontabs) ORPHAN (no passwd entry)

So, it's either cron + wget (or inadyn?) that is causing these zombie processes, you can see I already added a timeout to wget but that doesn't seem to make a difference.

Change History (7)

comment:1 Changed 2 years ago by Specimen

Cc: Specimen added

PS: cron + wget implies cron > sh > wget, the actual process cron creates is "sh -c wget ...". And it seems that sh is left waiting to be terminated.

comment:2 Changed 2 years ago by Specimen

Strangely enough, it might be in fact inadyn that is causing the zombie processes. As I've disabled the wget cron job and still got a zombie process upon IP update.

comment:3 Changed 2 years ago by Specimen

Summary: Zombie [sh] processesZombie [sh] processes caused by Inadyn

I'm using DNSOMATIC in Inadyn with these settings: http://www.dnsomatic.com/wiki/dd-wrt

Maybe related to this old ticket? http://svn.dd-wrt.com/ticket/1294

Killing inadyn removes the zombies, so this proves inadyn is responsible for them.

Inadyn version, on this router, is 1.96, looking at inadyn changelog that's 10 years old, maybe it hasn't been updated because of SSL and the flash size available, but 1.97 seems to correct a lot of bugs,

Last edited 2 years ago by Specimen (previous) (diff)

comment:4 Changed 2 years ago by tatsuya46

i seen something similar to this mentioned years ago but was never fixed, some users brought up updating inadyn but brainslayer refused due to flash space reasons, but i think several routers would manage to fit a newer inadyn..mine are all on 1.96 too, & sometimes it has random hangs where it would have a long delay before detecting an ip change

comment:5 in reply to:  4 Changed 2 years ago by Specimen

Replying to tatsuya46:

i seen something similar to this mentioned years ago but was never fixed, some users brought up updating inadyn but brainslayer refused due to flash space reasons, but i think several routers would manage to fit a newer inadyn..mine are all on 1.96 too, & sometimes it has random hangs where it would have a long delay before detecting an ip change

Those issues and the zombies issues, most users might not detect, as it requires login in to the console, looking at logs and ps, but they might feel their router is running honky after a while and reboot it, which solves all these issues because the processes are restarted, so they are likely more widespread.

I see a likelihood of this bug never being fixed, so, in the mean time I could probably completely replace inadyn with a simple script and cron, but because I'm lazy I'll leave my workaround here, which is just a cron job that kills inadyn (hence all zombies and hangs), and starts it again, and does so once a day.

0 10 * * * root /usr/bin/killall inadyn ; sleep 2 ; /usr/sbin/inadyn -u <username> -p < password> --input_file /tmp/ddns/inadyn.conf

The inadyn command is copied straight from ps.

Last edited 2 years ago by Specimen (previous) (diff)

comment:6 Changed 2 years ago by Specimen

I just went ahead and got rid of inadyn completely via a simple script which is run every 10 minutes via cron.

#!/bin/sh

MYIP=$(wget -qT 20 -O - "http://myip.dnsomatic.com")
LOGFILE="/tmp/myddns.log"

test -f $LOGFILE || touch $LOGFILE

GETLOGIP=$(cat $LOGFILE)

if [ -n "$MYIP" -a "$GETLOGIP" != "$MYIP" ]; then
    if wget -qT 20 [INSERT WGET SYNTAX RELEVANT TO YOUR DDNS SERVICE HERE] > /dev/null 2>&1 ; then
        echo $MYIP > $LOGFILE
        logger myddns.sh: IP updated to $MYIP
    fi
fi

You can easily find on the internet the relevant wget or curl syntaxes for your DDNS service. If you can install curl you can also have SSL support.

Here are some examples of wget for different services: http://www.techrapid.co.uk/linux/updating-dynamic-dns-ddns-with-wget-on-linux/

I used dnsomatic for the external IP check, but you can use any other IP check service, you can see by the code that it doesn't matter what the site spurts out besides the IP, the code just compares if the reply it get is different from the last logged one.

You can add multiple services if that's your thing too, and not be limited just to one as you are with the WebGUI.

Sayonara to Inadyn

Last edited 2 years ago by Specimen (previous) (diff)

comment:7 Changed 2 years ago by Specimen

Keywords: inadyn zombie dnsomatic added
Summary: Zombie [sh] processes caused by InadynZombie [sh] processes caused by Inadyn (workaround in comments)
Note: See TracTickets for help on using tickets.