GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||
GeezerVison is showing github.com — util: recover from maximum call stack size by BridgeAR · Pull Request #20725 · nodejs/node Conversation
Member
Using util.inspect should still return values in case the maximum Checklist
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Member
Author
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
addaleax
approved these changes
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. LGTM if it doesn’t affect the benchmarks negatively
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
apapirovski
approved these changes
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. LGTM
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
TimothyGu
approved these changes
mscdex
previously requested changes
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think at the very least this should be a separate option for If the user wants to explicitly opt-in to this behavior, that's fine because then they know what they could be getting into at that point.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Member
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Member
Author
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Member
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
|
There was an error while loading. Please reload this page.
|
I had another look at this and found a solution that does not show the regression.
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
a743cbc to
630360c
Compare
|
Benchmark: https://ci.nodejs.org/view/Node.js%20benchmark/job/benchmark-node-micro-benchmarks/199/ |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
The benchmarks clearly show no regression (it will only effect very deeply nested objects - if at all). I believe the user experience is better by returning a value instead of throwing. Inspecting any deeper will not provide a result that would still be really useful. @mscdex are you strongly -1 on this? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I think this will help new users.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
I am -0.5 on this. In real-world applications that I've seen issues like this, even if the stack overflow doesn't happen, the process may run out of memory because of the complexity of the object. String concatenation in V8 is memory-expensive (each |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@joyeecheung the max stack size with be exceeded much much before the heap memory is. When I ran a different implementation that was recovering from the max stack size I was able to inspect a depth of almost 100.000. This will end inspection at a depth of ~1500 for the very simple case and earlier for more complex cases. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
IIUC, this ends the inspection early in the sense that it will return the formatted subtree to be concatenated later, it does not mean that the whole inspection process will end once the formatter finds one deep subtree in the object, so more memory will be consumed if the object is not skewed (containing multiple deep subtrees). |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@joyeecheung that is correct but a very unlikely case. To have a object like this will likely cause problems one way or the other. The problem you speak about should be solved with #19994. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I'm +1 on this as this is a debugging tool. Returning something is better than the stack-overflow.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Just in case we start getting into vote-counting territory for the TSC (since it does seem unlikely that the impasse here will be resolved):
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
(UPDATE: I'll be updating the preliminary vote counts as TSC people weigh in.) Since this is at an impasse that seems unlikely to be resolved, I think calling for a vote at this time is appropriate. The way things stand now, as I see it at least:
There are 18 TSC members total, so this will require participation by at least another 2 TSC members to achieve a resolution. @nodejs/tsc |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@joyeecheung I did consider it but we already have a lot of options for |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
This seems like reasonable behavior to me
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
I am not +1 but I would not block this. We can see how the users react to this in the wild and revert if necessary. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
LGTM but I would like Anna's suggestion to be implemented before landing
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
To break the impasse, we had a vote in the TSC meeting today. This PR can land (assuming green CI). Vote results:
Votes add up to 14 rather than 18 because 4 members were not involved in the vote:
I'll remove the |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Using util.inspect should still return values in case the maximum call stack size is reached. This is important to inspect linked lists and similar.
8214e97 to
7748619
Compare
|
I just pushed the requested change @addaleax |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Dimissing the review due to the TSC vote.
|
CI again: https://ci.nodejs.org/job/node-test-pull-request/15382/ |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
CI again 2: https://ci.nodejs.org/job/node-test-pull-request/15577/ ✔️ |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Landed in b26506b |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Using util.inspect should still return values in case the maximum call stack size is reached. This is important to inspect linked lists and similar. PR-URL: #20725 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Anatoli Papirovski <[email protected]> Reviewed-By: Tiancheng "Timothy" Gu <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Ali Ijaz Sheikh <[email protected]> Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: Daniel Bevenius <[email protected]> Reviewed-By: Sakthipriyan Vairamani <[email protected]> Reviewed-By: Jeremiah Senkpiel <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: James M Snell <[email protected]>
Using util.inspect should still return values in case the maximum call stack size is reached. This is important to inspect linked lists and similar. PR-URL: #20725 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Anatoli Papirovski <[email protected]> Reviewed-By: Tiancheng "Timothy" Gu <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Ali Ijaz Sheikh <[email protected]> Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: Daniel Bevenius <[email protected]> Reviewed-By: Sakthipriyan Vairamani <[email protected]> Reviewed-By: Jeremiah Senkpiel <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: James M Snell <[email protected]>
Notable changes:
* build:
* Node.js should now be about 60% faster to startup than the previous version,
thanks to the use V8's code cache feature for core modules. [#21405](#21405)
* dns:
* An experimental promisified version of the dns module is now available. Give
it a try with `require('dns').promises`. [#21264](#21264)
* fs:
* `fs.lchown` has been undeprecated now that libuv supports it. [#21498](#21498)
* lib:
* `Atomics.wake` is being renamed to `Atomics.notify` in the ECMAScript
specification ([reference](tc39/ecma262#1220)).
Since Node.js now has experimental support for worker threads, we are being
proactive and added a `notify` alias, while emitting a warning if
`wake` is used. [#21413](#21413) [#21518](#21518)
* n-api:
* Add API for asynchronous functions. [#17887](#17887)
* util:
* `util.inspect` is now able to return a result instead of throwing when the
maximum call stack size is exceeded during inspection. [#20725](#20725)
* vm:
* Add `script.createCachedData()`. This API replaces the `produceCachedData`
option of the `Script` constructor that is now deprecated. [#20300](#20300)
* worker:
* Support for relative paths has been added to the `Worker` constructor. Paths
are interpreted relative to the current working directory. [#21407](#21407)
PR-URL: #21629
Notable changes:
* dns:
* An experimental promisified version of the dns module is now available. Give
it a try with `require('dns').promises`. [#21264](#21264)
* fs:
* `fs.lchown` has been undeprecated now that libuv supports it. [#21498](#21498)
* lib:
* `Atomics.wake` is being renamed to `Atomics.notify` in the ECMAScript
specification ([reference](tc39/ecma262#1220)).
Since Node.js now has experimental support for worker threads, we are being
proactive and added a `notify` alias, while emitting a warning if
`wake` is used. [#21413](#21413) [#21518](#21518)
* n-api:
* Add API for asynchronous functions. [#17887](#17887)
* util:
* `util.inspect` is now able to return a result instead of throwing when the
maximum call stack size is exceeded during inspection. [#20725](#20725)
* vm:
* Add `script.createCachedData()`. This API replaces the `produceCachedData`
option of the `Script` constructor that is now deprecated. [#20300](#20300)
* worker:
* Support for relative paths has been added to the `Worker` constructor. Paths
are interpreted relative to the current working directory. [#21407](#21407)
PR-URL: #21629
Notable changes:
* dns:
* An experimental promisified version of the dns module is now available. Give
it a try with `require('dns').promises`. [#21264](#21264)
* fs:
* `fs.lchown` has been undeprecated now that libuv supports it. [#21498](#21498)
* lib:
* `Atomics.wake` is being renamed to `Atomics.notify` in the ECMAScript
specification ([reference](tc39/ecma262#1220)).
Since Node.js now has experimental support for worker threads, we are being
proactive and added a `notify` alias, while emitting a warning if
`wake` is used. [#21413](#21413) [#21518](#21518)
* n-api:
* Add API for asynchronous functions. [#17887](#17887)
* util:
* `util.inspect` is now able to return a result instead of throwing when the
maximum call stack size is exceeded during inspection. [#20725](#20725)
* vm:
* Add `script.createCachedData()`. This API replaces the `produceCachedData`
option of the `Script` constructor that is now deprecated. [#20300](#20300)
* worker:
* Support for relative paths has been added to the `Worker` constructor. Paths
are interpreted relative to the current working directory. [#21407](#21407)
PR-URL: #21629
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.