Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ulimit -n is too low inside toolbox and can't be changed. #213

Closed
ocrete opened this issue Jul 2, 2019 · 11 comments
Closed

ulimit -n is too low inside toolbox and can't be changed. #213

ocrete opened this issue Jul 2, 2019 · 11 comments

Comments

@ocrete
Copy link

ocrete commented Jul 2, 2019

Building GStreamer with Cerbero requires over 1024 FDs, creating a container by hand with podman I can do "--ulimit nofile=10240", but I can't find a similar option when using toolbox.

@debarshiray
Copy link
Member

Interesting.

We could bump the default limit for all toolboxes and/or introduce a toolbox create command line flag to override it.

However, I don't think it will really work. A non-root user can't override ulimit -n when running directly on the host. While rootless podman create --name foo --ulimit nofile=10240 ... does work, rootless podman start foo will error out. So you can't really use the container.

@debarshiray
Copy link
Member

Were you by any chance referring to the soft and hard limits?

On my host, the hard limit is 4096 and the soft limit is 1024. Hence a non-root user can bump the soft limit till 4096:

[rishi@kolache ~]$ ulimit -H -n
4096
[rishi@kolache ~]$ ulimit -S -n
1024
[rishi@kolache ~]$ ulimit -S -n 4096
[rishi@kolache ~]$ ulimit -H -n
4096
[rishi@kolache ~]$ ulimit -S -n
4096

However, inside the rootless toolbox container, both soft and hard limits are 1024:

⬢[rishi@toolbox ~]$ ulimit -H -n
1024
⬢[rishi@toolbox ~]$ ulimit -S -n
1024

@debarshiray
Copy link
Member

As @giuseppe pointed out, this does work: podman create --ulimit nofile=1024:4096.

Are 4096 file descriptors enough to build GStreamer with Cerbero? :)

@ocrete
Copy link
Author

ocrete commented Jul 3, 2019

Yes, I'm referring to the hard limit inside the container being set to the soft limit of the host. I guess ideally for toolbox, the hard would be set to the hard limit of the host for most thing.

@ocrete
Copy link
Author

ocrete commented Jul 3, 2019

On my recently installed F30 machine, I have a hard limit of 524288 fds, which makes a lot of sense

@ocrete
Copy link
Author

ocrete commented Jul 3, 2019

Erm, for GStreamer, we set it to 10240 .. but I thinkm ito's just adding a 0.. Can't we just inherit the limit from the host ? --ulimit nofile=$(ulimit -n):$(ulimit -H -n)

@debarshiray
Copy link
Member

On my recently installed F30 machine, I have a hard limit of 524288 fds

Ah, so the hard limit is indeed higher on Fedora 30. So far I was playing on Fedora 29, where the hard limit used to be 4096.

Can't we just inherit the limit from the host ? --ulimit nofile=$(ulimit -n):$(ulimit -H -n)

Yeah, I think for toolbox containers we should just use the host limits. @giuseppe said that he's investigating if this can be made even easier with --ulimit host. If so we'd just use that. The more we can delegate to Podman, the better. :)

@giuseppe
Copy link
Member

giuseppe commented Jul 3, 2019

I've opened a PR so you can use --ulimit host and not have to worry to copy them from the system:

containers/podman#3491

@HarryMichal
Copy link
Member

Just experienced a problem with this when I tried to install packages using npm.

@jgillich
Copy link

jgillich commented Aug 8, 2019

The low limit also causes issues with Wine/Esync.

debarshiray referenced this issue in HarryMichal/toolbox Sep 9, 2019
Since Podman supports '--ulimit host' only from version 1.5.0, which
is newer than the minimum required version of 1.4.0, this only works
if a new enough Podman is available.

https://github.com/debarshiray/toolbox/issues/213
@debarshiray
Copy link
Member

Fixed via https://github.com/debarshiray/toolbox/pull/229

You'd need Podman 1.5.0 to have the ulimits passed through from the host to the containers.

debarshiray added a commit to debarshiray/toolbox that referenced this issue Jun 30, 2023
Note that the soft limit for the number of open file descriptors cannot
be tested at the moment because Podman sets the Toolbx container to have
a value higher than the host's [1].

[1] containers/podman#17681

containers#213
debarshiray added a commit to debarshiray/toolbox that referenced this issue Jun 30, 2023
Note that the soft limit for the maximum number of open file descriptors
cannot be tested at the moment because Podman sets the Toolbx container
to have a value higher than the host's [1].

[1] containers/podman#17681

containers#213
debarshiray added a commit to debarshiray/toolbox that referenced this issue Jul 1, 2023
Note that the soft limit for the maximum number of open file descriptors
cannot be tested at the moment because Podman sets the Toolbx container
to have a value higher than the host's [1].

[1] containers/podman#17681

containers#213
debarshiray added a commit to debarshiray/toolbox that referenced this issue Jul 1, 2023
Note that the soft limit for the maximum number of open file descriptors
cannot be tested at the moment because Podman sets the Toolbx container
to have a value higher than the host's [1].

[1] containers/podman#17681

containers#213
debarshiray added a commit to debarshiray/toolbox that referenced this issue Jul 1, 2023
Podman sets the Toolbx container's soft limit for the maximum number of
open file descriptors to the host's hard limit, which is often greater
than the host's soft limit.

[1] containers/podman#17681

containers#213
debarshiray added a commit to debarshiray/toolbox that referenced this issue Jul 1, 2023
Podman sets the Toolbx container's soft limit for the maximum number of
open file descriptors to the host's hard limit, which is often greater
than the host's soft limit [1].

[1] containers/podman#17681

containers#213
debarshiray added a commit to debarshiray/toolbox that referenced this issue Jul 4, 2023
The following caveats must be noted:

  * Podman sets the Toolbx container's soft limit for the maximum number
    of open file descriptors to the host's hard limit, which is often
    greater than the host's soft limit [1].

  * The ulimit(1) options -b, -k, P and -T don't work on Fedora 38
    because the corresponding resource arguments for getrlimit(2) are
    absent from the operating system.  These are RLIMIT_SBSIZE,
    RLIMIT_KQUEUES, RLIMIT_NPTS and RLIMIT_PTHREAD respectively.

[1] containers/podman#17681

containers#213
debarshiray added a commit to debarshiray/toolbox that referenced this issue Jul 4, 2023
The following caveats must be noted:

  * Podman sets the Toolbx container's soft limit for the maximum number
    of open file descriptors to the host's hard limit, which is often
    greater than the host's soft limit [1].

  * The ulimit(1) options -P, -T, -b, and -k don't work on Fedora 38
    because the corresponding resource arguments for getrlimit(2) are
    absent from the operating system.  These are RLIMIT_NPTS,
    RLIMIT_PTHREAD, RLIMIT_SBSIZE and RLIMIT_KQUEUES respectively.

[1] containers/podman#17681

containers#213
debarshiray added a commit to containers/containertoolbx.org that referenced this issue Mar 4, 2024
GStreamer, like GTK, also implies GLib.  It adds a whole new dimension
to the list of use cases, and there's concrete evidence of folks using
Toolbx for GStreamer development [1].

[1] containers/toolbox#213
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants