gioxx / MarvellousSuspender

A chrome extension for suspending all tabs to free up memory, based on the original TGS 7.1.6, without tracking. Find more information about that on https://gioxx.org/tms
https://go.gioxx.org/download-tms
GNU General Public License v2.0
1.06k stars 87 forks source link

Suspended tabs name with 3 dots and white page. #161

Closed PatrickL546 closed 2 years ago

PatrickL546 commented 2 years ago

Please complete the following information when submitting a feature request or bug report.

Suspended tabs turns to default icon with 3 dots and white background until I click on it and it loads the proper suspended tab. Even after it loads if you click away and go back to the tab, it turns white again. Seems to be from the new chrome update.

What happens when it gets suspended image

What it should look like image

PatrickL546 commented 2 years ago

Seems like Version Google Chrome 100.0.4896.75 with v7.1.6.3 is kinda still bugged. I've tried it and the 3 dots title and white page only occur when suspending it the first time. Here's what I did.

Open a site and suspend it. It turns to the bugged page. Go to another tab and comes back, after a sec it loads the page correctly and it seems after this, it's fixed until it's unpaused then paused again.

This is only an observation and I haven't looked deep into it.

Ocel8 commented 2 years ago

I use chrome Dev. and I had this problem but it seems to be solved (it disappeard a couple of update ago). At the same time now everytime you unsuspend a tab it reloads two times with a couple of seconds between the two, and it's super annoing

berkshireasia commented 2 years ago

@nihaals @berkshireasia are you continuing to use the version installed from the Chrome Store or the one on GitHub manually loaded in Chrome? @gioxx Similar to @nihaals I also downloaded version 7.1.6.3 manually loaded. In any case, neither this one nor the one on Chrome Store fix the problem...

briantully commented 2 years ago

Should this issue be reopened? Seems to be occurring again with Chrome 100.0.4896.75 and 7.1.6.3 (master branch) from this repo loaded unpacked.

I'm seeing suspended tabs change icon to the Marvellous Suspender icon with 3 dots, then viewing the tab it's initially white screen and then changes to display "Undefined".

The error showing within the extension console is:

Error handling response: TypeError: Cannot read properties of undefined (reading 'pop')

So it seems it's losing track of the suspended tab URLs array/session?

tomasz1986 commented 2 years ago

Should this issue be reopened?

I'd also like to ask to re-open the issue. It doesn't seem to be fixed, or at least not completely fixed. I've compiled the extension from source with all the newest patches, and I still keep getting these errors with some of the suspended tabs.

This is how such a problematic tab looks like.

  1. Before clicking on it: image

  2. After clicking on it: image image

Fortunately, it is still possible to display the suspended site by trying to navigate back.

Kolossi commented 2 years ago

+1 for reopening I also have the issue described by @tomasz1986

Also, it's fine having a fix in source, but there's no release on here let alone it being an update on the chrome store.

@gioxx I do realise software issues are normally closed when the fix is in source, but in this case where it's not some kind of side functionally but the core purpose of the app doesn't work, istm it would be best to leave this open until the fix is published and confirmed there are no obvious problem scenarios.

Not meaning to rant - the software is great, the fact it was picked up from the code base which had been malwared is great, it wasn't this code's fault the bug appeared it was google what broke it. Just really like it and want it back - thanks for your efforts @gioxx and all those who found and fixed 👍🏻

napolux commented 2 years ago

I still keep getting these errors with some of the suspended tabs.

Hey thanks for this. Can you answer some questions in order to help debug the issue?

tomasz1986 commented 2 years ago
  • Some or all your tabs?

Only some, and it doesn't seem consistent, e.g. I opened a few tabs with the same website, and only a few of them ended up in this state. Not sure if this will be of any help, but at this very moment I'm experiencing the problem with the following URs.

https://stdict.korean.go.kr/search/searchView.do?word_no=146232&searchKeywordTo=3# https://www.theverge.com/2017/9/28/16378364/cuphead-art-design-1930s-animation

For the record, it appears to only happen after a tab has been suspended automatically (which is set to 1 hour in my case). When suspending it manually, everything seems to work fine.

  • Does it happens even on freshly suspended tabs or old ones?

It happens on freshly suspended ones, unfortunately.

ptxmac commented 2 years ago

For the record, it appears to only happen after a tab has been suspended automatically (which is set to 1 hour in my case). When suspending it manually, everything seems to work fine.

I just had the issue with a manually suspended tab, so I don't think manual vs auto has any impact. Seems very random to me

xodotLBO commented 2 years ago

Even after fix its happening again after updating chrome

ogrotten commented 2 years ago

