Skip to content

fix: Recover from a crash more gracefully#3440

Merged
FrederikBolding merged 3 commits intomainfrom
fb/recover-from-crash-more-gracefully
Jun 5, 2025
Merged

fix: Recover from a crash more gracefully#3440
FrederikBolding merged 3 commits intomainfrom
fb/recover-from-crash-more-gracefully

Conversation

@FrederikBolding
Copy link
Copy Markdown
Member

@FrederikBolding FrederikBolding commented Jun 5, 2025

The current behavior for stopping Snaps (in case of crashes or idling) was prone to race conditions when requests to the Snap were dispatched around the time that the Snap crashed.

We saw this in production here: MetaMask/metamask-extension#33411

To prevent this, we can turn the stopping flag into a promise that we can await in case of multiple calls to stopSnap, but also before considering whether the Snap is started for a subsequent request.

@FrederikBolding FrederikBolding marked this pull request as ready for review June 5, 2025 09:51
@FrederikBolding FrederikBolding requested a review from a team as a code owner June 5, 2025 09:51
@codecov
Copy link
Copy Markdown

codecov bot commented Jun 5, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.16%. Comparing base (79481f9) to head (ff0ab6c).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3440   +/-   ##
=======================================
  Coverage   98.16%   98.16%           
=======================================
  Files         402      402           
  Lines       11123    11128    +5     
  Branches     1759     1760    +1     
=======================================
+ Hits        10919    10924    +5     
  Misses        204      204           

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@FrederikBolding FrederikBolding added this pull request to the merge queue Jun 5, 2025
Merged via the queue into main with commit 8bdbb3b Jun 5, 2025
118 checks passed
@FrederikBolding FrederikBolding deleted the fb/recover-from-crash-more-gracefully branch June 5, 2025 10:32
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.

2 participants