Repository navigation
fix(ray.sub): raise the fd soft limit to the hard limit, not Ray's floor - #5058
Merged
terrykong merged 1 commit intoNov 4, 2026
Merged
Conversation
Contributor
Author
|
/ok to test 7687822 |
terrykong
reviewed
Nov 4, 2026
terrykong
left a comment
Collaborator
There was a problem hiding this comment.
Thanks for this. The hard = 65535 fix is real (on the base, soft stayed at its starting value on such a host), and the [INFO] line makes it easy to tell which branch a run took. The new tests follow the test_ray_sub_gres.py pattern well: we tried 9 changes to the block, and the tests caught every one that changes the result.
- (C1) The block can still lower a soft limit that starts above the target. This is older than the PR, but the new comment and docs say it only raises. Suggested fix included.
- (C3) The comment names the wrong Gym file; suggested a shorter version.
- (C4) Move a history line to the commit message.
Checked and fine: the limit reaches every node through srun (Slurm's default PropagateResourceLimits=ALL), neither Ray nor Gym raises past 65535 on its own so this block is needed, and an env var is the right form for a ray.sub knob.
Generated by Claude Code
65535 is the FLOOR Ray recommends, not a target, and pinning the soft limit
there caps any workload whose connection pool is configured above it. A pool
limit above the fd ceiling does not bound anything -- the fd ceiling does, and
it surfaces as OSError: [Errno 24] mid-request instead of as backpressure.
That is not hypothetical for NeMo-Gym. At the pinned Gym commit 5911d628,
GlobalAIOHTTPAsyncClientConfig.global_aiohttp_connector_limit defaults to
100 * 1024 and telemetry/connection_pool.py divides it only by the FastAPI
worker count, so every single-worker server sees the full 102,400 against a
65,535 ceiling. When it bites, Gym's middleware hands the model repr(e) as
ordinary content, so the rollout counts toward the batch with an error string
where its reward belonged -- a silent-corruption path, not a crash.
Also fixes two edge cases in the old form:
- At exactly hard == 65535 neither branch fired, because both comparisons
were strict, so the soft limit was never raised at all on such a host.
- Only the hard limit was consulted before assigning, so a host that already
started above the target had its soft limit LOWERED. A container image
starting at soft = hard = 1048576 lost most of its headroom. Ray's own
ray.init (soft = max(soft, min(hard, 65536))) and Gym's set_ulimit
(if current_soft < target_soft_limit) both only ever raise; this now
matches.
New behaviour, target overridable via NRL_TARGET_NOFILE:
soft >= target unchanged, never lowered
hard unlimited or >= target soft = target (131072)
hard in [65535, target) soft = hard, i.e. everything available
hard < 65535 unchanged, warning
Verified on aws-cmh-slurm-1, where hard is 131072: soft now resolves to 131072
rather than 65535.
tests/unit/test_ray_sub_nofile.py cuts the block out of ray.sub and runs it
under a shell function shadowing the ulimit builtin, following the pattern in
test_ray_sub_gres.py, so each starting pair's resolved soft limit is pinned
without touching real process limits. docs/cluster.md gains NRL_TARGET_NOFILE.
Signed-off-by: Saurabh Mishra <[email protected]>
saumishr
force-pushed
the
fix/ray-sub-nofile-hard-limit
branch
from
November 4, 2026 02:48
7687822 to
93588b8
Compare
Contributor
Author
|
/ok to test 93588b8 |
terrykong
approved these changes
Nov 4, 2026
terrykong
enabled auto-merge (squash)
November 4, 2026 05:21
isomap
added a commit
to isomap/RL
that referenced
this pull request
Nov 5, 2026
Brings in NVIDIA-NeMo#5061 (vLLM fp32 LM head via head_dtype), NVIDIA-NeMo#5058 and NVIDIA-NeMo#4825. No conflicts; NVIDIA-NeMo#5061 changes the fp32_lm_head comment next to this branch's logprobs_mode comment in vllm/config.py. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Hayate Iso <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do ?
Raises
ray.sub's open-file soft limit toward a real target instead of pinning it at Ray's recommended floor of 65535, and fixes two edge cases in the old form: a host whose hard limit was exactly 65535 had its soft limit left unraised entirely, and a host that already started above the target had it lowered.Issues
None filed.
Usage
No action required; the new default applies to every
ray.sublaunch. The resolved pair is printed during bringup:To ask for a different target:
Before your PR is "Ready for review"
Pre checks:
Additional Information
Why the floor is the wrong target. 65535 is the value Ray's large-cluster guide recommends as a minimum, and the old code set the soft limit to it whenever the hard limit allowed more. That caps any workload whose connection pool is configured above it. A pool limit above the descriptor ceiling does not bound anything — the ceiling does — and it surfaces as
OSError: [Errno 24]mid-request rather than as backpressure.Concretely, for NeMo-Gym. At the pinned Gym commit
5911d628,GlobalAIOHTTPAsyncClientConfig.global_aiohttp_connector_limitdefaults to100 * 1024, andtelemetry/connection_pool.pydivides it by the FastAPI worker count and nothing else (total = configured_total // workers), so a single-worker server carries the full 102,400 against a 65,535 ceiling. When it bites, Gym's middleware hands the modelrepr(e)as ordinary content, so the rollout still counts toward the batch with an error string where its reward belonged. That is a silent-corruption path, not a crash, which is what makes it worth fixing rather than tuning per-run.These references live in the commit message and here rather than in
ray.sub, since cross-repo line numbers go stale on the next submodule bump — as these ones already had.The two edge cases. The old form was:
Both comparisons are strict, so a host with
hard == 65535matched neither branch and the soft limit was never touched — the one case where the floor genuinely was the right target.Separately, the assignment consulted only the hard limit, so a host already above the target was lowered to it. A container image starting at
soft = hard = 1048576lost most of its headroom. Ray's ownray.init(soft = max(soft, min(hard, 65536))) and Gym'sset_ulimit(if current_soft < target_soft_limit) both only ever raise; this now matches them.New behaviour, with the target overridable via
NRL_TARGET_NOFILE:>= target(orunlimited)unlimitedor>= target[65535, target)< 65535Testing.
tests/unit/test_ray_sub_nofile.pyfollows the existingtest_ray_sub_gres.pypattern: it cuts the block out ofray.subverbatim and runs it underset -eou pipefailwith a shell function shadowing theulimitbuiltin, so each starting(soft, hard)pair's resolved limit is pinned without touching real process limits. 13 tests, all passing.Both guards are load-bearing rather than decorative, verified by mutation:
-ge 65535to-gt 65535failstest_a_hard_limit_exactly_at_the_floor_is_still_raisedand nothing else;test_a_soft_limit_already_at_or_above_the_target_is_never_lowered.Also verified on
aws-cmh-slurm-1, where the hard limit is 131072: the soft limit now resolves to 131072 rather than 65535.Docs.
docs/cluster.mdgains anNRL_TARGET_NOFILEentry alongside the otherray.subvariables, including the no-lowering guarantee.