Cookie-AutoDelete: [Bug] CAD makes Firefox browser hang without Cache Cleanup enabled

Acknowledgements

  • I acknowledge that I have read the above items

Describe the bug

Like https://github.com/Cookie-AutoDelete/Cookie-AutoDelete/issues/1120, however on Windows, and without Cache Cleanup enabled (disabling it was the previous “solution” to the problem), the problem still persists.

As detailed in my comment on the linked issue:

My CAD core settings (click):
{
  "settings": [
    {
      "name": "activeMode",
      "value": true
    },
    {
      "name": "delayBeforeClean",
      "value": 15
    },
    {
      "name": "statLogging",
      "value": true
    },
    {
      "name": "showNumOfCookiesInIcon",
      "value": true
    },
    {
      "name": "showNotificationAfterCleanup",
      "value": false
    },
    {
      "name": "cleanCookiesFromOpenTabsOnStartup",
      "value": true
    },
    {
      "name": "contextualIdentities",
      "value": false
    },
    {
      "id": "DEPRECATED - use localStorageCleanup",
      "name": "localstorageCleanup",
      "value": true
    },
    {
      "name": "notificationOnScreen",
      "value": "5"
    },
    {
      "name": "domainChangeCleanup",
      "value": false
    },
    {
      "id": "DEPRECATED - use default expressions",
      "name": "greyCleanLocalstorage",
      "value": true
    },
    {
      "id": "DEPRECATED - use default expressions",
      "name": "whiteCleanLocalstorage",
      "value": true
    },
    {
      "name": "enableNewVersionPopup",
      "value": true
    },
    {
      "name": "debugMode",
      "value": false
    },
    {
      "name": "enableGreyListCleanup",
      "value": true
    },
    {
      "name": "keepDefaultIcon",
      "value": false
    },
    {
      "name": "sizePopup",
      "value": 16
    },
    {
      "name": "sizeSetting",
      "value": 16
    },
    {
      "name": "contextMenus",
      "value": false
    },
    {
      "name": "discardedCleanup",
      "value": true
    },
    {
      "name": "cacheCleanup",
      "value": false
    },
    {
      "name": "cleanExpiredCookies",
      "value": true
    },
    {
      "name": "indexedDBCleanup",
      "value": true
    },
    {
      "name": "localStorageCleanup",
      "value": true
    },
    {
      "name": "manualNotifications",
      "value": true
    },
    {
      "name": "pluginDataCleanup",
      "value": true
    },
    {
      "name": "serviceWorkersCleanup",
      "value": true
    },
    {
      "name": "contextualIdentitiesAutoRemove",
      "value": true
    }
  ]
}

As my comment states:

As soon as I open Firefox, some of the tabs that try to load just hang with a blank background with a spinning circular icon until they eventually do. This also happens seemingly randomly during use of the browser and fairly often. When I disable CAD and restart Firefox, tabs always load instantly.

This has been happening since maybe Firefox version 97-98?

To Reproduce

Not clear how to cause the issue to occur. It was a few Firefox versions ago that the problem occurred. Whether it was introduced by Firefox or a version of CAD I don’t know. I will try to diagnose this a little further by resetting CAD to its default settings and see if the issue persists. Kind of reluctant to do so because I’ll potentially be losing my current logins and other info. I will wait for any response first.

Expected Behavior

Extension to not cause hangs, regardless if the Cache Cleanup settings option is enabled or not.

Screenshots

No response

System Info - Operating System (OS)

Windows 11

System Info - Browser Info

Firefox 101.0.1

System Info - CookieAutoDelete Version

3.7.0

Additional Context

I am aware that duplicate issues shouldn’t be opened but my attempts to mention the dev’s username didn’t appear to get any response. Close if need be, but any help would be greatly appreciated as this is an ongoing problem in my daily use and I would rather not disable CAD altogether and find a replacement extension.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 1
  • Comments: 16 (6 by maintainers)

Most upvoted comments

You’re not having CAD keep anything you’ve enabled CAD to clean, so you’re essentially cleaning up all cookies, indexeddb, localstorage, plugin data, and service workers for domains matching that expression

I see what you’re saying. However, this shouldn’t be cleaning up the cookies as I have “Keep All Cookies” enabled (which is the only reason the expression exists), but yes, everything else for that particular domain should be being cleared.

My bad. Seems I messed up with the variable name of that option in the backend.

Currently, it stands that cleanAllCookies with true is actually Keep All Cookies checked, so I’ll need to rename that as well in the next version.

Just to let you know, unfortunately as predicted, after a week of daily browser use, the spinning circle has begun to return. I suppose I’ll have to disable and then re-enable IndexDB and LocalStorage cleaning to clean them out to regain normal tab-loading speed before the hangs become even longer.

Update no. 2:

Interestingly, I just reset both my core and expression settings to default and then enabled all Browsing Data Cleanup Options (except Cache since I do not use that): I relaunched the browser and it loaded initial tabs without any comparable hang.

I then re-imported only my Core settings, and relaunched again. There seemed to be somewhat of a hang but I think it’s a one-off due to the processing that I’m guessing is necessary after IndexDB or LocalStorage is enabled? I say a one-off because next I re-imported my expressions and relaunched the browser a third time: the initial tabs I chose to load now load much faster. Still a minor hang between launch and tab load, but that may just be Firefox firing up. A much improved speed (potentially the expected speed) compared to before where a spinning circle sometimes made an appearance.

My assumption is that something has now been cleared that was previously numerous, but I’m also under the impression this is a temporary fix as the hang may return a little day by day as I revisit whitelisted sites, Bandcamp with its many subdomains in particular. Checking the debug logs, I don’t see any mention of bandcamp domains or others, other than the ones I tested to load.

Hopefully it helps @kennethtran93 once you have time to look into it.

Insights so far based on just toggling the Cleanup settings (I did not reset my settings to default and Clean Existing Data for Newly Enabled Browsing Data Types was left enabled):

  • Disabling both IndexDB and LocalStorage is necessary to stop the hangs.

  • Plugin Data and Service Workers cleanups are still enabled and do not cause hangs.

  • If either IndexDB or LocalStorage is enabled, the CAD debug log shows a lot amount of “CleanupService.filterSiteData: LocalStorage cleanup returned true for …”.

    LocalStorage example (click):
    15:42:30.072 CAD_3.8.0 - debug - CleanupService.filterSiteData: debug data.
    {
      "notProtectedByOpenTab": true,
      "notInAnyLists": false,
      "siteData": "LocalStorage",
      "isCADCookieNoExpression": false,
      "cleanSiteDataInExpression": true,
      "isRestartCleanup": false,
      "canCleanSiteData": true,
      "nonBlankCookieHostName": true,
      "notOpenTabAndCanClean": true,
      "CleanReasonObject": {
        "cached": false,
        "cleanCookie": false,
        "cookie": {
          "name": "BACKENDID",
          "value": "***",
          "domain": "some_artist.bandcamp.com",
          "hostOnly": true,
          "path": "/",
          "secure": true,
          "httpOnly": false,
          "sameSite": "no_restriction",
          "session": true,
          "firstPartyDomain": "",
          "partitionKey": null,
          "storeId": "firefox-default",
          "hostname": "some_artist.bandcamp.com",
          "mainDomain": "bandcamp.com",
          "preparedCookieDomain": "https://some_artist.bandcamp.com/"
        },
        "expression": {
          "expression": "*.bandcamp.com",
          "listType": "WHITE",
          "storeId": "default",
          "cleanLocalStorage": true,
          "cookieNames": [],
          "id": "DjVG3sdVr7",
          "cleanSiteData": [
            "LocalStorage",
            "IndexedDB",
            "PluginData",
            "ServiceWorkers"
          ],
          "cleanAllCookies": true
        },
        "openTabStatus": "reasonTabsWereIgnored",
        "reason": "reasonKeep"
      }
    } common-background-popup-setting.bundle.js:2:44103
    15:42:30.072 CAD_3.8.0 - debug - CleanupService.filterSiteData: LocalStorage cleanup returned true for some_artist.bandcamp.com
    common-background-popup-setting.bundle.js:2:44103
    
    • The majority of debug messages are for the domain bandcamp.com which I visit often, and which also has a whitelisted expression *.bandcamp.com. Each artist on Bandcamp has their own domain, so there is a debug entry for each some_artist.bandcamp.com subdomain, so maybe this is a lot to process?
  • The same debug messages as in the previous bullet point but for Service Workers is also present (again, Service Workers don’t cause a hang but I thought the following snippet was possibly a clue).

    Service Workers log snippet (click):
    15:33:17.695
    CAD_3.8.0 - debug - CleanupService.removeSiteData: Cleanup of hostnames in Firefox for serviceWorkers:
      "some_artist_1.bandcamp.com",
      ".some_artist_1.bandcamp.com",
      "www.some_artist_1.bandcamp.com",
      ".www.some_artist_1.bandcamp.com",
      "some_artist_2.bandcamp.com",
      ".some_artist_2.bandcamp.com",
      "www.some_artist_2.bandcamp.com",
      ".www.some_artist_2.bandcamp.com",
      (... for ~600 lines + ~200 more for other domains)
    [
    

Something else observed:

If, say, IndexDB Cleanup is enabled and Firefox is then immediately quit, the Firefox windows closes, but some of its processes remain running in the background, one in particular with 2-3 MB/s of IO happening until the browser results in a crash after ~20s. It looks like another side effect of the amount of domains being processed perhaps? Something is slower than it should be at least.

CAD 3.8.0

How many tabs do you have open in all your Firefox windows combined?

148 at the moment. No tabs (even pinned tabs) load until clicked due to Firefox settings I’ve chosen, if that may matter.

No - that’s usually the better setting so that (for all but the active tab/domain shown on restart), the site data would be cleaned up before the site has a chance to see it.

The next version that is coming up that will have the option to keep your existing cache/indexeddb/localstorage/service workers when you enable those cleanups globally. Perhaps at that time you could try to debug as well.

I could wait then. Any estimate of when the next version may be released?

I’ve pushed the next version for review to the individual browser extension stores. These should be approved and released in the next few days.

There’s a possibly that Firefox may have either introduced something or started to deprecate something that CAD may still be using. As you may have noticed, CAD version 3.6.0 had been out for a year or so, while Firefox has incremented their versions for a much shorter time span than this extension, so things may have been changed that we need to take into account. Unfortunately, I don’t have much time to debug this on my own at this time.

How many tabs do you have open in all your Firefox windows combined?

Maybe enable debug mode and check the extension console statements (instructions shown once enabled) if possible? These don’t persist on browser restart unfortunately.

The next version that is coming up that will have the option to keep your existing cache/indexeddb/localstorage/service workers when you enable those cleanups globally. Perhaps at that time you could try to debug as well.