Skip to content

Fix calling build_backtrace too often #906

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

Merged
merged 1 commit into from
Feb 10, 2025

Conversation

bnoordhuis
Copy link
Contributor

Bug introduced in commit 4c32c53 from late last month.

When unwinding the stack, call build_backtrace only when the exception object doesn't already have a .stack property, like how it was before commit 4c32c53.

Fixes: #904

Bug introduced in commit 4c32c53 from late last month.

When unwinding the stack, call build_backtrace only when the exception
object doesn't already have a .stack property, like how it was before
commit 4c32c53.

Fixes: quickjs-ng#904
Error.prepareStackTrace = function() { calls++ }
function f() { f() }
assertThrows(RangeError, f)
assert(calls, 0)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The fact the number of calls is zero instead of one is currently more or less by accident but in the case of stack overflow that's the desired behavior IMO (no JS calls) and I have an upcoming pull request that makes that intentional.

@bnoordhuis bnoordhuis merged commit 55db71e into quickjs-ng:master Feb 10, 2025
59 checks passed
@bnoordhuis bnoordhuis deleted the fix904 branch February 10, 2025 22:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

build_backtrace called too often on stack unwinding
2 participants