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 stack trace on worklet factory crash #5197

Merged
merged 10 commits into from
Oct 27, 2023

Conversation

tjzel
Copy link
Collaborator

@tjzel tjzel commented Oct 6, 2023

Summary

Fixes #5165

Since a worklet factory doesn't have it's counterpart in source code, when it crashes we can get a useless stack trace. It can crash when a variable that doesn't exists is referenced - since it's pulled into the worklet's factory closure. This PR fixes the stack trace on such crashes.

Test plan

Snippet that forces the factory crash
//
//
//
//
//
//

export default function EmptyExample() {
  function fooOOO() {
    'worklet';
    stackOrderAscendinggg;
  }

  return null;
}
Before After
Simulator Screenshot - iPhone 14 Pro - 2023-10-06 at 19 23 48 Simulator Screenshot - iPhone 14 Pro - 2023-10-06 at 19 23 16

@tjzel tjzel requested review from kmagiera and tomekzaw October 6, 2023 17:40
plugin/src/makeWorklet.ts Outdated Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
plugin/src/makeWorklet.ts Outdated Show resolved Hide resolved
@piaskowyk piaskowyk self-requested a review October 7, 2023 08:28
@piaskowyk
Copy link
Member

Is it possible to add tests for this feature? 🤔

@tjzel
Copy link
Collaborator Author

tjzel commented Oct 19, 2023

I can try, but this could be hacky 💻 🟢

@tjzel
Copy link
Collaborator Author

tjzel commented Oct 19, 2023

Unfortunately, after many attempts, an Example is the best I can do in this situation. 😢 @piaskowyk

@tjzel tjzel added this pull request to the merge queue Oct 27, 2023
Merged via the queue into main with commit 76d9751 Oct 27, 2023
@tjzel tjzel deleted the @tjzel/fix-stack-trace-on-worklet-factory-crash branch October 27, 2023 15:54
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.

Broken symbolication for worklet functions
3 participants