Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

async_hooks,doc: cache process.stdout.fd outside init #38382

Conversation

RaisinTen
Copy link
Contributor

This stops "RangeError: Maximum call stack size exceeded".

node -v
v15.2.0node --trace-uncaught before.js
node:internal/async_hooks:204
    fatalError(e);
    ^

RangeError: Maximum call stack size exceeded
Thrown at:
    at emitInitNative (node:internal/async_hooks:204:5)
    at WriteStream (node:tty:91:15)
    at createWritableStdioStream (node:internal/bootstrap/switches/is_main_thread:47:16)
    at getStdout (node:internal/bootstrap/switches/is_main_thread:122:12)
    at init (/home/raisinten/Desktop/universe/temp/project/before.js:8:15)
    at emitInitNative (node:internal/async_hooks:197:43)
    at WriteStream (node:tty:91:15)
    at createWritableStdioStream (node:internal/bootstrap/switches/is_main_thread:47:16)
    at getStdout (node:internal/bootstrap/switches/is_main_thread:122:12)
    at init (/home/raisinten/Desktop/universe/temp/project/before.js:8:15)echo $?
7node --trace-uncaught after.js
TCPSERVERWRAP(2): trigger: 1 execution: 1
TickObject(3): trigger: 2 execution: 1
^C

This stops "RangeError: Maximum call stack size exceeded".
@nodejs-github-bot nodejs-github-bot added async_hooks Issues and PRs related to the async hooks subsystem. doc Issues and PRs related to the documentations. labels Apr 24, 2021
@RaisinTen
Copy link
Contributor Author

cc @puzpuz as this reverts #34829

@aduh95
Copy link
Contributor

aduh95 commented Apr 24, 2021

What if you cache the value outside the loop?

const { fd } = process.stdout;

@RaisinTen RaisinTen changed the title async_hooks,doc: replace process.stdout.fd with 1 async_hooks,doc: cache process.stdout.fd outside init Apr 24, 2021
@RaisinTen
Copy link
Contributor Author

@aduh95 That works too. PTAL. :)

doc/api/async_hooks.md Outdated Show resolved Hide resolved
@RaisinTen RaisinTen added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Apr 25, 2021
@jasnell
Copy link
Member

jasnell commented Apr 26, 2021

Landed in 91d1b60

jasnell pushed a commit that referenced this pull request Apr 26, 2021
This stops "RangeError: Maximum call stack size exceeded".

PR-URL: #38382
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
@jasnell jasnell closed this Apr 26, 2021
@RaisinTen RaisinTen deleted the async_hooks,doc/replace-process.stdout.fd-with-1 branch April 27, 2021 14:10
targos pushed a commit that referenced this pull request Apr 29, 2021
This stops "RangeError: Maximum call stack size exceeded".

PR-URL: #38382
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
@targos targos mentioned this pull request May 3, 2021
targos pushed a commit that referenced this pull request May 30, 2021
This stops "RangeError: Maximum call stack size exceeded".

PR-URL: #38382
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
targos pushed a commit that referenced this pull request Jun 5, 2021
This stops "RangeError: Maximum call stack size exceeded".

PR-URL: #38382
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
targos pushed a commit that referenced this pull request Jun 5, 2021
This stops "RangeError: Maximum call stack size exceeded".

PR-URL: #38382
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
targos pushed a commit that referenced this pull request Jun 11, 2021
This stops "RangeError: Maximum call stack size exceeded".

PR-URL: #38382
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
async_hooks Issues and PRs related to the async hooks subsystem. author ready PRs that have at least one approval, no pending requests for changes, and a CI started. doc Issues and PRs related to the documentations.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants