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

Don't print empty goja stacktraces on captured panics #3749

Merged
merged 1 commit into from
May 22, 2024

Conversation

mstoykov
Copy link
Contributor

What?

Stop printing an empty stacktrace of goja when capturing panics.

Why?

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.

Checklist

  • I have performed a self-review of my code.
  • I have added tests for my changes.
  • I have run linter locally (make lint) and all checks pass.
  • I have run tests locally (make tests) and all tests pass.
  • I have commented on my code, particularly in hard-to-understand areas.

Related PR(s)/Issue(s)

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
@mstoykov mstoykov added this to the v0.52.0 milestone May 20, 2024
@mstoykov mstoykov requested a review from a team as a code owner May 20, 2024 15:16
@mstoykov mstoykov requested review from oleiade and joanlopez and removed request for a team May 20, 2024 15:16
@@ -65,21 +65,15 @@ func ToString(data interface{}) (string, error) {
}

// RunWithPanicCatching catches panic and converts into an InterruptError error that should abort a script
func RunWithPanicCatching(logger logrus.FieldLogger, rt *goja.Runtime, fn func() error) (err error) {
func RunWithPanicCatching(logger logrus.FieldLogger, _ *goja.Runtime, fn func() error) (err error) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I specifically skipped on cleaning this up as it is currently in js/common package and I didn't want to introduce a potential breaking change.

Depending on the decision from #3748 we might delete it.

If we decided against it - I will probably want to move this off common and in hte js package as I don't think this is functionality anyone but k6 should have.

@codecov-commenter
Copy link

codecov-commenter commented May 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 70.85%. Comparing base (153e0e5) to head (a5f082c).

Current head a5f082c differs from pull request most recent head 3723047

Please upload reports for the commit 3723047 to get more accurate results.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #3749   +/-   ##
=======================================
  Coverage   70.85%   70.85%           
=======================================
  Files         289      289           
  Lines       21159    21156    -3     
=======================================
- Hits        14992    14991    -1     
+ Misses       5210     5208    -2     
  Partials      957      957           
Flag Coverage Δ
ubuntu 70.78% <100.00%> (-0.02%) ⬇️
windows 70.71% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@joanlopez
Copy link
Contributor

This has been broken for years after some goja refactoring.

Do you mean that gojaStack is always empty? 🤔

@mstoykov
Copy link
Contributor Author

yes @joanlopez - have you noticed something different when there is a panic ?

@mstoykov mstoykov merged commit f947acb into master May 22, 2024
23 checks passed
@mstoykov mstoykov deleted the dropGojaStackCatching branch May 22, 2024 12:46
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.

4 participants