3

I am experiencing problems with Upstart.

I am trying to start the transmission-daemon (a BitTorrent client) with a limit on the maximum resident set size (rss).

This is the /etc/init/transmission-daemon.conf file:

start on (filesystem and net-device-up IFACE=lo)
stop on runlevel [!2345]

# give time to send info to trackers
kill timeout 30

limit rss 1024 2048

setuid debian-transmission
setgid debian-transmission

respawn

pre-start script

  # stop job from continuing if no config file found for daemon
  [ ! -f /etc/default/transmission-daemon ] && { stop; exit 0; }

  # source the config file
  . /etc/default/transmission-daemon

  # stop job from continuing if admin has not enabled service in
  # config file.
  [ "$ENABLE_DAEMON" != 0 ] || { stop; exit 0; }

end script

script
  . /etc/default/transmission-daemon

  exec /usr/bin/transmission-daemon -f $OPTIONS
end script

As you can see, I have added the limit (rss should be expressed in KiBs if I am not wrong) just atop the script.

When I run the service with sudo service transmission-daemon start, I can see with top that the single transmission-daemon process uses much more resident memory than the limit I have set above, and saturates all the available memory.

Please note that this does not work even if I use dumb limits such as limit rss 1 2.

UPDATE: It seems that the correct unit is Bytes and not KiB or KBs. I tried to set limit as 268435456 536870912. As far as I can see, the process now does not go over the soft limit. Unfortunately, it directly goes to SEGFAULT when approaching to reach that limit.

This is the output of dmesg

[24165656.190272] transmission-da[3488]: segfault at 0 ip 00007ffad86602f6 sp 00007ffad203ea00 error 6 in transmission-daemon[7ffad863b000+75000]
[24165656.428762] init: transmission-daemon main process (3486) killed by SEGV signal
[24165656.428790] init: transmission-daemon main process ended, respawning
2
  • I believe RLIMIT_RSS does not work on Linux at all. lkml.org/lkml/2006/1/9/119. Can you test this by using a script with ulimit? Jun 29, 2014 at 14:46
  • In fact, I have already tried using an init.d script and enforcing it with ulimit -m KILOS just before the start-stop-daemon command, but it didn't work either. I'm going to try to enforce the maximum size of the virtual memory. Jun 29, 2014 at 14:53

1 Answer 1

0

Just for the record, OP solved his problem by using bytes, not kilobytes.

1
  • Yes, and by using ´as´ instead of ´rss´ (even if the semantic is different). Jul 5, 2014 at 20:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .