greatsuspender / thegreatsuspender

A chrome extension for suspending all tabs to free up memory
https://chrome.google.com/webstore/detail/the-great-suspender/klbibkeccnjlkjkiokjodocebajanakg/
GNU General Public License v2.0
5.03k stars 906 forks source link

Latest Chrome store version doesn't handle resuspend (or for that matter chrome startup) of large sessions all that well if RAM under 8 GB and CPU under 4 cores #793

Open tonsimple opened 5 years ago

tonsimple commented 5 years ago

Specifications:

Issue: on a weak PC (or a small VM) Great suspender no longer can handle startup or re-suspends of large (21 windows, >600 tabs) sessions

The session re-suspend (or restore at startup) hangs infinitely (spinning circles, suspended page face never shows up) or extension crashes.

No tabs lost so far but usability greatly diminished.

Increasing RAM and CPU count (by attempting to run on a better PC or increasing RAM and cores in a VM) improves the situation, but the whole point of TGS for me was forcing chromium to behave on weak systems.

Behavior reproduced on fresh installs on both "raw metal" and in VMs EDIT: No other session management tools/extensions used.

Most tabs in session are suspended (at time of shutdown of chrome, and thus at moment of session restore)

tonsimple commented 5 years ago

Workaround found:

going to chrome://flags/ and enabling:

Fast tab/window close Page Almost Idle Infinite Session Restore

AND setting Proactive Tab Freeze and Discard to "Enabled Freeze and Discard" functionally solves the issue.

Startup performance with great suspender is back to "fairly nice" even under small RAM and weak CPU, tested in VM and on a tiny debian mini-PC

SnIPeRSnIPeR commented 5 years ago

deanoemcke, where is the update on Chrome Web Store? :)

stekern commented 5 years ago

I've been having the same problem for several weeks (in the beginning it only happened when I connected to a high-resolution external monitor -- not sure if this was just a random occurrence). I have between 150-200 suspended tabs in ~10 windows, and the extension usually crashes when starting Chrome. Sometimes the extension also randomly crashes when the browser and extension have been running fine for several hours.

Your workaround seems to work for me at the moment, @tonsimple. I'll update if the breaking behavior returns.

EDIT: The workaround worked until I connected my computer to a high-resolution external monitor. After that the extension started crashing again.

Specifications

Extension version: v7.0.109 Browser & version: google-chrome-stable 70.0.3538.102 (64-bit) Operating system & version: Ubuntu 18.04

deanoemcke commented 5 years ago

@tonsimple @stekern can either of you try out the latest development version of the extension by installing from source from the gitHub project?

there have been significant performance improvements since v7.0.109.

stekern commented 5 years ago

@deanoemcke I've built the latest version from source now -- 7.0.143. I'll report any crashes :+1:

stekern commented 5 years ago

@deanoemcke 7.0.143 just crashed as well. Is there any way to turn on logging?

deanoemcke commented 5 years ago

@stekern You can turn on logging, however it may not be much help in the event of an extension crash as you might find you lose the log when it crashes.

To enable debugging, open the extension settings page and in the url, change options.html to debug.html. This will take you to a hidden debug page which allows you to turn logging on and off. Toggle logging on for both debugErrors and debugInfo. After that, if you open the extension background page (in devtools) you should see a LOT of debug output.

Can you post a screenshot of your extension options page so I can see the settings you have set? Also, there is a slightly newer version available now (v7.0.144).

deanoemcke commented 5 years ago

@stekern I've just pushed another commit with further performance improvements for startup. If you haven't already, go straight to version 7.0.145 for further testing.

stekern commented 5 years ago

Just updated to 7.0.145, and the extension crashed after importing my previous session of 250 (suspended) tabs.

Sometimes the extension crashes on Chrome start-up, but it also occurs randomly while the browser is open.

I'm using the default extension settings with the exception of dark theme instead of light.

Here's the log from the following events:

  1. Switched window
  2. Used the keyboard shortcuts for "suspend all other tabs in active window" and "suspend active tab"
  3. All suspended tabs have now become unresponsive
  4. Chrome "Pages unresponsive" dialog pops up
  5. Clicked "Exit pages" and the extension crashed

https://pastebin.com/XZHiKLnc

deanoemcke commented 5 years ago

@stekern thanks for that. is your computer very fast? how much ram does it have? i suspect that this is a performance issue. And most notably, from the log it appears that you have screen capturing turned on (which is not the default). Can you confirm this? And try turning this off, as it massively affects performance when suspending tabs.

stekern commented 5 years ago

@deanoemcke No worries :-)

I have a ThinkPad T460 with 8GB RAM and an i5-6200 CPU. It's not a super-fast laptop, but I wouldn't say it's bad at all.

I've had the same amount of suspended tabs in the past (and I've been using this extension for years), and the extension only started crashing a month or two ago. The first time I experienced the issue was when connecting my laptop to an external monitor. I'm not ruling out that this could be bug related to Chrome, Ubuntu, GNOME, my laptop, etc., but currently this extension is the only thing I'm having problems with.

The screen capturing option is turned off, and I can't recall ever having that option enabled.

deanoemcke commented 5 years ago

@stekern Ah yes, sorry about that. There was a bad logging message in the code which erroneously referred to screen captures.

You're right that your laptop should not suffer from performance issues. Although my testing on Ubuntu is non-existent.

There has been one small performance improvements (bugfix) which may help since we last tried. Although it's pretty minor. Try v7.0.150. And if you could take another log for me that might be useful.

Just for some background into why these newer versions are less performant than the older release. It is due to some changes in newer versions of chrome which causes issues with the display of favicons of suspended tabs with the older version of the extension. To fix this, I've had to add extra checking on chrome startup and post tab suspension to ensure that the correct favicon is displayed. Without this, a chrome restart will cause all suspended tabs to show the default blockhead extension favicon. Refer to this issue for more info: https://github.com/deanoemcke/thegreatsuspender/issues/719

Edit: I've managed to get a debian VM running and performance does indeed tend to be much poorer. And even managed to get a crash. I've tweaked a couple of things (v7.0.151) and may do a few more tweaks in the next few days, including possibly adding a hidden switch to disable some of the new tab check code which i'm guessing is the cause of the decrease in performance.

kju commented 5 years ago

"Same"/similar issue here

Extension version: v6.30 for a long time, upgraded to v7.0.109, but now to v7.0.131 Browser & version: Chrome, 70.0.3538.110 (official build) (64-Bit) Operating system & version: Windows 10 Home 64-bit - latest public build

TP T420s with upgraded RAM and SSD

CPU
    Intel Core i5 2520M @ 2.50GHz
    Sandy Bridge 32nm Technology
RAM
    16.0GB Dual-Channel DDR3 @ 664MHz (9-9-9-24)
Motherboard
    LENOVO 41742AG (CPU)
Graphics
    LCD 1600x900 (1920x1080@60Hz)
    BenQ GL2460 (1920x1080@60Hz)
    Intel HD Graphics 3000 (Lenovo)
Storage
    119GB TOSHIBA THNSNC128GCSJ (SSD)
    119GB Samsung SSD 840 PRO Series (SSD)

When i restart the browser, it has 100%+ CPU use for hours and hours. At some point it normalizes or TGS crashes. After certain restart conditions (i think at specific windows update restart conditions or from chrome update restart) the issue doesn't appear. The issue is present for many months - I assume it started with some chrome update. It usually doesn't bother me as the laptop hardly restarts due to sleep mode.

Windows task manager https://i.imgur.com/JaaHQt5.png https://i.imgur.com/B7838ji.png

Chrome task manager https://i.imgur.com/gwAvb5h.png https://i.imgur.com/8NZtPpA.png

Also when opening tabs, or type in URLs there is quite some delay with a CPU spike.

The update to the latest beta build from TGS and/or the chrome settings from tonsimple in https://github.com/deanoemcke/thegreatsuspender/issues/793#issuecomment-430601077 seem to have helped for the most part. There is still some delay but CPU and RAM use is down considerably. What I noticed so far is that in the chrome taskmanager the number of "sub threads" for TGS is down a lot (seems only one for each window, rather than all tabs).

Chrome task manager now https://i.imgur.com/Ky8rpI3.png

If you need more information, or want something tests, please let me know.

PS: Thank you so much for your amazing work and friendly support here!

ghost commented 5 years ago

Changing the flags as described here certainly helped me. https://github.com/deanoemcke/thegreatsuspender/issues/793#issuecomment-430601077

I have atm 1825 tabs in Chrome 70.0.3538.110 TGS v7.0.109

My problems started after I formatted my PC. The only change after the format was a new TGS version since autoupdate wasn't enabled or doesn't exist or whatever.

I had ran with TGS v6.3 for quite some time. Never any problem at all with all my tabs in whichever size they have been. Immediately after the format, after I got a notification on the extension icon, Chrome became more and more sluggish until it told me TGS had ran out of CPU and RAM and had been turned off. Then suddenly Chrome became normal and responsive, so I manually restarted TGS. Was fine for some time, but after a little while I noticed Chrome became sluggish again. Progressed into badlands from there on, but at least it stayed above the crash treshold. Functioned fine for 10+ seconds then CPU-usage went through the roof and Chrome froze for at least 5 seconds. This is the new Chrome life from here on. 10s normal usage then 5s freeze, rinse and repeat.

