Repository navigation
repair make-immobile-bytevector for large sizes - #1070
Merged
Merged
Conversation
When the segment allocator preemptively marks a large allocaiton as immobile, it did not set `S_G.must_mark_gen0` to ensure that the right GC variant is triggered. As a result, the should-be-immobile byte vector could move.
samth
added a commit
to samth/racket
that referenced
this pull request
Sep 24, 2026
…?` call A foreign call made with `#:callback-exns?` catches an exception during the call, escapes back out of the C frames, and ends the scheduler's atomic mode, since a callback runs in atomic mode. But the exception can also come from the foreign procedure itself: an invalid memory reference in C becomes an exception with no callback involved. Ending atomic mode then either failed with "internal-error: not in atomic mode to end", which hid the invalid memory reference, or, when the caller was in atomic mode, ended the caller's atomic mode instead. Record the atomic-mode depth before the call and, on an escape, end atomic mode only down to that depth. For example, a `png_read_rows` call in racket/draw faulted when a large "immobile" bytevector moved (cisco/ChezScheme#1070), and the fault was reported only as the internal error.
samth
added a commit
to samth/racket
that referenced
this pull request
Sep 24, 2026
…?` call A foreign call made with `#:callback-exns?` catches an exception during the call, escapes back out of the C frames, and ends the scheduler's atomic mode, since a callback runs in atomic mode. But the exception can also come from the foreign procedure itself: an invalid memory reference in C becomes an exception with no callback involved. Ending atomic mode then either failed with "internal-error: not in atomic mode to end", which hid the invalid memory reference, or, when the caller was in atomic mode, ended the caller's atomic mode instead. Record the atomic-mode depth before the call and, on an escape, end atomic mode only down to that depth. For example, a `png_read_rows` call in racket/draw faulted when a large "immobile" bytevector moved (cisco/ChezScheme#1070), and the fault was reported only as the internal error.
burgerrg
approved these changes
Sep 24, 2026
burgerrg
left a comment
Contributor
There was a problem hiding this comment.
Thank you for finding and fixing this bug!
samth
added a commit
to samth/racket
that referenced
this pull request
Oct 2, 2026
…?` call A foreign call made with `#:callback-exns?` catches an exception during the call, escapes back out of the C frames, and ends the scheduler's atomic mode, since a callback runs in atomic mode. But the exception can also come from the foreign procedure itself: an invalid memory reference in C becomes an exception with no callback involved. Ending atomic mode then either failed with "internal-error: not in atomic mode to end", which hid the invalid memory reference, or, when the caller was in atomic mode, ended the caller's atomic mode instead. Record the atomic-mode depth before the call and, on an escape, end atomic mode only down to that depth. For example, a `png_read_rows` call in racket/draw faulted when a large "immobile" bytevector moved (cisco/ChezScheme#1070), and the fault was reported only as the internal error.
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.
When the segment allocator preemptively marks a large allocaiton as immobile, it did not set
S_G.must_mark_gen0to ensure that the right GC variant is triggered. As a result, the should-be-immobile byte vector could move.