-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Using bluebird.couroutine for async generator via babel stores tons of error stack traces in closure #1632
Comments
It's there as a debugging tool in order to provide long stack traces in production when an exception is thrown. You can disable it by building bluebird with stack traces false or setting |
thanks for the response. @benjamingr we have that value set to false and it is still generating these error traces. looking at this line of code where the problem is occuring on line 199 below: Lines 191 to 209 in 49da1ac
It doesn't appear to take the value of longStackTraces into account here and it is indiscriminately creating them in the coroutine function.
|
Are you generating a lot of You are expected to call Promise.coroutine on your methods (on the prototype) and then calling those methods - this leads to a low amount of captured stack traces (and low overhead). You can use |
@benjamingr okay interesting... so this might actually be an issue with this babel plugin https://babeljs.io/docs/en/babel-plugin-transform-async-to-generator We're seeing it call this |
@benjamingr we've forked this in the meantime to have that stack trace behind the wondering if that would be a worthwhile addition to the |
@petkaantonov wdyt? ^ This sounds rather reasonable. |
(This issue tracker is only for bug reports or feature requests, if this is neither, please choose appropriate channel from http://bluebirdjs.com/docs/support.html)
Please answer the questions the best you can:
What version of bluebird is the issue happening on?
All versions
What platform and version? (For example Node.js 0.12 or Google Chrome 32)
All platforms and versions
(Write description of your issue here, stack traces from errors and code that reproduces the issue are helpful)
Was digging into some memory profiling, and noticed that bluebird's coroutine creates a stack trace
bluebird/src/generators.js
Line 199 in 49da1ac
In our case, we are leveraging the
@babel/plugin-transform-async-to-generator
plugin and have thousands of these error messages generated during runtime from the source code line above. This is amounting to dozens of extra megabytes on the JS heap that seem like they can be avoided. Can open a PR or otherwise resolve, but wanted to check first the reasoning for generating the error stack at this point, and if it can be behind a flag or otherwise how to prevent this memory issue?The text was updated successfully, but these errors were encountered: