Skip to content

inspector: defer JS execution from V8 interrupts - #65397

Open
deepak1556 wants to merge 3 commits into
nodejs:mainfrom
deepak1556:robo/enable_js_in_api_interrupt_check
Open

inspector: defer JS execution from V8 interrupts#65397
deepak1556 wants to merge 3 commits into
nodejs:mainfrom
deepak1556:robo/enable_js_in_api_interrupt_check

Conversation

@deepak1556

Copy link
Copy Markdown
Contributor

Followup to #65028 covering additional callsites, upstreaming from electron/electron#52960.

Backported the V8 feature to enable the scope check moving forward, node::RequestInterrupt already subjected this restriction with its scope check. The change should only affect addons that were to use v8::Isolate::RequestInterrupt, but its already a documented caution in the public header. Any reason the feature shouldn't be enabled ?

cc @joyeecheung

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/gyp
  • @nodejs/inspector
  • @nodejs/security-wg
  • @nodejs/v8-update

@nodejs-github-bot nodejs-github-bot added lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run. labels Aug 19, 2026
deepak1556 and others added 3 commits August 19, 2026 17:04
Inspector messages for a main thread connection are dispatched
from a V8 interrupt handler. Defer frontend messages in this
case using a microtask. This preserves the existing timing
contract for main thread inspector connections, where
notifications are observable after a microtask checkpoint.

Starting the inspector I/O thread and toggling network tracking
can also call into JS from an interrupt.

Signed-off-by: deepak1556 <hop2deep@gmail.com>
Signed-off-by: deepak1556 <hop2deep@gmail.com>
Original commit message:

    [api] Prepare DisallowJavascriptExecution scope around api callbacks

    In `v8::Isolate::RequestInterrupt` the API contract says:

         API interrupt callbacks are forbidden from executing JavaScript
         on the interrupted Isolate.

    This CL prepares the infrastructure to enforce this contract.

    Bug: 540137721, 40067940

    TAG=agy
    CONV=78573798-a951-4bd3-9c6f-3e3b6775da4b

    Change-Id: I43cc83c3cc3ebd34052a927dde55bbf4d49d2d29
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/8173727
    Auto-Submit: Olivier Flückiger <olivf@chromium.org>
    Reviewed-by: Simon Zünd <szuend@chromium.org>
    Commit-Queue: Olivier Flückiger <olivf@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#109086}

Refs: v8/v8@b36cf9f
Signed-off-by: deepak1556 <hop2deep@gmail.com>
@deepak1556
deepak1556 force-pushed the robo/enable_js_in_api_interrupt_check branch from e9d757c to 788c38a Compare August 19, 2026 08:31
@codecov

codecov Bot commented Aug 19, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 61.05263% with 37 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.12%. Comparing base (55e4ca3) to head (788c38a).
⚠️ Report is 9 commits behind head on main.

Files with missing lines Patch % Lines
src/inspector_agent.cc 52.94% 24 Missing and 8 partials ⚠️
src/inspector_js_api.cc 78.26% 3 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #65397      +/-   ##
==========================================
- Coverage   90.14%   90.12%   -0.02%     
==========================================
  Files         752      752              
  Lines      251870   251889      +19     
  Branches    47365    47353      -12     
==========================================
- Hits       227037   227021      -16     
- Misses      16177    16205      +28     
- Partials     8656     8663       +7     
Files with missing lines Coverage Δ
src/inspector_agent.h 100.00% <100.00%> (ø)
src/inspector_js_api.cc 84.09% <78.26%> (+7.07%) ⬆️
src/inspector_agent.cc 81.81% <52.94%> (+0.89%) ⬆️

... and 44 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@joyeecheung joyeecheung added the request-ci Add this label to start a Jenkins CI on a PR. label Aug 19, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Aug 19, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants