[Solved] Duplicate processes and reboots

Post new topic   Reply to topic    DD-WRT Forum Index -> Atheros WiSOC based Hardware
Author Message
JZharay
DD-WRT Novice


Joined: 22 May 2018
Posts: 3

PostPosted: Wed May 23, 2018 0:25    Post subject: [Solved] Duplicate processes and reboots Reply with quote
Hey guys, I've been diving into customizing my router and I'm blown away with what the thing is capable of, but I'm starting to run into issues in terms of stability.

Firstly what I've got:
  • Router Model: Netgear WNDR3700 V4 (128mb ram)
  • Firmware Version: DD-WRT v3.0-r35831 std (04/26/18)

And the things I am running:
  • Transmission
  • lighttpd
  • Privoxy
  • MiniDLNA
  • Samba

All this is done with a USB hard drive formatted with EXT2/3 for /jffs and /opt, NTFS for shared data, and a linux-swap partition for swap. The NTFS partition is mounted via script to a fixed point for use in most of the services above.

Note: I do not know if swap is even being used.

Now it works but I don't know if I can get it to do so for longer than a week. Today alone the router has rebooted 3 times and I'm not unix savvy enough to figure out exactly why.

Here's what ps spits out:

Code:
  PID USER       VSZ STAT COMMAND
    1 root      1152 S    /sbin/init
    2 root         0 SW   [kthreadd]
    3 root         0 SW   [ksoftirqd/0]
    5 root         0 SW<  [kworker/0:0H]
    6 root         0 SW   [kworker/u2:0]
    7 root         0 SW<  [khelper]
    8 root         0 SW<  [writeback]
    9 root         0 SW   [kworker/u2:1]
   72 root         0 SW<  [crypto]
   75 root         0 SW<  [bioset]
   77 root         0 SW<  [kblockd]
   79 root         0 SW   [kswapd0]
   80 root         0 SW   [kworker/0:1]
  112 root         0 SW   [fsnotify_mark]
  256 root         0 SW<  [deferwq]
  463 root       928 S    /sbin/hotplug2 --set-rules-file /etc/hotplug2.rules
  498 root      1828 S    watchdog
  562 root         0 SW<  [cfg80211]
  627 root         0 SW   [kworker/0:2]
  650 root         0 SW   [scsi_eh_0]
  651 root         0 SW<  [scsi_tmf_0]
  652 root         0 SW   [usb-storage]
  687 root         0 SW<  [kworker/0:1H]
  884 root      4072 S    transmissiond --config-dir /jffs/transmission
  887 root         0 SW   [jbd2/sda3-8]
  888 root         0 SW<  [ext4-rsv-conver]
  894 root      4848 S    minidlna -f /tmp/minidlna.conf
  924 root      5852 S    transmissiond --config-dir /jffs/transmission
  936 root      5108 S    lighttpd -f /tmp/lighttpd.conf
  937 root      156m S    /usr/bin/php-cgi
  939 root         0 SW   [jbd2/sda2-8]
  940 root         0 SW<  [ext4-rsv-conver]
  943 root      1932 S    hostapd -B -P /var/run/ath0_hostapd.pid /tmp/ath0_ho
  977 root      1932 S    hostapd -B -P /var/run/ath1_hostapd.pid /tmp/ath1_ho
 1055 root      1904 S    privoxy /tmp/privoxy.conf
 1110 root      1672 S    ntfs-3g -o compression,direct_io,big_writes /dev/sda
 1181 root      4788 S    httpd -p 80
 1183 root      1524 S    resetbutton
 1240 root      6768 S    transmissiond --config-dir /jffs/transmission
 1305 root      6804 S    transmissiond --config-dir /jffs/transmission
 1310 root     26168 RN   minidlna -f /tmp/minidlna.conf
 1322 root     26184 RN   minidlna -f /tmp/minidlna.conf
 1445 root      1508 S    upnp -D -W vlan2
 1449 root      1784 S    wland
 1450 root      1164 S    udhcpc -i vlan2 -p /var/run/udhcpc.pid -s /tmp/udhcp
 1483 root       896 S    cron
 1484 root      1828 S    process_monitor
 1571 root      156m S    /usr/bin/php-cgi
 1572 root      156m S    /usr/bin/php-cgi
 1824 root      1164 S    telnetd
 1844 root      1004 S    dropbear -b /tmp/loginprompt -r /tmp/root/.ssh/ssh_h
 1863 root      1172 S    dnsmasq -u root -g root --conf-file=/tmp/dnsmasq.con
 1924 root      1164 S    syslogd -L
 1933 root      1072 S    dropbear -b /tmp/loginprompt -r /tmp/root/.ssh/ssh_h
 1936 root      1172 S    -sh
 2026 root         0 SW   [kworker/u2:2]
 2086 root      1168 R    ps


