runc: gracefully handle low RLIMIT_NOFILE instead of crashing#5097
runc: gracefully handle low RLIMIT_NOFILE instead of crashing#5097arnavgogia20 wants to merge 2 commits intoopencontainers:mainfrom
Conversation
When a container is started with a very low RLIMIT_NOFILE (e.g. < 14),
runc may crash with a Go runtime panic ('runtime: eventfd failed') when
attempting to initialize the network poller lazily.
This patch adds a defensive check in setupRlimits to enforce a safe
minimum (32) for the soft RLIMIT_NOFILE. This ensures that runc explicitly
errors out with a clear message instead of panicking deep in the runtime.
Fixes: opencontainers#5082
Signed-off-by: arnavgogia20 <arnavgogia404@gmail.com>
Adds an integration test verifying that starting a container with a very low RLIMIT_NOFILE (10) results in a graceful error message rather than a runtime crash. Signed-off-by: arnavgogia20 <arnavgogia404@gmail.com>
|
This was obviously written/aided by an LLM without much understanding of the underlying issue. Tests are failing as well. While we don't have a LLM policy yet (just a discussion at #4990), let me be bold and close this now to spare other maintainers' time. @arnavgogia20 feel free to keep contributing to runc, but try to engage your own mental abilities rather than merely use LLM for everything. As for the issue, I will add a comment to #5082. |
|
Thanks for the direct feedback...... and sorry for the noise caused here. |
Summary
This PR fixes a crash in
runcthat occurs when creating a container with a very smallRLIMIT_NOFILEvalue.Instead of triggering a Go runtime panic (e.g.
eventfd failed), runc now detects theresource exhaustion scenario and returns a clear, user-facing error.
Background
When
RLIMIT_NOFILEis set too low, runc may fail to create internal resources such aseventfd/epoll. In recent versions this results in a runtime panic and stack trace,which is unexpected and difficult for users to diagnose.
Earlier versions of runc returned a controlled error in this scenario.
Changes
RLIMIT_NOFILEduring container creationTesting
RLIMIT_NOFILEand verifies runc exits with acontrolled error instead of panicking
Compatibility & Risk
RLIMIT_NOFILEvaluesRelated Issue
Closes #5082