Skip to content

Abort on a GC inside a snapshot deserializer callback - #8368

Merged
csjh merged 1 commit into
mainfrom
cormick/snapshot-abort-gc-in-deserializer
Nov 11, 2026
Merged

csjh merged 1 commit into
mainfrom
cormick/snapshot-abort-gc-in-deserializer

Conversation

@csjh

@csjh csjh commented Nov 11, 2026

Copy link
Copy Markdown
Contributor

V8 runs the context deserializer's embedder callbacks under DisallowGarbageCollection, which only a debug build of V8 checks. A GC that starts there in a release build runs on a half-restored context. While a context is created from a startup snapshot, a GC prologue callback now aborts the process if a GC starts inside deserializeInternalFields() or deserializeApiWrapperCallback().

Both callbacks now take the WrappableDeserializeMetadata, which also holds the internal-field findings.

@csjh
csjh requested review from a team as code owners November 11, 2026 17:05

@clanky-the-clanker clanky-the-clanker Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Superseded by the review of 3a26d909.

This review, of abfd0644

✅ Approved — I found no issues. The GC-abort guard is scoped to context creation, the in-callback flag is set and reset correctly, and the counter now kept in WrappableDeserializeMetadata is still checked after the context is created.

The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.


✅ All checks passed

📋 Code Quality: ✅ LGTM

No issues found. The guard is scoped correctly around newContext(), the inCallback flag is reset with KJ_DEFER, and the bad-tag counter is still checked after the context is created.


📝 Documentation: ✅ LGTM

No issues found. The header comments describe the new data argument and the guard's behavior accurately.


Reviewed commit: abfd0644

@csjh
csjh force-pushed the cormick/snapshot-abort-gc-in-deserializer branch from abfd064 to 3a26d90 Compare November 11, 2026 18:54

@clanky-the-clanker clanky-the-clanker Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Superseded by the review of 866d35c3.

This review, of 3a26d909

✅ Approved — I found no issues. The GC-abort guard is scoped to context creation, the in-callback flag is set and reset correctly, and the counter now kept in WrappableDeserializeMetadata is still checked after the context is created.

The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.


✅ All checks passed

📋 Code Quality: ✅ LGTM

No issues found. The guard is scoped correctly around newContext(), the inCallback flag is reset with KJ_DEFER, and the bad-tag counter is still checked after the context is created.


📝 Documentation: ✅ LGTM

No issues found. The header comments describe the new data argument and the guard's behavior accurately.


Reviewed commit: 3a26d909 — same changes as abfd0644, so this is that commit's review (no new review was run; line numbers are as of abfd0644)

@csjh
csjh force-pushed the cormick/snapshot-abort-gc-in-deserializer branch from 3a26d90 to 866d35c Compare November 11, 2026 20:28

@clanky-the-clanker clanky-the-clanker Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Superseded by the review of c8e232ff.

This review, of 866d35c3

✅ Approved — I found no issues. The GC-abort guard is scoped to context creation, the in-callback flag is set and reset correctly, and the counter now kept in WrappableDeserializeMetadata is still checked after the context is created.

The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.


✅ All checks passed

📋 Code Quality: ✅ LGTM

No issues found. The guard is scoped correctly around newContext(), the inCallback flag is reset with KJ_DEFER, and the bad-tag counter is still checked after the context is created.


📝 Documentation: ✅ LGTM

No issues found. The header comments describe the new data argument and the guard's behavior accurately.


Reviewed commit: 866d35c3 — same changes as abfd0644, so this is that commit's review (no new review was run; line numbers are as of abfd0644)

V8 runs the context deserializer's embedder callbacks under
DisallowGarbageCollection, which only a debug build of V8 checks. A
GC that starts there in a release build runs on a half-restored
context. While a context is created from a startup snapshot, a GC
prologue callback now aborts the process if a GC starts inside
deserializeInternalFields() or deserializeApiWrapperCallback().

Both callbacks now take the WrappableDeserializeMetadata, which also
holds the internal-field findings.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@csjh
csjh force-pushed the cormick/snapshot-abort-gc-in-deserializer branch from 866d35c to c8e232f Compare November 11, 2026 21:28

@clanky-the-clanker clanky-the-clanker Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Approved — I found no issues. The GC-abort guard is scoped to context creation, the in-callback flag is set and reset correctly, and the counter now kept in WrappableDeserializeMetadata is still checked after the context is created.

The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.


✅ All checks passed

📋 Code Quality: ✅ LGTM

No issues found. The guard is scoped correctly around newContext(), the inCallback flag is reset with KJ_DEFER, and the bad-tag counter is still checked after the context is created.


📝 Documentation: ✅ LGTM

No issues found. The header comments describe the new data argument and the guard's behavior accurately.


Reviewed commit: c8e232ff — same changes as abfd0644, so this is that commit's review (no new review was run; line numbers are as of abfd0644)

@csjh
csjh enabled auto-merge (squash) November 11, 2026 21:38
@csjh
csjh merged commit 24e99ab into main Nov 11, 2026
36 of 37 checks passed
@csjh
csjh deleted the cormick/snapshot-abort-gc-in-deserializer branch November 11, 2026 22:03
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

Successfully merging this pull request may close these issues.

2 participants