Skip to content

Correctly invoke async router callback asynchronously - #4891

Closed
lqqyt2423 wants to merge 3 commits into
expressjs:4.18from
lqqyt2423:master
Closed

Correctly invoke async router callback asynchronously#4891
lqqyt2423 wants to merge 3 commits into
expressjs:4.18from
lqqyt2423:master

Conversation

@lqqyt2423

Copy link
Copy Markdown

Sometimes this error occurs:
RangeError: Maximum call stack size exceeded

This pull request can fix the error.

@dougwilsondougwilson left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Please add a test case or leave in the pr a demo of the issue and we can make it in to a test case.

@lqqyt2423

Copy link
Copy Markdown
Author

@dougwilson Please see the new commit

@dougwilsondougwilson mentioned this pull request Apr 13, 2022
20 tasks
@dougwilson

Copy link
Copy Markdown
Contributor

Great, thank you! Would you be willing to open the same PR over at https://github.com/pillarjs/router ?

Comment threadlib/router/index.js
}

// max sync stack
if (++sync > 100) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without looking at the current v8 stack frames, there is no way to know if you still have 100 frames left to use. Also params will add/remove to how many frames are used in each iteration, I wouldn't think. How did you come up with the number 100 for this?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dougwilson
dougwilson changed the base branch from master to 4.18April 14, 2022 03:13
@lqqyt2423

Copy link
Copy Markdown
Author

@dougwilson router repo already fixed it: pillarjs/router@e96ebf5

I have a new commit to fix stack overflow with a large sync stack: 538a789

@dougwilson

Copy link
Copy Markdown
Contributor

Ah, I guess we didn't port that over, lol! Thanks for pointing that out. I'll port that commit over to 4.18 🎉

dougwilson added a commit that referenced this pull request Apr 14, 2022
@expressjsexpressjs deleted a comment from nicokaiserMay 20, 2022
@expressjsexpressjs locked as resolved and limited conversation to collaborators May 20, 2022
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@lqqyt2423@dougwilson