This happens every time I start Chrome now after 7.0.109 got installed. Slugs eat up TGS until it crashes, then 10s/5s rotation in endless loop. No change of behavior after Chrome and Windows updates.

Behavior with TGS v6.3 was Chrome ate up lots of CPU+RAM to show the pinned and not suspended tabs, then it was done. No TGS hogging other than few seconds on startup.

I've tried install other versions of TGS from Github, but they install under a different extension id, so I can't easily hijack the chrome-extension://klbibkeccnjlkjkiokjodocebajanakg/suspended.html. If only I knew of some way to open the Session Buddy database and change "klbibkeccnjlkjkiokjodocebajanakg" to whatever I need, then restart Chrome... Hard to test the beta version on Github without manually opening 1800 new tabs. By hand.

Anyways, tried enable/disable the new settings in TGS v7. No change. If I should throw out a guess about what I think maybe might eating up CPU and RAM I'd say the new session system in v7, but that's the standard blaming the new guy. My thought was maybe instead of adding/removing a tab to the session it rather scans ALL tabs whenever one change happens, then saves the list. The reason I'm thinking about this is because Chrome did something similar before they fixed it 1+ year ago. Before I found Session Buddy I went into Chrome settings 1-2 times a week and saved the tabs with the third option of what to restore on startup. Before the fix it would take Chrome half a minute to store 300 tabs, after the fix it was less than a second.

Wish I had better programming skills so I could help out searching for the hogs.

deanoemcke commented 5 years ago

i have pushed another considerable change that will hopefully impact performance. If anyone in this thread could try the latest release (v7.0.158) and report back, that would be much appreciated.

@kju from what you've said about the small number of processes in the task manager, it sounds like you have the new 'Apply Chrome's built-in memory-saving when suspending' option checked. this may account for some of the delay you are experiencing? try turning it off and see if that makes any difference.

@ressikanflute v7.0.109 of the extension has some major known performance issues. you really need to try the latest beta, or else hold tight for an updated webstore version. I've just pushed some new code (v7.0.158) which gives you a link on the options->about page to a hidden debug page. On this debug page, there is a new link to 'Claim all suspended tabs' which will look for tabs suspended by another version of the extension, and re-associate them with the current version. This should make migrating much much easier :)

stekern commented 5 years ago

Just tried to open up a (previously exported) session containing ~200 suspended tabs spread over 15 windows on v7.0.158. The extension crashed before all windows were successfully restored.

ghost commented 5 years ago

Using Chrome 71.0.3578.98 Downloaded zip with TGS v7.0.158 including commits: 247fb7ae2b7be8666b467bf5abf8b5f44b9db0ce b64e79c1f652bbb4e0f0df1d831ca899fee1614d

Restarted Chrome to force a new Session Buddy session. Then resetted the flags used in https://github.com/deanoemcke/thegreatsuspender/issues/793#issuecomment-430601077

Restarted Chome again for flags to take effect. Manually installed the extension, went to the about page and waited for it to load. Scanning all tabs took 40 sec for 1 window with 1948 tabs.

Every time I start Chrome there are always some TGS tabs that don't load properly and fall back to showing default TGS icon on the tab instead of the website's icon. Those tabs reload normally when I focus them. But now that I just restarted Chrome and didn't give those tabs any focus, just went into TGS:about and let it scan all the tabs, it showed this for normal loaded tabs: 3894 | 3899 | 4 | [tab name] | - | pinned And this for faulted tabs: 3894 | 3900 | 5 | [tab name] | 20.12.2018, 17:54:56 | unknown Note that both are pinned in Chrome, but that doesn't show up here.

So I gave all those faulted pinned tab some focus and went on to the debug page again. 40 seconds later and the faulted tabs showed the same info. Went back and checked all those tabs that got status=unknown and saw they all had not been loaded by Chrome. That included pinned tabs not suspended by TGS and suspended pinned tabs.

Closed the debug page, opened it again, waited 40 sec. Now those tabs I had to give focus for Chrome to load are correctly marked as status=pinned, although none show any hints that they are suspended by TGS and would have the URL=chrome-extension://klbibkeccnjlkjkiokjodocebajanakg/suspended.html#ttl=TweetDeck&pos=0&uri=https://tweetdeck.twitter.com/

