Skip to content

Revert requestTermination change#6626

Merged
erikcorry merged 4 commits into
mainfrom
erikcorry/revert-request-termination
May 1, 2026
Merged

Revert requestTermination change#6626
erikcorry merged 4 commits into
mainfrom
erikcorry/revert-request-termination

Conversation

@erikcorry

Copy link
Copy Markdown
Contributor

A better solution was found in the form of https://chromium-review.googlesource.com/c/v8/v8/+/7734848 and so this interface is unused.

@erikcorry erikcorry requested review from a team as code owners April 21, 2026 06:53

@ask-bonk ask-bonk Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm Bonk, and I've done a quick review of your PR.

This PR reverts the requestTermination / isTerminationRequested mechanism from the C++ JSG layer, but the Rust FFI layer still depends on those removed methods.

Issues (by severity)

  1. Build break (high): The Rust FFI layer in src/rust/jsg/ has active callers of the removed IsolateBase::requestTermination() and IsolateBase::isTerminationRequested() methods. These files need corresponding changes:

    • src/rust/jsg/ffi.c++:1089-1095isolate_request_termination() and isolate_is_termination_requested() call the removed methods
    • src/rust/jsg/ffi.h:343-344 — declares those FFI functions
    • src/rust/jsg/v8.rs:555-556 — Rust-side FFI declarations
    • src/rust/jsg/lib.rs:599-623Lock::request_termination() and Lock::is_termination_requested() public methods
    • src/rust/jsg/lib.rs:819catch_panic() calls lock.request_termination() after converting a Rust panic to a JS exception
    • src/rust/jsg-test/tests/resource_callback.rs:441-488 — test that asserts on is_termination_requested()

    The catch_panic case is particularly important: it's the Rust panic handler that terminates the isolate after a panic to prevent GC from observing partially-mutated state. This needs a replacement — likely switching to terminateExecution() (which is still available on IsolateBase) instead of the removed requestTermination(). The is_termination_requested() check in the test would need a different assertion strategy since there's no longer a flag to query.

Comment thread src/workerd/jsg/setup.h
@ask-bonk

ask-bonk Bot commented Apr 21, 2026

Copy link
Copy Markdown
Contributor

Review posted successfully on PR #6626. Here's a summary:

High-severity issue found: The PR removes requestTermination() and isTerminationRequested() from the C++ IsolateBase and Lock classes, but the Rust FFI layer in src/rust/jsg/ still actively calls both methods across 6 files:

  • FFI bridge (ffi.c++, ffi.h, v8.rs) — will fail to compile
  • Lock wrapper (lib.rs) — exposes request_termination() and is_termination_requested() to Rust code
  • Panic handler (lib.rs:819) — catch_panic() calls request_termination() to safely terminate the isolate after a Rust panic, preventing GC from observing partially-mutated state. This is a safety-critical path that needs a replacement.
  • Test (resource_callback.rs) — asserts on is_termination_requested()

github run

@github-actions

github-actions Bot commented Apr 21, 2026

Copy link
Copy Markdown

The generated output of @cloudflare/workers-types matches the snapshot in types/generated-snapshot 🎉

@erikcorry erikcorry force-pushed the erikcorry/revert-request-termination branch from 6c350af to d4933af Compare May 1, 2026 07:24
@ask-bonk

ask-bonk Bot commented May 1, 2026

Copy link
Copy Markdown
Contributor

UnknownError: ProviderInitError

github run

@ask-bonk

ask-bonk Bot commented May 1, 2026

Copy link
Copy Markdown
Contributor

@erikcorry Bonk workflow failed. Check the logs for details.

View workflow run · To retry, trigger Bonk again.

@ask-bonk ask-bonk Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm Bonk, and I've done a quick review of your PR.

This PR reverts the requestTermination/isTerminationRequested mechanism from C++ and Rust, replacing the Rust-side usage with direct terminateExecution() calls, since the upstream V8 fix makes the workaround unnecessary.

The build break I flagged in the previous review has been addressed — the Rust FFI layer now consistently uses isolate_terminate_execution across all three bridge files, catch_panic still terminates the isolate after a Rust panic, and the test assertions on the removed flag have been cleaned up.

Issues

  1. (Low) Stale comments in resource_callback.rs — the doc comment on line 441 and the code comment on line 462 still reference request_termination() instead of terminate_execution(). These are outside the diff so I can't suggest inline, but they should be updated for consistency.

This review was generated by an AI assistant and may contain errors.

@ask-bonk

ask-bonk Bot commented May 1, 2026

Copy link
Copy Markdown
Contributor

Review posted successfully on PR #6626. Here's a summary:

The PR has addressed the build break I flagged in my previous review. The only remaining issue is low-severity: two stale comments in resource_callback.rs (lines 441 and 462) still reference request_termination() instead of the new terminate_execution(). The rest of the changes are consistent across all layers (C++ IsolateBase/Lock, Rust FFI bridge, Rust Lock, and catch_panic).

github run

@erikcorry erikcorry force-pushed the erikcorry/revert-request-termination branch from c2414c4 to e475dcf Compare May 1, 2026 10:16
@erikcorry erikcorry merged commit 4bce0a2 into main May 1, 2026
22 checks passed
@erikcorry erikcorry deleted the erikcorry/revert-request-termination branch May 1, 2026 10:43
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.

3 participants