fix: prevent Loop.configure leaks and System.random size limits, Loop.alive and system error handling - #15175
Open
algebraic-dev wants to merge 5 commits into
Open
algebraic-dev wants to merge 5 commits into
algebraic-dev wants to merge 5 commits into
Conversation
This PR fixes Std.Internal.UV.Loop.configure, which leaked its options on every call and could not report errors; it now has type IO Unit. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This PR makes Std.Internal.UV.System.random fail with UV_E2BIG for sizes above 2^31-1 instead of aborting the process. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
`Loop.alive` now returns `false` when nothing is pending, instead of always counting the handle that wakes the loop. `System.osHomedir`, `System.osTmpdir` and `System.cwd` return values longer than `PATH_MAX` instead of failing, `System.osSetPriority` rejects priorities outside the C `int` range instead of wrapping them, and a failing `System.osEnviron` raises a proper `IO.Error`. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Loop.configure from leaking and System.randomsize limitLoop.configure leaks and System.random size limits, fix Loop.alive and system error handling
Loop.configure leaks and System.random size limits, fix Loop.alive and system error handlingLoop.configure leaks and System.random size limits, Loop.alive and system error handling
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Chessing234
reviewed
Sep 17, 2026
Chessing234
left a comment
There was a problem hiding this comment.
the @& Options + IO return type change for Loop.configure looks like the right fix for the exclusive-object leak, and the compile test checking isExclusiveUnsafe after configure is good evidence.
on the run_loop rewrite: holding the mutex across the uv_loop_alive check (with the note about lean_uv_event_loop_alive unreferencing async) seems necessary. one thing to double-check — removing async_callback/uv_stop means the only wake path is uv_async_send plus UV_RUN_ONCE returning; worth confirming a waiter that arrives while uv_run is inside a long callback still gets the mutex promptly (i.e. that async still interrupts that wait).
didn't rebuild the uv tests locally.
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.
This PR stops
Loop.configurefrom leaking and rejectsSystem.randomvalues above 2^31-1 before allocating a huge array.