all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Attila Lendvai <attila@lendvai.name>
To: Maxime Devos <maximedevos@telenet.be>
Cc: guix-devel <guix-devel@gnu.org>
Subject: Re: setting open files limit for daemon processes
Date: Fri, 25 Feb 2022 14:09:43 +0000	[thread overview]
Message-ID: <gPbOILZypUZBKpviun9qHl8MWgmf17oiluPYSzP2xc9nxPatdSvOYJevkCKzhzdZND1zhWaeHlhbL88Krwvrg2xO3ZZYCHa02mvWPbGE9Mw=@lendvai.name> (raw)
In-Reply-To: <e6b34f1cd0f872c72d77a40a56cfb86d40d9b6b2.camel@telenet.be>

> > su - [daemon user] -c 'ulimit -aHS' -s `which bash`
>
> That might set the limit of the user when that user logins (and hence,
> PAM things are run), but I don't see how this changes the limit of
> shepherd itself. I don't think that shepherd interacts with PAM at
> all?


my understanding of PAM is rather limited, but i guess it cannot hook into
setuid(), and as such it has no means to affect the ulimits of processes spawned
by Shepherd.


> My suggestion is to do (setrlimit RLIMIT_NOFILE [...]) inside shepherd
> itself -- when shepherd starts, or between 'fork' and 'exec'. Maybe


looking at the code, it'd be nice if we factored out a variant of fork (maybe
called CALL-IN-FORK) that took a thunk and called it in the forked path. that
would allow me to use that abstraction in user code to easily insert a call to
setrlimit before the EXEC-COMMAND, or whatever else is needed.

maybe using that abstraction we could straight out move EXEC-COMMAND to the guix
side? my thinking here is that toching/testing/updating the Shepherd codebase
seems to be much more trouble than the Guix codebase.

i'd be happy to play with this, but i don't know how to run a Guix VM that is
built using my modified Shepherd; i.e. i have no idea how to test what i'm
doing.


> an '#:open-file-limit' argument could be added to 'fork+exec-command'?


that would be the safest/simplest way to resolve this, but then what about all
the other limits?

--
• attila lendvai
• PGP: 963F 5D5F 45C7 DFCD 0A39
--
“There can be no keener revelation of a society’s soul than the way in which it treats its children.”
	— Nelson Mandela (1918–2013)



  reply	other threads:[~2022-02-25 14:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-25  7:55 setting open files limit for daemon processes Attila Lendvai
2022-02-25 10:42 ` Maxime Devos
2022-02-25 14:09   ` Attila Lendvai [this message]
2022-02-25 21:28     ` Attila Lendvai
2022-02-25 22:04       ` Maxime Devos

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='gPbOILZypUZBKpviun9qHl8MWgmf17oiluPYSzP2xc9nxPatdSvOYJevkCKzhzdZND1zhWaeHlhbL88Krwvrg2xO3ZZYCHa02mvWPbGE9Mw=@lendvai.name' \
    --to=attila@lendvai.name \
    --cc=guix-devel@gnu.org \
    --cc=maximedevos@telenet.be \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.