stoically / temporary-containers

Firefox Add-on that lets you open automatically managed disposable containers
https://addons.mozilla.org/firefox/addon/temporary-containers/
MIT License
852 stars 60 forks source link

Very slow start up with pinned tabs #532

Closed MoscaDotTo closed 2 years ago

MoscaDotTo commented 3 years ago

Actual behavior

When Temporary Containers are enabled and Firefox is configured to have pinned tabs, the browser initialization is delayed for quite a while

Expected behavior

The browser should not hang while trying to reload open tabs

Steps to reproduce

Create a new profile Pin 1 or more tabs Restart firefox There is a delay before old tab content is loaded and which prevents new tab content from being loaded. You can see this in the loading animation on each tab as well. On my active use profile, it persists for 15-30 seconds before loading anything, even built in pages like about:addons. Disabling temporary containers solves the issue entirely.

Notes

target.join is not a function (4) background.js:578 target.join is not a function (6) background.js:578 Uncaught (in promise) Timed out while waiting for Add-on to initialize background.js:595:23 Uncaught (in promise) Timed out while waiting for Add-on to initialize background.js:595:23 Uncaught (in promise) Timed out while waiting for Add-on to initialize background.js:595:23 Uncaught (in promise) Timed out while waiting for Add-on to initialize background.js:595:23 Uncaught (in promise) Timed out while waiting for Add-on to initialize background.js:595:23 Uncaught (in promise) Timed out while waiting for Add-on to initialize background.js:595:23 Uncaught (in promise) Timed out while waiting for Add-on to initialize background.js:595:23 Uncaught (in promise) Timed out while waiting for Add-on to initialize background.js:595:23 Uncaught (in promise) Timed out while waiting for Add-on to initialize background.js:595:23 Uncaught (in promise) Timed out while waiting for Add-on to initialize background.js:595:23 Uncaught (in promise) Timed out while waiting for Add-on to initialize background.js:595:23 Uncaught (in promise) Timed out while waiting for Add-on to initialize background.js:595:23 Uncaught (in promise) Timed out while waiting for Add-on to initialize background.js:595:23 Uncaught (in promise) Timed out while waiting for Add-on to initialize background.js:595:23 target.join is not a function (33) background.js:578 Unchecked lastError value: Error: ID already exists: remove-open-in-this-container assignManager.js:643 Unchecked lastError value: Error: ID already exists: separator assignManager.js:651 Unchecked lastError value: Error: ID already exists: hide-container assignManager.js:657 Unchecked lastError value: Error: ID already exists: move-to-new-window-container assignManager.js:663 target.join is not a function (114) background.js:578

stoically commented 3 years ago

Tried to reproduce with the given steps,

But starts instantly for me.

The fact that you see the error "Timed out while waiting for Add-on to initialize" multiple times points to the fact that something is seriously wrong with your browser. You might want to try with a stable instead of an alpha version.

MoscaDotTo commented 3 years ago

I am seeing the same behavior on a clean install and new profile on the latest stable (92.0)

image

I pinned three tabs: https://addons.mozilla.org/en-US/firefox/addon/temporary-containers/ (loads instantly but does not allow me to navigate away from amo until the other hung tabs have loaded) https://www.mozilla.org/en-US/privacy/firefox/ https://www.google.com/

opened a new tab, closed the browser, reopened the browser and it hangs

cpeterso commented 2 years ago

Here is a Firefox bug report for a similar problem: https://bugzilla.mozilla.org/show_bug.cgi?id=1734947

The Temporary Container extension blocks all network requests until it is fully initialized. A Firefox engineer skimmed the extension's code and saw that the extension's initialization code is blocking all network requests while it is waiting to query open tabs (browser.tabs.query({})) and all other installed extensions (browser.management.getAll()).

Perhaps there is some initialization dependency between pinned tabs, blocked network requests, and session restore? And the deadlock is eventually broken when some long timeout expires?

MoscaDotTo commented 2 years ago

https://bugzilla.mozilla.org/show_bug.cgi?id=1734947#c16

This is an architecture problem with the addon triggering this. We'll consider some UI to point out the problem to users, but we cannot address the problem in the addon.

stoically commented 2 years ago

@cpeterso

Thanks for the bug report pointer.

Perhaps there is some initialization dependency between pinned tabs, blocked network requests, and session restore? And the deadlock is eventually broken when some long timeout expires?

Correct. It's required to make sure that no "default container" tabs are loaded on startup.

However, the given error message is about the initialization of the Add-on as a whole timing out, not incoming requests. So actually the Add-on should not even be functional at all after that error.

@MoscaDotTo Please also see the latest comment on the bug report.

So I did disable that addon. The problem remains, but now I can't find any indicator in the UI that shows what's up.

Personally I have a bunch of pinned tabs and didn't encounter that issue yet.

MoscaDotTo commented 2 years ago

I don't think pinned tabs are strictly related to the problem, based on the other comments. But disabling temporary containers addon fixes the problem for my profile

stoically commented 2 years ago

Yeah. It seems that the mentioned Firefox API calls (bookmarks & tabs) might take a long time, which in this case is the root cause. TC is triggering the symptom, as it relies on those API calls to complete quickly, which they usually do. Though, I saw other issues here where similar odd-ish things happened, all related to Firefox API calls taking too long - and some combination of full Firefox re-install, sometimes even in combination with OS cleanup / re-install fixed it in the end. Because TC can't possibly do anything about Firefox API calls taking too long.

MoscaDotTo commented 2 years ago

I see. Interesting that it's so inconsistent to reproduce. I guess I'll comment back if I ever pinpoint the exact cause