coova / coova-chilli

CoovaChilli is an open-source software access controller for captive portal hotspots.
Other
516 stars 258 forks source link

CoovaChilli High Memory usage on Openwrt Trunk #477

Open jagatjogie opened 5 years ago

jagatjogie commented 5 years ago

When Building Coova Chilli 1.3.0 or later on openwrt trunk or even 18.06/18.06.2. coova chilli eats up 32mb of memory for single instance. Tried all the older version of chilli but problem persist. I Think the issue is related to latest kernel in openwrt 4.14 or higher. Cannot work with chilli on latest openwrt environment.

jagatjogie commented 5 years ago

https://github.com/coova/coova-chilli/issues/85

This issue is still not resolved. Can anyone address

reinerotto commented 5 years ago

Try coova 1.4 . Having coova-chilli 1.4.0 running on openwrt device (ZBT-WE826), using Trunk. About 2MB RAM usage, just as always before.

jagatjogie commented 5 years ago

Tried coova 1.4 also same issue.

The issue is also with prebuild images of openwrt.

Tried Installing prebuild firmwares images of openwrt 18.06.1 or 2 even trunk and later installed coova-chilli via opkg.

minimum memory utilization by single instance is 17mb.

i don't think its any issue with compilation as pre-built package is also having memory leak.

Tried on different router Unifi ac lr or pro and even TP link archer C7

reinerotto commented 5 years ago

Then you have/do something special. See my info from running hotspot, using 3g/4g as WAN: OpenWrt SNAPSHOT, r9933-1325e74e0c From top: 1331 1 root S 2372 2% 0% chilli From ps: 1331 root 2372 S chilli

jagatjogie commented 5 years ago

Installed Pre-build image from openwrt for my router and installed coova from opkg.

Top command with coova running

Mem: 72220K used, 52920K free, 148K shrd, 3872K buff, 10148K cached CPU: 0% usr 1% sys 0% nic 97% idle 0% io 0% irq 0% sirq Load average: 0.13 0.10 0.03 1/52 27721 PID PPID USER STAT VSZ %VSZ %CPU COMMAND 111 2 root SW 0 0% 2% [kworker/0:1] 1756 1 root S 2000 2% 0% /usr/sbin/hostapd -s -P /var/run/wifi-phy1.pid -B /var/run/hostapd-phy1.conf 27659 26489 root R 1200 1% 0% top 1046 1 root S 1716 1% 0% /sbin/netifd 1265 1 root S 1396 1% 0% olsrd -f /etc/olsrd.conf -nofork 1082 1 root S 1204 1% 0% /usr/sbin/crond -f -c /etc/crontabs -l 5 26488 949 root S 1132 1% 0% /usr/sbin/dropbear -F -P /var/run/dropbear.1.pid -p 22 -K 300 -T 3 10356 2 root SW 0 0% 0% [kworker/u2:3] 27168 1 root S 2916 2% 0% /bin/socketfan 1882 1 root S 2000 2% 0% /usr/sbin/hostapd -s -P /var/run/wifi-phy0.pid -B /var/run/hostapd-phy0.conf 1943 1 root S 1932 2% 0% /usr/sbin/wpa_supplicant -B -P /var/run/wpa_supplicant-wlan1.pid -D nl80211 -i wlan1 -c /var/run/wpa_supplicant-wlan1.conf -C 1 0 root S 1540 1% 0% /sbin/procd 27437 1 root S 1352 1% 0% /usr/sbin/chilli -c /etc/chilli.conf --pidfile=/var/run/chilli.pid 806 1 root S 1224 1% 0% /sbin/logd -S 64 1709 1 root S< 1204 1% 0% /usr/sbin/ntpd -n -N -S /usr/sbin/ntpd-hotplug -p 0.openwrt.pool.ntp.org -p 1.openwrt.pool.ntp.org -p 2.asia.pool.ntp.org -p 0 26489 26488 root S 1204 1% 0% -ash 1210 1046 root S 1200 1% 0% udhcpc -p /var/run/udhcpc-eth0.2.pid -s /lib/netifd/dhcp.script -f -t 0 -i eth0.2 -x hostname:TPLINK-TEST -C -O 121 27665 27660 root S 1200 1% 0% /bin/sleep 79 471 1 root S 1192 1% 0% /sbin/ubusd 949 1 root S 1064 1% 0% /usr/sbin/dropbear -F -P /var/run/dropbear.1.pid -p 22 -K 300 -T 3 472 1 root S 900 1% 0% /sbin/askfirst /usr/libexec/login.sh 421 2 root SWN 0 0% 0% [jffs2_gcd_mtd5] 3 2 root SW 0 0% 0% [ksoftirqd/0] 15994 2 root SW 0 0% 0% [kworker/u2:1] 177 2 root SW 0 0% 0% [spi0] 27138 2 root SW 0 0% 0% [kworker/u2:0] 335 2 root SW< 0 0% 0% [ipv6_addrconf] 231 2 root SW< 0 0% 0% [bioset] 342 2 root SW< 0 0% 0% [kworker/0:1H] 220 2 root SW< 0 0% 0% [bioset] 208 2 root SW< 0 0% 0% [bioset] 202 2 root SW< 0 0% 0% [bioset] 214 2 root SW< 0 0% 0% [bioset] 225 2 root SW< 0 0% 0% [bioset] 575 2 root SW< 0 0% 0% [ath10k_aux_wq] 553 2 root SW< 0 0% 0% [cfg80211] 573 2 root SW< 0 0% 0% [ath10k_wq] 10350 2 root SW 0 0% 0% [kworker/0:0]

without running coova Mem: 37464K used, 87676K free, 124K shrd, 3872K buff, 10116K cached CPU: 0% usr 1% sys 0% nic 96% idle 0% io 0% irq 0% sirq Load average: 0.20 0.12 0.04 1/50 28546 PID PPID USER STAT VSZ %VSZ %CPU COMMAND 10350 2 root RW 0 0% 3% [kworker/0:0] 1756 1 root S 2000 2% 0% /usr/sbin/hostapd -s -P /var/run/wifi-phy1.pid -B /var/run/hostapd-phy1.conf 1882 1 root S 2000 2% 0% /usr/sbin/hostapd -s -P /var/run/wifi-phy0.pid -B /var/run/hostapd-phy0.conf 1265 1 root S 1396 1% 0% olsrd -f /etc/olsrd.conf -nofork 28546 26489 root R 1200 1% 0% top 26488 949 root S 1132 1% 0% /usr/sbin/dropbear -F -P /var/run/dropbear.1.pid -p 22 -K 300 -T 3 3 2 root SW 0 0% 0% [ksoftirqd/0] 10356 2 root SW 0 0% 0% [kworker/u2:3] 27168 1 root S 2916 2% 0% /bin/socketfan 1943 1 root S 1932 2% 0% /usr/sbin/wpa_supplicant -B -P /var/run/wpa_supplicant-wlan1.pid -D nl80211 -i wlan1 -c /var/run/wpa_supplicant-wlan1.conf -C 1046 1 root S 1716 1% 0% /sbin/netifd 1 0 root S 1540 1% 0% /sbin/procd 806 1 root S 1224 1% 0% /sbin/logd -S 64 1082 1 root S 1204 1% 0% /usr/sbin/crond -f -c /etc/crontabs -l 5 1709 1 root S< 1204 1% 0% /usr/sbin/ntpd -n -N -S /usr/sbin/ntpd-hotplug -p 0.openwrt.pool.ntp.org -p 1.openwrt.pool.ntp.org -p 2.asia.pool.ntp.org -p 0 26489 26488 root S 1204 1% 0% -ash 1210 1046 root S 1200 1% 0% udhcpc -p /var/run/udhcpc-eth0.2.pid -s /lib/netifd/dhcp.script -f -t 0 -i eth0.2 -x hostname:TPLINK-TEST -C -O 121 471 1 root S 1192 1% 0% /sbin/ubusd 949 1 root S 1064 1% 0% /usr/sbin/dropbear -F -P /var/run/dropbear.1.pid -p 22 -K 300 -T 3 472 1 root S 900 1% 0% /sbin/askfirst /usr/libexec/login.sh 111 2 root SW 0 0% 0% [kworker/0:1] 421 2 root SWN 0 0% 0% [jffs2_gcd_mtd5] 15994 2 root SW 0 0% 0% [kworker/u2:1] 177 2 root SW 0 0% 0% [spi0] 27138 2 root SW 0 0% 0% [kworker/u2:0] 335 2 root SW< 0 0% 0% [ipv6_addrconf] 231 2 root SW< 0 0% 0% [bioset] 342 2 root SW< 0 0% 0% [kworker/0:1H] 220 2 root SW< 0 0% 0% [bioset] 208 2 root SW< 0 0% 0% [bioset] 202 2 root SW< 0 0% 0% [bioset] 214 2 root SW< 0 0% 0% [bioset] 225 2 root SW< 0 0% 0% [bioset] 118 2 root SW 0 0% 0% [kswapd0] 84 2 root SW< 0 0% 0% [kblockd] 82 2 root SW< 0 0% 0% [bioset] 78 2 root SW< 0 0% 0% [writeback] 575 2 root SW< 0 0% 0% [ath10k_aux_wq] 553 2 root SW< 0 0% 0% [cfg80211] 573 2 root SW< 0 0% 0% [ath10k_wq]

reinerotto commented 5 years ago

27437 1 root S 1352 1% 0% /usr/sbin/chilli -c /etc/chilli.conf --pidfile=/var/run/chilli.pid

Where is the problem ? chilli not, at least. However, wondering about the PID, so high .... I suspect, other processes crashed (OOM ?) , and chilli was victim, to be re-started. However, I do not have devices with 2 WLANs; and always IPV6 disabled.

nachalni commented 3 years ago

@jagatjogie Try to add:

 ifr.ifr_flags &= ~(IFF_MULTI_QUEUE); 

in: https://github.com/coova/coova-chilli/blob/06a8f1b6c1be2648d05509700f1e0f85b2088e61/src/tun.c#L579

Memory usage comes from new tun kernel driver, it allocates 256 queues by default even on single core/single queue devices