Re: [systemd-devel] cgroup use case for preventing a system lock up if say a browser exhausts memory

2012-11-19 Thread Lennart Poettering
On Mon, 12.11.12 12:54, Kai Hendry (hen...@iki.fi) wrote:

 Hi there,
 
 I hope this is the right forum for a systemd question, to address a
 particular problem I'm trying to solve.
 
 Problem is I've found Firefox (for example, this probably can be
 extrapolated to any browser) to lock up machines when memory is
 exhausted. Ideally when the browser hits a certain limit (only 5% of
 free RAM left), Firefox is killed and restarted, to solve my
 particular kiosk use case.
 https://github.com/Webconverger/webc/issues/83

It might be a good idea to simply bump the OOM score for firefox, so
that it is always killed first in case of OOM.

You can achieve that by wrapping ffox in shell script that first echos
somthing to /proc/self/oom_score_adj, and then execs the real ffox binary.

For now, systemd can do the same only for system services really.

Lennart

-- 
Lennart Poettering - Red Hat, Inc.
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] cgroup use case for preventing a system lock up if say a browser exhausts memory

2012-11-13 Thread Kai Hendry
On 12 November 2012 19:35, Colin Guthrie gm...@colin.guthr.ie wrote:
 When launching firefox becomes a user unit, then it will be contained
 within it's own cgroup and can have resource limits imposed with
 relative ease.

Thanks Colin for your reply.

I'm interested in a general systemd framework example of a system
process resource limited. Do you have one you can point me to?

What's important for me here, since this can run on machines with
varying amount of memory that it's basically restarted when it's
nearing memory exhaustion. Tbh I think the OOM killer should just do
this, but I gather it's more complicated than that.

Kind regards,
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] cgroup use case for preventing a system lock up if say a browser exhausts memory

2012-11-13 Thread Thomas Bächler
Am 13.11.2012 07:53, schrieb Kai Hendry:
 I'm interested in a general systemd framework example of a system
 process resource limited. Do you have one you can point me to?

http://0pointer.de/blog/projects/resources.html




signature.asc
Description: OpenPGP digital signature
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] cgroup use case for preventing a system lock up if say a browser exhausts memory

2012-11-12 Thread Colin Guthrie
'Twas brillig, and Kai Hendry at 12/11/12 04:54 did gyre and gimble:
 Hi there,
 
 I hope this is the right forum for a systemd question, to address a
 particular problem I'm trying to solve.
 
 Problem is I've found Firefox (for example, this probably can be
 extrapolated to any browser) to lock up machines when memory is
 exhausted. Ideally when the browser hits a certain limit (only 5% of
 free RAM left), Firefox is killed and restarted, to solve my
 particular kiosk use case.
 https://github.com/Webconverger/webc/issues/83
 
 I've looked and tested varying unsatisfactory solutions and since I'm
 an Archlinux user who has been put onto systemd (tbh I'm impressed), I
 was eager to know if systemd can help.
 
 I can't help but notice how busy my `mount` looks now: http://ix.io/3nt

Yeah, topic discussed/flamed to death here to be honest! The answer
this is to make the tools more intelligent - e.g. tools like df and
similar to avoid showing the same device multiple times if it's mounted
multiple times in different paths etc.

 I've done a quick couple of searches trying to find how to use cgroups
 for controlling limits with systemd and I'm still in the dark. I was
 half expecting a service file example to have a resource limit stanza.
 
 Am I looking in the right place? Many thanks,

Well, I suspect systemd can help eventually here, but likely not yet.
The reason is that Firefox is just one process that runs in the user
session, not the system. systemd is designed in such a way to eventually
replace the home-grown user session implementations (e.g.
gnome-session etc.) as the problems faced and the solutions for them are
all rather similar.

When launching firefox becomes a user unit, then it will be contained
within it's own cgroup and can have resource limits imposed with
relative ease.

When this happens I think you'll have a good framework to implement the
needed safeguards.

See Auke's work on systemd for the user session for some more background
(including his talk at this years Plumbers conference).

HTHs

Col



-- 

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited http://www.tribalogic.net/
Open Source:
  Mageia Contributor http://www.mageia.org/
  PulseAudio Hacker http://www.pulseaudio.org/
  Trac Hacker http://trac.edgewall.org/
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel