node-api: clear the pending exception before handling it #67448
All Vouch review confidence checks passed
Residual risk 0.12 = Change Risk (0.38) × (1 − Review Confidence (0.68)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.38 · 167 lines diff across 4 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.56 · 5 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 50%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.307
Real PR Conversation Timeline
9 items
Review requested:
Codecov Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 90.69%. Comparing base (
7b4c9e3) to head (072d521).:warning: Report is 343 commits behind head on main.
<details><summary>Additional details and impacted files</summary>
@@ Coverage Diff @@
## main #67448 +/- ##
==========================================
- Coverage 90.71% 90.69% -0.02%
==========================================
Files 801 801
Lines 281889 281890 +1
Branches 54315 54318 +3
==========================================
- Hits 255709 255664 -45
- Misses 16307 16366 +59
+ Partials 9873 9860 -13
| Files with missing lines | Coverage Δ | |
|---|---|---|
| src/js\_native\_api\_v8.h | 90.98% <100.00%> (+0.07%) | :arrow_up: |
... and 36 files with indirect coverage changes
</details>
<details><summary> :rocket: New features to boost your workflow: </summary>
</details>
The aarch64-linux: with shared openssl-fips failure is in test-fs-stat-cancel-inflight, which is unrelated to this change and is being deflaked in #67449.
Approved
Approved these changes.
Approved
Approved these changes.
Landed in 0089699ae34df258b1e47ee3fd1e1bee5a08cf40
jasnell
manusingh090
CallIntoModule()resetlast_exceptiononly afterhandle_exception()returned. Whenhandle_exception()reports the exception through'uncaughtException', the listener runs while the exception is still pending, so calling back into the module from it saw the same exception again:gc()in an experimental module reported it a second time, which aborted the process with "Re-entrant uncaught exception detected" (the case in the issue).napi_pending_exceptionand rethrew the old exception. This also happens with non-experimental modules (Node-API 10).This takes the exception out of
last_exceptionbefore handling it.The new test covers both cases. Without the fix it aborts with the error from the issue and rethrows the stale exception. With it, it passes, as do the existing
node-apiandjs-native-apitests.Fixes: https://github.com/nodejs/node/issues/67421
Assisted-by: a coding agent