-
-
Notifications
You must be signed in to change notification settings - Fork 18
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
fix: prevent 'Maximum call stack size exceeded' error #204
base: master
Are you sure you want to change the base?
Conversation
cc @mcollina |
this._parallel(this, matches, message, callback) | ||
setImmediate( | ||
this._parallel.bind(this, this, matches, message, callback) | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding a setImmediate here will definitely cripple the performance of this module. A different solution is needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestions? process.nextTick ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something way more convoluted. We should test if this was called in the same tick more than x times and then use setImmediate just in that case.
Can you please add a test where this crash happens? |
I will try, I made it happen while using aedes on very high loads. Could I even do it in a separete file? I mean one that doesn't run with the test suite |
anything works, we can embed in the test suite later |
@mcollina I dunno why but I cannot reproduce this anymore in my repo even in the benchmark with high loads, keep this open for now if you want, will do some more tests in next days |
On very high loads mqemitter
_do
could throwMaximum call stack size exceeded
error, usingsetImmediate
to allow nodejs to clear the stack fixes it