But moving forward. Clicked "claim all suspended tabs". Saw the suspended tabs from left to right got refreshed. Went to watch some TV to give it enough time to complete.

Weird. Vivaldi (which I'm typing this in) crashed after I had watched TV for about 30 mins. Brought with it monitordriver or similar. Never done that before. Chrome is not responsive. CPU usage is normal, Chrome isn't among the top 10. RAM usage on the other hand is through the roof. All 16GB are consumed by Chrome (normally I have 4-8GB "free", depending on not-yet-suspended-tabs). Guess that's why Vivaldi and monitordriver crashed.

I'm gonna restart the PC, open Chrome and let it sit for a while again. BRB.

ghost commented 5 years ago

Forgot to disable TGS v7.0.109 after I had claimed all suspended tabs. Did that now and restarted Chrome. Back to the TV and wait.

ghost commented 5 years ago

Chrome is stable after that 1h AFK. RAM-usage is normal. CPU-usage is better than what it was, maybe better than it has ever been for Chrome.

Gonna see how it handles Tweetdeck and the addition of several new tabs. Tweetvideos are still lagging a bit every few seconds, but not sure if it's because of TGS or Chrome itself. Opening new websites in new tabs and the aftermath of that is consuming more CPU than with TGS v7.0.109 + Chrome flags https://github.com/deanoemcke/thegreatsuspender/issues/793#issuecomment-430601077 . Seems to be fine when everything has settled down.

Closing Chrome is rather quick now. Opening Chrome with 50 pinned tabs where half are not suspended always takes a minute for everything to load and get done. Still not completely done after a minute, but acceptable. Not that superlaggy every 5 sec as it used to be, just generally busy. And as I saw earlier it was just fine after that 1h TV AFK.

Weird... TGS is not on the rightclickmenu after that restart. I used it to suspend Tweetdeck before the restart. It's enabled in the options. Disabled then enabled made it show up again.

Ok, so the conclusion so far is that it's much better but still consumes lots of CPU the "minutes" after Chrome is opened and when new tabs with content are opened. It does settle down after a while, just not fast enough compared to how it was with TGS v6.3

@deanoemcke Let me know if you have a new build you wanna test or something specific tested in this build.

deanoemcke commented 5 years ago

@stekern any chance you'd want to share with me an export of that session you're trying to load that is crashing your browser? you can email me the text file at deanoemcke (at) gmail (dot) com. totally understand if you'd rather not.

@ressikanflute thanks for the debugging work. the high CPU after first opening chrome is normal as all the suspended tabs are reloaded. i'm not sure about the extra time when a new tab with content is created however. are you able to temporarily disable the extension to do a comparison test? i can't imagine TGS causes any significant load when a new tab is created.

ghost commented 5 years ago

With TGS v6.3 before I formatted the PC, when I opened new tabs it was as if I did so with an empty Chrome with no addons. CPU-usage when pages loaded, then done. Now (and yes, a couple of Chrome versions later) the pages consume CPU for much longer time, meaning tabs end up stacking CPU-usage instead of running in serial.

With TGS v7.0.158 disabled (and all the suspended tabs were automatically closed by that action): Did my normal thing with tweetdeck. Opened 10 tabs and watched a twittervideo while they loaded. No lag or any disruption on the video. Did all this again while I watched resourcemonitor for CPU-usage: as expected and dropped immediately after the pages were done loading. With TGS v7.0.158 the CPU-usage have the same pattern, but stretched longer in time, and the tail is much longer (same as the experience is that it "never" gets done loading new tabs/pages).

stekern commented 5 years ago

@deanoemcke Sorry, the session contains too much sensitive information.

Experiencing the same issues on v7.0.159. Seems like the problem disappears when having less than ~100 tabs. Currently sitting at 175 tabs, and the extension is crashing a lot.

I'll continue testing.

DedupOperator commented 5 years ago

Using recommended flags, chrome dev V73 Build 3664.3 Seems more stable now. will update if any issues occur. (past build using same flags chrome was crashing very frequently even on less than 50 tabs opened, I haven't debugged if it was TGS related though).

deanoemcke commented 5 years ago

@stekern Any chance you could trying a chrome restart with a large (>170) number of tabs on the latest build of the extension (v7.0.171) ?

i have made some more optimisations to the extension initialisation process that may have helped ease cpu load.

pasnox commented 4 years ago

Still an issue, regularly after a machine reboot, starting chrome leads to frozen tabs and unresponsive extension. Generally, killing the extension help then restoring the tabs, though annoying from the Chrome Task Manager.