I have 2 systems using this.

Basement system is

Work system is

Basement system works as expected. It has never had a problem.

Work system has the problem, since before my first post in this thread on 15-Mar-2022.

jenci8888 commented 2 years ago

I'm having a same problem too.

EDIT: Okay, it's fixed after chrome updated to 100.0.4896.88, as I tested the oldest 7.1.6 version (github forked) and ran without issues. (I don't know what Chrome was in issue, I'll keep monitoring in future)

I've used:

NoReasonKen commented 2 years ago

After an update of chrome, from 100.0.4896.75 to 100.0.4896.88, it works perfectly now

I'm on

gioxx commented 2 years ago

Ok, thanks @NoReasonKen. @ogrotten @xodotLBO @ptxmac @tomasz1986 @Kolossi and others with the problem, could you please test again TMS (GitHub version) with an updated Chrome? I want to know if we can release a new TMS version for all our users. Please leave then a feedback at the end of the test to understand if everything works for you too. Thanks!

ptxmac commented 2 years ago

could you please test again TMS (GitHub version) with an updated Chrome?

Will do - did you mean build from source, or is there an existing release we can just download?

gioxx commented 2 years ago

Will do - did you mean build from source, or is there an existing release we can just download?

You can build or just download a copy of the repository and load src folder in Chrome (unpacked extension).

ptxmac commented 2 years ago

Cool, installed - it usually takes some time before the issue starts appearing, so I'll add a comment if I see it again

gioxx commented 2 years ago

Thanks!

ptxmac commented 2 years ago

Just confirmed - this happened again using the version on master

gioxx commented 2 years ago

Just confirmed - this happened again using the version on master

Is Chrome updated? Can you check (and write here) the version in use?

ptxmac commented 2 years ago

More than just updated, I'm on the beta channel 😄

Version 101.0.4951.26 (Official Build) beta (arm64)

gioxx commented 2 years ago

Got it, this is so strange, because the problem seems to be solved on the Current Channel (100.0.4896.88)! 🤔😢

aarondchu commented 2 years ago

Im on Microsoft Edge Version 100.0.1185.36 (Official build) (64-bit) and this issue is fixed

jenci8888 commented 2 years ago

~I'm having a same problem too.~

EDIT: Okay, it's fixed after chrome updated to 100.0.4896.88, as I tested the oldest 7.1.6 version (github forked) and ran without issues. (I don't know what Chrome was in issue, I'll keep monitoring in future)

I've used:

  • Windows 10 21H2 (build number: 19044.1620)
  • Chrome Version 100.0.4896.88 (Official Build) (64-bit)

Restarted PC and restarted chrome, encounter the same issue as before, just nothing new. (still unresolved.) When browser updates, and it would be resolved the issue until restart chrome & restart PC.

nihaals commented 2 years ago

I can also still reproduce the issue.

NoReasonKen commented 2 years ago

@jenci8888 @nihaals

Humm, But the extension works perfectly even if I restart my computer I have tried to switch the option of extension which will use build-in system memory release function of chrome, and it is good in both conditions

pressRtowin commented 2 years ago

Very oddly, when I updated chrome to version 100, it stopped doing this. Stayed that way for a couple weeks, then started doing it again within the last 24 hours. I intentionally didn't install the current update that it's prompting me to restart chrome for (my system, and chrome, stays on for long periods of time).

ogrotten commented 2 years ago

I kept an eye out during the day on my work machine. I will do so again tomorrow and update.

a1termoon commented 2 years ago

For me all ok. You use this? image

PatrickL546 commented 2 years ago

For me all ok. You use this? image

It's a feature from when people are using the original TGS and chrome deletes the extention so people can't unsuspend the tabs. It takes over those tabs and enable people to unsuspend it.

Not really used nowdays. You can keep it on, doesn't really affect you.

ogrotten commented 2 years ago

Ok, thanks @NoReasonKen. @ogrotten @xodotLBO @ptxmac @tomasz1986 @Kolossi and others with the problem, could you please test again TMS (GitHub version) with an updated Chrome? I want to know if we can release a new TMS version for all our users. Please leave then a feedback at the end of the test to understand if everything works for you too. Thanks!

I did not see a problem today. At least by appearance it seems to be working again.

Thanks for giving a crap.

hargobind commented 2 years ago

Reporting that I experienced this issue with the latest master branch (7.1.6.3), unpacked, on Chrome 100.0.4896.127 on Windows 10 Pro.

Here's the debug log from the background page

Error in event handler: TypeError: Cannot read properties of undefined (reading 'indexOf')
    at Object.testForMatch (chrome-extension://gfkmanbeiohkbjdkpnhfocbcjdkaoijm/js/gsUtils.js:357:19)
    at Object.<anonymous> (chrome-extension://gfkmanbeiohkbjdkpnhfocbcjdkaoijm/js/gsUtils.js:311:22)
    at Array.some (<anonymous>)
    at Object.checkSpecificWhiteList (chrome-extension://gfkmanbeiohkbjdkpnhfocbcjdkaoijm/js/gsUtils.js:310:34)
    at Object.checkWhiteList (chrome-extension://gfkmanbeiohkbjdkpnhfocbcjdkaoijm/js/gsUtils.js:298:20)
    at calculateTabStatus (chrome-extension://gfkmanbeiohkbjdkpnhfocbcjdkaoijm/js/background.js:1302:17)
    at handleUnsuspendedTabStateChanged (chrome-extension://gfkmanbeiohkbjdkpnhfocbcjdkaoijm/js/background.js:777:7)
    at chrome-extension://gfkmanbeiohkbjdkpnhfocbcjdkaoijm/js/background.js:1725:9

I've traced the error back to calculateTabStatus() in background.js. Through debugging the value of tab, I found that sometimes tab.url is empty. I tested this by manually suspending a tab using a keyboard shortcut.

Ack! During my testing/debugging, I was able to reproduce this perfectly. But then I restarted my browser and now I can't reproduce the issue anymore. So I can't tell you why tab.url was empty earlier, but now it always has the URL value. If I encounter this again, I'll see if I can debug this further.

nihaals commented 2 years ago

For future reference, HEAD for https://github.com/gioxx/MarvellousSuspender/issues/161#issuecomment-1100843246 is 8bda8531a386ad6514c2df9d0890be03ede89d54

Winsane commented 2 years ago

I was poking around a bit, and found a fix. It feels like a bit of a spaghetti band-aid fix though, but I haven't had time to investigate further yet. I edited this function: https://github.com/gioxx/MarvellousSuspender/blob/8bda8531a386ad6514c2df9d0890be03ede89d54/src/js/gsMessages.js#L104-L126 Like this:

  sendMessageToTab: function(tabId, message, severity, callback) {
    if (!tabId) {
      if (callback) callback('tabId not specified');
      return;
    }
    var responseHandler = function(response) {
      gsUtils.log(tabId, 'response from tab', response);
      if (chrome.runtime.lastError) {
        if (callback) {
          if (severity == "error"){
            chrome.tabs.get(tabId,gsTabCheckManager.queueTabCheck);
          }
          callback(chrome.runtime.lastError);
        }
      } else {
        if (callback) callback(null, response);
      }
    };
    message.tabId = tabId;
    try {
      gsUtils.log(tabId, 'send message to tab', message);
      chrome.tabs.sendMessage(tabId, message, { frameId: 0 }, responseHandler);
    } catch (e) {
      // gsUtils.error(tabId, e);
      chrome.tabs.sendMessage(tabId, message, responseHandler);
    }
  },

So basically, if severity == "error", send the tab to queueTabCheck. Feels like we could easily end up in some sort of infinite loop with this, but I've been using the fix for a couple of weeks now with almost always 30+ tabs with no issues.

hargobind commented 2 years ago

Thankfully the bug returned, so I was able to continue testing. I ran tests by suspending an individual tab via all the normal methods (extension icon, right-click, keyboard shortcut), and suspending all other tabs in the window via the same procedures.

I've traced the issue back to chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) {}); in background.js.

The issue here is that tab does not contain a full copy of the tab. Specifically, tab.url is missing. I don't know the code of this extension well enough to understand how TMS suspends tabs, but I imagine the "tab suspend" code might be the culprit.

As a workaround, I've attached a patch to deal with the missing tab.url. It checks if tab.url is undefined then call chrome.tabs.get(tabId). Then proceed handling the tab update. Since tab.url may still exist in some scenarios, I have moved the code that was in onUpdated.addListener() to its own handler function.

Patch file: tms-161-onUpdated-fix.patch.txt See #179 for the PR.

This might be the best fix going forward. However, I still wonder how tab.url is missing, and I'm guessing it has to do with how TMS suspends tabs. If that can be tracked down and fixed, then this workaround won't be necessary.

I also don't know the TMS code well enough to know whether my approach or @Winsane 's approach is better. But after applying their fix, I was still seeing errors in the DevTools console related to a missing tab.url. To fix this, it's still necessary to modify calculateTabStatus() and change: if (gsUtils.checkWhiteList(tab.url)) { to: if (typeof tab.url !== 'undefined' && gsUtils.checkWhiteList(tab.url)) {

pannal commented 2 years ago

Please fork instead of posting patches, so more people can test your changes more easily! Thanks!

hargobind commented 2 years ago

@pannal I don't have a lot of experience with GitHub. Please send a link of a guide on what the etiquette is for contributing forks/patches to an issue.

pannal commented 2 years ago

@pannal I don't have a lot of experience with GitHub. Please send a link of a guide on what the etiquette is for contributing forks/patches to an issue.

Hmm, normally basically fork (there's a button on top of this; top-right) and check out/clone your fork locally, apply your changes, push your fork, then create a pull request on github (it even appears automatically after you've pushed). It's fairly straight forward.

Edit: The only thing you need is a Github account and a couple of clicks. Edit 2: You might want to change typeof tab.url != 'undefined' to typeof tab.url !== 'undefined' :)

sicklittlemonkey commented 2 years ago

@pannal I don't have a lot of experience with GitHub. Please send a link of a guide on what the etiquette is for contributing forks/patches to an issue.

GitHub has a guide for this and other topics: https://docs.github.com/en/get-started/quickstart/contributing-to-projects

Also, if you're on Windows or macOS there is a desktop app that makes things easy: https://desktop.github.com/

xodotLBO commented 2 years ago

So is there a fix that's out/out for this or what's happening? I'm still getting annoyed by this but have to use the extension.

nihaals commented 2 years ago

179

Winsane commented 2 years ago

I also don't know the TMS code well enough to know whether my approach or @Winsane 's approach is better.

@hargobind Your approach looks more sane! But I'm also still curious why we get the empty tab.url in the first place, because fixing that would be more satisfying and efficient than having code babysitting to correct the actual bad code.

hargobind commented 2 years ago

@hargobind Your approach looks more sane! But I'm also still curious why we get the empty tab.url in the first place, because fixing that would be more satisfying and efficient than having code babysitting to correct the actual bad code.

Agreed! I'm also curious why there seem to be around 10 calls to chrome.tabs.onUpdated() every time a tab is suspended.

I only tracked the issue as far up the execution tree as I could. If someone wants to point me in the direction of the SuspendTab() code, I'm happy to look at it. But I don't have the time to go hunting for it.

DaveKap commented 2 years ago

This had somehow fixed itself (or I found a workaround and cannot find it again) prior to Chrome update 100 but the very latest version of Chrome (100.0.4896.127 64-bit) has now caused this error to pop up again on Windows 10.

hargobind commented 2 years ago

Sorry for all the extra commit mentions. I was learning how to rebase ;-)

My changes are done, for anyone who wants to pull and try them out.

DaveKap commented 2 years ago

I'm not set up for building so if anyone wants to just link a built extension to install, I (and many others) would appreciate it.

hargobind commented 2 years ago

I'm not set up for building so if anyone wants to just link a built extension to install, I (and many others) would appreciate it.

You don't need to build the extension. You can run it from the GitHub source. Caveat: make sure you export your sessions from your old extension to a local file, because enabling the new development extension will effectively start a brand new set of tabs.

Download the latest code from GitHub (or a fork if you wish). In Chrome, go to the Manage Extensions page, enable Developer Mode. Disable the old extension. Click the Load Unpacked button in the top-left, and point it to the "src" directory. Once it's enabled, go to the extension Options page and import your sessions. That should be all you need to run it.

hargobind commented 2 years ago

On further testing, I don't know for sure that my changes are the solution here.

I did some testing in Brave and FireFox. I found that when a tab loads a new URL, chrome.tabs.onUpdated() is triggered, and the changeInfo parameter has status == 'loading' and url has a value. So I want to understand why changeInfo.url doesn't have a value in Chrome before I feel confident about my proposed changes. Tomorrow I'm going to try testing with a fresh copy of Chrome with no extra extensions to see if the missing changeInfo.url is from an extension conflict, or if it's an issue with the recent versions of Chrome. (I'll test in Edge too.)

DaveKap commented 2 years ago

I haven't tried your changes yet but it's worth noting that something changed again and now the tabs are properly keeping their favicon and name, but there is still a white flash when changing over to the tab.

DaveKap commented 2 years ago

I made sure to back up my session, disabled the current live version of Marvelous Suspender, and then loaded your change up. Two things that may need their own issues and may or may not be related to your fixes.

1: Tabs that were suspended in the old session show up as "blocked by chrome" and I have to hit the back button to get the tab to load. 2: Importing the old session with the new version completely removes my tab groups.

So at the moment I'm at a three-way choice of "do I want to hit Back for every suspended tab," "do I want to redo my tab groups," and "do I want to deal with the still-broken version."