ulimit support #28

Closed
berekuk opened this Issue Apr 12, 2012 · 3 comments

2 participants

@berekuk
Owner

Many people want to set ulimits for their services.
We need to provide some way to set them either in SimpleDaemon or with some wrapper/role for SimpleDaemon

Example of a possible wrapper syntax:

Ubic::Service::WithUlimits->new(
    Ubic::Service::SimpleDaemon->new({ bin => "sleep 1000" }),
    {
        nofile => 4096,
        cpu => 3600,
    }
);

Ulimits themselves can be set with BSD::Resource.

@oktocat

I suppose, it's highest priority in Ubic.

@berekuk
Owner

Lowering ulimits is easy, but increasing ulimits in generic case of non-root user is hard.
The latter problem requires the proper daemon_user impelementation (#27), which I didn't figure out how to do properly yet.

So, this is high priority, but it's either "support some cases quickly" or "support all cases later".

@berekuk
Owner

Ok, I finally did it.
See the docs in https://metacpan.org/module/MMCLERIC/Ubic-1.43_01/lib/Ubic/Service/SimpleDaemon.pm (ulimit option).
BSD::Resource is required to use this feature, but Ubic doesn't depend on it itself — it just throws an exception if you try to use ulimit but BSD::Resource is not installed.

BTW, since ulimit must be a hashref and it'll be impossible to express with .ini configs, I also added json configs support.

@berekuk berekuk closed this Jun 19, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment