Skip to content

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

Closed
RaisinTen wants to merge 3 commits into
nodejs:masterfrom
RaisinTen:async_hooks,doc/replace-process.stdout.fd-with-1
Closed

async_hooks,doc: cache process.stdout.fd outside init#38382
RaisinTen wants to merge 3 commits into
nodejs:masterfrom
RaisinTen:async_hooks,doc/replace-process.stdout.fd-with-1

Conversation

@RaisinTen

Copy link
Copy Markdown
Member

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

Details
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 Node.js documentation. labels Apr 24, 2021
@RaisinTen

Copy link
Copy Markdown
Member Author

cc @puzpuz as this reverts #34829

@aduh95

aduh95 commented Apr 24, 2021

Copy link
Copy Markdown
Contributor

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
Copy Markdown
Member Author

@aduh95 That works too. PTAL. :)

Comment thread doc/api/async_hooks.md Outdated
@RaisinTen RaisinTen added the author ready PRs with CI started, the required approvals, and no outstanding review comments. label Apr 25, 2021
@jasnell

jasnell commented Apr 26, 2021

Copy link
Copy Markdown
Member

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 with CI started, the required approvals, and no outstanding review comments. doc Issues and PRs related to Node.js documentation.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants