-
-
Notifications
You must be signed in to change notification settings - Fork 34.2k
Closed
Labels
confirmed-bugIssues with confirmed bugs.Issues with confirmed bugs.consoleIssues and PRs related to the console subsystem.Issues and PRs related to the console subsystem.
Description
Version
v22.5.1
Platform
Linux jfhr-ms7c80 6.1.0-18-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.76-1 (2024-02-01) x86_64 GNU/Linux
Subsystem
console
What steps will reproduce the bug?
demo.js:
console.time('bunch-of-stuff')
console.timeEnd('bunch-of-stuff')run:
node --frozen-intrinsics demo.js
How often does it reproduce? Is there a required condition?
This always reproduces as far as I can tell. It is caused by the console.timeEnd / console.timeLog implementation
What is the expected behavior? Why is that the expected behavior?
Expected behavior is what happens when running without --frozen-intrinsics:
$ node demo.js
bunch-of-stuff: 0.061ms
What do you see instead?
$ node --frozen-intrinsics demo.js
node:internal/console/constructor:418
this[kInternalTimeLogImpl] = FunctionPrototypeBind(timeLogImpl, this);
^
TypeError <Object <Object <[Object: null prototype] {}>>>: Cannot add property Symbol(kInternalTimeLogImpl), object is not extensible
at console.timeLog (node:internal/console/constructor:418:34)
at Object.<anonymous> (/home/jfhr/source/demo.js:2:9)
at Module._compile (node:internal/modules/cjs/loader:1504:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1588:10)
at Module.load (node:internal/modules/cjs/loader:1282:32)
at Module._load (node:internal/modules/cjs/loader:1098:12)
at TracingChannel.traceSync (node:diagnostics_channel:315:14)
at wrapModuleLoad (node:internal/modules/cjs/loader:215:24)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:158:5)
at node:internal/main/run_main_module:30:49
Node.js v22.5.1
Additional information
The first call to console.timeEnd / console.timeLog tries to write to this[kInternalTimeLogImpl] (see console/constructor.js) which fails if this is frozen. This property stores the timeLog implementation that is passed to util/debuglog.
Perhaps a WeakMap could be used to store the timeLog implementation instead of a writable private property?
Metadata
Metadata
Assignees
Labels
confirmed-bugIssues with confirmed bugs.Issues with confirmed bugs.consoleIssues and PRs related to the console subsystem.Issues and PRs related to the console subsystem.