Repository navigation
module: fix require(esm) error annotation with tracing subscriber - #66930
CodingRule wants to merge 1 commit into
Conversation
|
Review requested:
|
|
Welcome to Node.js, and thank you for your first contribution! Before review, please take a moment to read:
Please make sure every commit is signed off. For a first pull request, GitHub Actions require collaborator approval and Jenkins CI must be started by a collaborator or triager, so an initial wait is normal. |
The Pull requests > Step 6: Test say:
This is only possible if you have a local environment set up according to Building Node.js on supported platforms. |
reconstructErrorStack() took the first stack frame as the caller, but with a module.require tracing subscriber that frame is TracingChannel.traceSync, so the arrow pointed at a nonexistent line of the parent file. Pick the first frame that belongs to the parent. Fixes: nodejs#55350 Signed-off-by: CodingRule <ioumih32@gmail.com>
8dd31df to
60ad87b
Compare
|
@MikeMcC399 thanks for pointing that out. I've since set up the Windows toolchain (VS 2022 + ClangCL) and run it locally on a build from this branch:
Updated the PR description accordingly. |
|
https://github.com/nodejs/node/blob/main/BUILDING.md#building-nodejs-2 Tip On Windows, creating symlinks requires Developer Mode to be enabled or running the command as Administrator. Tests that rely on creating symlinks may fail with EPERM errors if symlink creation is not permitted. |
reconstructErrorStack()takes the first stack frame as therequire()caller. When amodule.requiretracing subscriber exists, that frame isTracingChannel.traceSync, so the arrow points at a nonexistent line of the parent file:Pick the first frame that belongs to the parent file instead. Works for nested callers too (the first parent frame is the
require()call site).Adds a test case with a
tracing:module.require:startsubscriber; it fails on currentmainand passes with this change.Fixes: #55350
AI disclosure
This change was made with help from an AI coding assistant (Claude Mythos 5.1). I reviewed the diff and the reasoning behind it myself.
What was verified:
tracing:module.require:startsubscriber: the arrow points attest.cjs:568withundefined.reconstructErrorStack()from both the original and patchedloader.jsagainst real stacks captured from the nightly, in four shapes: plain, with subscriber, nested callers, nested with subscriber. The patched version annotates therequire()call site in all four. The original fails in both subscriber cases.tools/eslinton both files with--max-warnings=0.vcbuild x64 release openssl-no-asm):test/es-module/test-cjs-esm-warn.jspasses 3/3 on the built binary.tools/test.py, 7281 tests): 56 failures, 55 of which fail identically on an unmodified nightly on the same machine (Windows symlink privilege, child_process shell, TLS CA, fs symlink/cp). The other,test-http-outgoing-end-cork, timed out under load and passes 10/10 in isolation on both binaries.I'll follow up on review feedback myself.