-
Notifications
You must be signed in to change notification settings - Fork 107
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
Provide more context on infinites recursion #230
Comments
We can add the stack to clocks when they are captured and show it on the clock when this is thrown - though this will be really expensive CPU wise (taking a ton of stack traces). I'm open to other ideas. |
What about, after reaching |
So:
Sounds useful/good to me and like it should solve the 95% case. |
Yeah, that sounds reasonable to me! Potentially start with just a single stack instead of 10, not sure? Changing that threshold is simple once the logic is in place though, so not something we need to spend time on deciding now |
Wait, no - not this. If |
Yeah, that |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Use stack information for jobs and timers to provide more context when an infinite loop error is thrown. Fixes sinonjs#230
Put up PR #325 to add stack trace output for the next excess job to be run - let me know if you think that's the right direction for solving this issue |
Use stack information for jobs and timers to provide more context when an infinite loop error is thrown. Fixes sinonjs#230
Use stack information for jobs and timers to provide more context when an infinite loop error is thrown. Fixes sinonjs#230
Use stack information for jobs and timers to provide more context when an infinite loop error is thrown. Fixes sinonjs#230
Use stack information for jobs and timers to provide more context when an infinite loop error is thrown. Fixes sinonjs#230 Add flag for approaching infinite loop Use a flag when approaching infinite loop detection which will enable an error object to be attached to the job, which can then be used for generating the stack output. Update for PR feedback - Safely update stack property using `defineProperty`, wrapped in try/catch - Tests for more clock functions to confirm stack trace provided - Stack trace slice automatically calculated based on clock function position Remove unnecessary durations and use globals - Use global setInterval and setImmediate to match setTimeout use - Remove unnecessary duration parameter from setImmediate and setImmediate add use of prettier Firefox and Chrome tests pass after RegExp fix Chrome shows stack messages differently, and uses the words: 'at' and 'Object', Firefox does not - that has created two problems: first, the stack trace messages that are shown to the user are a bit different (Firefox always has at least one more line at the start of the stack list - usually internal functions that are not supposed to appear). Second, the RegExp tried to match parts of the strings that only exist in Chrome, failing the Firefox tests) prettier used
) * Add stack trace to code recursively scheduling timers Use stack information for jobs and timers to provide more context when an infinite loop error is thrown. Fixes #230 Add flag for approaching infinite loop Use a flag when approaching infinite loop detection which will enable an error object to be attached to the job, which can then be used for generating the stack output. Update for PR feedback - Safely update stack property using `defineProperty`, wrapped in try/catch - Tests for more clock functions to confirm stack trace provided - Stack trace slice automatically calculated based on clock function position Remove unnecessary durations and use globals - Use global setInterval and setImmediate to match setTimeout use - Remove unnecessary duration parameter from setImmediate and setImmediate add use of prettier Firefox and Chrome tests pass after RegExp fix Chrome shows stack messages differently, and uses the words: 'at' and 'Object', Firefox does not - that has created two problems: first, the stack trace messages that are shown to the user are a bit different (Firefox always has at least one more line at the start of the stack list - usually internal functions that are not supposed to appear). Second, the RegExp tried to match parts of the strings that only exist in Chrome, failing the Firefox tests) prettier used * small RegExp fix for node env + linting * improving test-coverage statistics * at attempt to ignore certain condition in nyc coverage Co-authored-by: Alistair Brown <[email protected]>
What did you expect to happen?
See jestjs/jest#2893 for details.
Tl;dr: Right now Lolex just throws an error if it thinks we're in an infinite loop of timers (timers scheduling new timers). This comes from here: https://github.com/sinonjs/lolex/blob/29b4ecc8bd186584ab4139341f3128a4349463ba/lolex.js#L210
It would be nice if the message thrown included a stack trace back to the code actually scheduling timers
What actually happens
An error without context
How to reproduce
https://runkit.com/embed/jqyax6pkc5bq
The text was updated successfully, but these errors were encountered: