metamask-extension icon indicating copy to clipboard operation
metamask-extension copied to clipboard

Self-reload extension on startup error

Open aorlovskiy opened this issue 1 year ago • 1 comments

What is this about?

When the user manually updates the extension, they are almost guaranteed to get an error on startup because of chromium issue:

Background connection unresponsive

Based on existing cases, reloading the extension solves this issue in 100% of cases, and since this is the majority of our "infinite spinner" events - we want to implement a workaround and not wait for the chromium fix

Possible solution 1: When this error is detected on startup - catch it and immediately reload the extension Challenge: To make sure we are not introducing an infinite reload loop in place of an infinite spinner

Possible solution 2: Outlined in this thread: https://consensys.slack.com/archives/CBHSSFEN5/p1756898354877439 0. track all connected ports in a Set

  1. first, have the SW tell all connected ports to stop talking to it; and make sure they don't try to reconnect (I deleted this code recently, but I suspect that I'll need to add it back, as I've recently saw the old reconnection logic being used via someone's logs)
  2. disconnect all Ports
  3. wait 50ms
  4. run chrome.runtime.reload();

TODO:

  1. Investigate if either of the solutions are feasible, starting with 2 - or suggest an alternative
  2. Implement the chosen solution

Actual solution: Catch chrome event "The app was updated" and always reload once after it happens

Scenario

No response

Design

No response

Technical Details

No response

Threat Modeling Framework

No response

Acceptance Criteria

No response

Stakeholder review needed before the work gets merged

  • [ ] Engineering (needed in most cases)
  • [ ] Design
  • [ ] Product
  • [ ] QA (automation tests are required to pass before merging PRs but not all changes are covered by automation tests - please review if QA is needed beyond automation tests)
  • [ ] Security
  • [ ] Legal
  • [ ] Marketing
  • [ ] Management (please specify)
  • [ ] Other (please specify)

References

No response

aorlovskiy avatar Sep 23 '25 16:09 aorlovskiy

https://github.com/MetaMask/metamask-extension/issues/36248

ngalee8311 avatar Sep 25 '25 18:09 ngalee8311