Configuring limits globally

Lukáš Nykrýn lnykryn at
Thu Feb 9 08:49:44 UTC 2012

Lukáš Nykrýn píše v Čt 10. 11. 2011 v 11:24 +0100:
> Steve Langasek píše v Út 08. 11. 2011 v 09:40 -0800:
> > On Tue, Nov 08, 2011 at 11:43:34AM +0000, James Hunt wrote:
> > > On 08/11/11 10:51, Lukáš Nykrýn wrote:
> > > > Hello,
> > > > I want to ask if this patch
> > > > was considered for
> > > > inclusion or if there are some issues that needs to be worked on.
> > > > This was possible in SysVinit so I think it is very unpleasant that
> > > > Upstart does not provide possibility to change limits globally.
> > 
> > > This would be a useful idea. However, there is quite a lot of work still
> > > to do to have the patch accepted.  See my comments:
> > 
> > >
> > 
> > As far as I can see, there isn't even a patch that's been proposed yet?
> > 
> > FWIW, a workaround for this would be to set global limits in the initramfs
> > (or via a diversion of /sbin/init) before calling upstart.  Not pretty, but
> > would do the job, while we don't have a patch.
> > 
> I think that adding other stanzas to init.conf in the same way like is
> in this patch for limit would be quite easy, most of it can be taken
> from parse_job and if there is a chance that this will be accepted I can
> prepare it. But if somebody thinks that this is not necessary or
> unwanted it would be good to known.
> Lukas

I was thinking about implementing possibility of setting global value
for some of the stanzas. My idea is to share parse_ functions between
parse_conf and parse_job (writing parse_* functions specifically for
parse_conf would lead to duplicities in code). Main principle is that,
parse_conf will create "template" JobClass which than will be passed to
parse_job and used in case of creating new class.
I have begun to implement this, but I came to some questions:
1) Is this idea acceptable or does it need some changes or this behavior
should not be in upstart?
2) How to handle this from view of sessions? Should there be only one
configuration file for all jobs or one for every job dir or some
hierarchical structure. Should be limits set by the stanzas
in /etc/init.conf "mandatory" or can user overwrite them? 
3) Are there any new stanzas which should be only in parse_conf?

In attached patch you can see some "scratch implementation". The patch
is completely untested, without tests and I am not sure how to implement
reloading of configuration, when is init.conf changed, but I think it is
enough for illustration, how I want to do this.

Thanks for all reactions.

Kind regards,

PS: It seems that patch made this message too big to be accepted, so I put it in bazaar repository:

More information about the upstart-devel mailing list