sienori / Tab-Session-Manager

WebExtensions for restoring and saving window / tab states
https://tab-session-manager.sienori.com/
Mozilla Public License 2.0
1.92k stars 190 forks source link

TSM is killing SSDs by constantly saving sessions even if nothing was changed #467

Open bug-re-port-er opened 5 years ago

bug-re-port-er commented 5 years ago

Short description

Tab Session Manager is killing SSDs by constantly saving sessions even if nothing was changed [no new/closed tabs, windows etc.].

Steps to reproduce

Auto save > Save the session regularly YES Save the session regularly > Interval (minutes) VALUE

Expected result

Sessions should only be saved every VALUE seconds only if there was a change.

Actual result

Sessions are always saved every VALUE even if there was no change. Note that this is not visible in the UI (no new save entry is created).

Platform information

sienori commented 5 years ago

No, the session will not be saved if there are no changes to the tabs. The auto-save feature checks the open tab every VALUE seconds and saves a new session only if there are changes since the last auto-save session. I think it will use memory but it won't use storage.

soredake commented 4 years ago

@sienori Is it normal that addon frequently opens files for create and write even if i disabled all auto-saving?

firefox(1823): CW /home/bausch/.mozilla/firefox/tor-main/storage/default/moz-extension+++cb292664-ea19-4984-be55-2568b44c9c49^userContextId=4294967295/idb/3647222921wleabcEoxlt-eengsairo.sqlite-wal (deleted)
firefox(1823): CW /home/bausch/.mozilla/firefox/tor-main/storage/default/moz-extension+++cb292664-ea19-4984-be55-2568b44c9c49^userContextId=4294967295/idb/3647222921wleabcEoxlt-eengsairo.sqlite
firefox(1823): CW /home/bausch/.mozilla/firefox/tor-main/storage/default/moz-extension+++742a8a0e-4b0b-4277-8352-85580d35c01d^userContextId=4294967295/idb/3647222921wleabcEoxlt-eengsairo.sqlite-wal
firefox(1823): CW /home/bausch/.mozilla/firefox/tor-main/storage/default/moz-extension+++742a8a0e-4b0b-4277-8352-85580d35c01d^userContextId=4294967295/idb/3647222921wleabcEoxlt-eengsairo.sqlite
mesvam commented 4 years ago

I can confirm this.

Even though no new sessions appear in the pop-up dialog, whatever the addon is doing, it's still causing Firefox to make a write to disk every time a tab is opened or closed. With large sessions this can add up to over 100 GiB worth of writes per day.

I logged disk writes while opening some tabs and it looks like Firefox is writing the entire session data into the IndexDB store on every tab action. Each session generates a file in the extension's idb\1782160246ssensosi.files folder and the latest data overwrites the most recent file immediately with no delay, every time session state is changed. When the set interval value expires, it keeps the latest file and creates a new one. The file modification times also back this up. I find a bunch of files modified at very regular intervals, except for the latest one, who's modification time updates every time I open a tab. Disabling auto-save seems to stop the writes.

mesvam commented 4 years ago

Investigating further, only disabling auto-save does not seem to stop the writes. All three of these options must be off simultaneously:

Even if you only have the first option "Save the session regularly" disabled, but if either of the other two are still enabled, then performing any session change (like opening a tab), even without closing windows or exiting browser, will incur a full disk write.

Note that this all happens despite the UI not showing any change or that any session was saved, so do not rely on the UI.

There is definitely something weird about the auto-save behavior. Please investigate

mikhoul commented 4 years ago

https://techreport.com/review/27909/the-SSD-endurance-experiment-theyre-all-dead/

soredake commented 3 years ago

No progress on this?