And here's top:
Code:
CPU:  8.3% usr  0.0% sys 91.6% nic  0.0% idle  0.0% io  0.0% irq  0.0% sirq
Load average: 2.67 2.74 2.52 5/70 3712
  PID  PPID USER     STAT   VSZ %VSZ CPU %CPU COMMAND
 1310     1 root     RN   34548 27.4   0 49.9 minidlna -f /tmp/minidlna.conf
 1322     1 root     RN   34164 27.1   0 41.6 minidlna -f /tmp/minidlna.conf
  943     1 root     S     1932  1.5   0  8.3 hostapd -B -P /var/run/ath0_hostap
  937   936 root     S     156m126.7   0  0.0 /usr/bin/php-cgi
 1571   937 root     S     156m126.7   0  0.0 /usr/bin/php-cgi
 1572   937 root     S     156m126.7   0  0.0 /usr/bin/php-cgi
 1305     1 root     S     6804  5.4   0  0.0 transmissiond --config-dir /jffs/t
 1240     1 root     S     6768  5.3   0  0.0 transmissiond --config-dir /jffs/t
  924     1 root     S     5860  4.6   0  0.0 transmissiond --config-dir /jffs/t
  936     1 root     S     5108  4.0   0  0.0 lighttpd -f /tmp/lighttpd.conf
  894     1 root     S     4848  3.8   0  0.0 minidlna -f /tmp/minidlna.conf
 1181     1 root     S     4788  3.8   0  0.0 httpd -p 80
  884     1 root     S     4072  3.2   0  0.0 transmissiond --config-dir /jffs/t
 1055     1 root     S     2104  1.6   0  0.0 privoxy /tmp/privoxy.conf
  977     1 root     S     1932  1.5   0  0.0 hostapd -B -P /var/run/ath1_hostap
  498     1 root     S     1828  1.4   0  0.0 watchdog
 1484     1 root     S     1828  1.4   0  0.0 process_monitor
 1110     1 root     S     1784  1.4   0  0.0 ntfs-3g -o compression,direct_io,b
 1449     1 root     S     1784  1.4   0  0.0 wland
^C183     1 root     S     1524  1.2   0  0.0 resetbutton



I'm not sure if this is normal and I've found nothing about it, but is it normal for there to be so many instances of transmission, minidlna, and so on? Perhaps this is why I'm getting these reboots? For now I'm disabling minidlna until I figure out how to make it stable.


Last edited by JZharay on Wed May 23, 2018 21:25; edited 2 times in total
Sponsor
JZharay
DD-WRT Novice


Joined: 22 May 2018
Posts: 3

PostPosted: Wed May 23, 2018 8:42    Post subject: Reply with quote
I think MiniDLNA was the culprit. For whatever reason, having multiple paths for it to include created an equal number of instances of the process. So my router's CPU was splitting its time to them. Putting them all in one directory fixed the wild CPU usage.

That still doesn't account for the four transmission instances which shows up in syslog with three of them trying to set their ports but returning errors instead:

Code:
May 23 08:37:50 Netgear daemon.err transmission-daemon[1353]: RPC Server Unable to bind to 0.0.0.0:9091 after 10 attempts, giving up (rpc-server.c:773)
May 23 08:37:51 Netgear daemon.err transmission-daemon[1349]: RPC Server Unable to bind to 0.0.0.0:9091 after 10 attempts, giving up (rpc-server.c:773)
May 23 08:37:52 Netgear daemon.err transmission-daemon[1371]: RPC Server Unable to bind to 0.0.0.0:9091 after 10 attempts, giving up (rpc-server.c:773)
JZharay
DD-WRT Novice


Joined: 22 May 2018
Posts: 3

PostPosted: Wed May 23, 2018 21:22    Post subject: Reply with quote
Alright, solved it through scripts.

The problem wasn't so much the service, but my numerous partitions. My old startup script for the USB was mounting one of my drives to a fixed directory, making sure transmission's config files were my own and not the dd-wrt's default, and then restarting the process with "killall -HUP transmissiond". Problem was a time-case issue. It'd mount the drive four times at the same time (the initial mount, /jffs, /otp, /data), running the script each time and thus making a bash check impossible.

For those getting into this and wanting how I did it, here are my scripts:

USB Mount Script (change UUID to your drive partition's):
Code:
#!/bin/bash

if mount | grep -q "/tmp/mnt/data"; then
   echo Nothing to mount.
else
   mkdir /tmp/mnt/data
   mount $(findfs UUID=01D3E16BDAD94A20) /tmp/mnt/data
fi

Startup Script:
Code:
#!/bin/bash

waitcount=0

until mount | grep -q "/tmp/mnt/data"; do
   if [ "$waitcount" -eq 3 ]; then
      echo "Drive not found?"
      exit 1
   fi
   echo Waiting 10 seconds for mount...
   sleep 10
   waitcount=$((waitcount+1))
done

if ps | grep -v grep | grep -q "transmission"; then
   echo Transmission already started!
else
   echo Starting Transmission
   rm /jffs/transmission/settings*
   cp /jffs/transmission.settings.json /jffs/transmission/settings.json
   transmissiond --config-dir /jffs/transmission
fi

if ps | grep -v grep | grep -q "minidlna"; then
   echo MiniDLNA already started!
else
   echo Starting MiniDLNA
   minidlna -f /jffs/minidlna/minidlna.conf
fi

Extra: Restarting/Rebuilding MiniDLNA and Transmission
Code:
#!/bin/bash   

if mount | grep -q "/tmp/mnt/data"; then
   echo Rebuilding MiniDLNA
   killall minidlna
   rm /jffs/minidlna/files.db
   minidlna -R -f /jffs/minidlna/minidlna.conf
else
   echo HDD not mounted!
fi

if mount | grep -q "/tmp/mnt/data"; then
   echo Restarting Transmission
   killall transmissiond
   rm /jffs/transmission/settings*
   cp /jffs/transmission.settings.json /jffs/transmission/settings.json
   transmissiond --config-dir /jffs/transmission
else
   echo HDD not mounted!
fi

Not bad for an hour crash-course in bash.
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum Index -> Atheros WiSOC based Hardware All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum