[OpenWrt-Devel] procd limits usage

Karl Palsson karlp at tweak.net.au
Tue Jan 6 11:19:38 EST 2015


Hi,

I'm trying out using procd to kill/restart processes that use too much
memory, using the "limits" feature added in
https://lists.openwrt.org/pipermail/openwrt-devel/2013-December/022793.html
and I've confirmed that it's available in the BB branch procd that I'm
testing against.

My init script looks like so...

# cat /etc/init.d/hogger 
#!/bin/sh /etc/rc.common
START=85
USE_PROCD=1
PROCD_DEBUG=1
APP=hogger


start_service() {
    procd_open_instance
    procd_set_param command $APP
    procd_append_param limits data=4000
    procd_set_param respawn
    procd_close_instance
}

Starting this service gives a nice debug output from procd, such as:

# /etc/init.d/hogger start
{ "name": "hogger", "script": "\/etc\/init.d\/hogger", "instances": { "instance1": { "command": [ "hogger" ], "limits": { "data": "4000" }, "respawn": [ ] } } }


The "hogger" application just uses malloc/free to raise/lower it's
memory usage, and /proc/$PID/status shows that the VmData field
increases, eg...



VmPeak:	    4492 kB
VmSize:	    4488 kB
VmRSS:	    1144 kB
VmData:	    1812 kB
....
VmPeak:	    6536 kB
VmSize:	    6536 kB
VmRSS:	    3216 kB
VmData:	    3860 kB
....
VmPeak:	   10632 kB
VmSize:	   10632 kB
VmRSS:	    7308 kB
VmData:	    7956 kB

But procd does nothing that I can see, no logging, no restarting.  Is
this the correct usage? Is there some other way these procd limits are
meant to be used?  The only reference to a procd init script using this
feature is
https://github.com/zqlee/smartproxy/blob/master/files/smartproxy.init

Sincerely,
Karl P
-------------- next part --------------
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


More information about the openwrt-devel mailing list