Skip to content
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/Drop the js stacktrace when k6 panics during js execution #1906

Closed
mstoykov opened this issue Mar 15, 2021 · 0 comments
Closed

Fix/Drop the js stacktrace when k6 panics during js execution #1906

mstoykov opened this issue Mar 15, 2021 · 0 comments
Labels
bug evaluation needed proposal needs to be validated or tested before fully implementing it in k6

Comments

@mstoykov
Copy link
Contributor

After #1697 we had a way to get the location of panic in js code in the form of a js stacktrace from goja ... or so we thought.

As explained in dop251/goja#179 (comment) this apparently hasn't really worked, to begin with, and I don't remember it actually being used in practice ... the whole panic wrapping is mostly a precaution on a super rare bug we have not been able to identify or fix. Even dop251/goja#214 wasn't actually caught with that even though the catching of the panics would've prevented it from killing k6.

For all we know that one issue could've been fixed in the meantime either by us or goja update 🤷‍♂️

The only way to fix it (as explained in the comment linked above) is for the golang code that panics to catch that and repanic with the goja stack at that time before it actually got unwinded. Doing this for each call ... will be very error-prone IMO and adding it to the bridge's Bind will not cover all cases.

Either way that adds at least 1 more defer per each call, which also will have some performance implications, although I doubt they will be ... big enough.

I am currently of the opinion that we should just drop the stack and if we start having problems where that would be useful again, to readd them then.

Alternatively maybe some discussion on whether goja can not unwind its stack for this case would be good ... although probably that will be quite a big change.

@mstoykov mstoykov added bug evaluation needed proposal needs to be validated or tested before fully implementing it in k6 labels Mar 15, 2021
mstoykov added a commit that referenced this issue May 20, 2024
This has been broken for years after some goja refactoring.

There doesn't seem to be a way for this to be fixed without a lot of
boilerplate all over the code. And this functionality has not been used
in the last few years in my experience.

closes #1906
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug evaluation needed proposal needs to be validated or tested before fully implementing it in k6
Projects
None yet
Development

No branches or pull requests

1 participant