Open Bug 1298912 Opened 8 years ago Updated 2 years ago

Multiple snapshot: Perform periodic session backup and let the user restore a particular backup

Categories

(Firefox :: Session Restore, enhancement)

enhancement

Tracking

()

Tracking Status
firefox51 --- affected

People

(Reporter: cwiiis, Unassigned)

References

(Blocks 4 open bugs)

Details

Attachments

(1 file)

Usually about every month or so, I manage to lose my session. While the relief of not having the couple of hundred tabs I usually have open hang over me is almost palpable, this is a bit annoying and entirely unnecessary.

At some point, after years of having this problem, perhaps we should concede that it's possible, maybe even through the fault of the user, that their session gets irrecoverably lost. For example, you may accidentally open a window, close your original window with all your tabs, then close the second window. Or you may just get unlucky with a Nightly update.

We should periodically backup the users' session and provide UI to view/restore a particular session backup.
There is already sessionstore-backups folder with a few days of backups. Though I don't believe there is any UI for restoring them.
(In reply to Kevin Brosnan [:kbrosnan] from comment #1)
> There is already sessionstore-backups folder with a few days of backups.
> Though I don't believe there is any UI for restoring them.

oh wow, really? I should probably look at that...

I think it would be nice if we detect that Firefox starts up with no tabs, or only has a window with one tab open, when last time there was a window open, there were X tabs (>= 5 or something?), we could provide a "Where'd my tabs go?" bubble/pop-down/notification/link/whatever. i.e. if the session is empty when in the last session or two, it was decidedly not-empty, we should take action.
sessionstore-backups indeed keeps a few backups, see https://dutherenverseauborddelatable.wordpress.com/2014/06/26/firefox-the-browser-that-has-your-backup/ for more details. If Session Restore detects that the session has been lost, it automatically falls back to a backup. Currently, we assume that session lost == invalid json, but if you can think of other heuristics, that would be useful, too.
(In reply to David Rajchenbach-Teller [:Yoric] (please use "needinfo") from comment #3)
> sessionstore-backups indeed keeps a few backups, see
> https://dutherenverseauborddelatable.wordpress.com/2014/06/26/firefox-the-
> browser-that-has-your-backup/ for more details. If Session Restore detects
> that the session has been lost, it automatically falls back to a backup.
> Currently, we assume that session lost == invalid json, but if you can think
> of other heuristics, that would be useful, too.

I guess the problem is cases where the session manages to get emptied (failed or accidentally cancelled recoveries, accidentally closing windows, unforseen conditions, haywire add-ons, etc.) - it would be good if we had some kind of 'soft' recovery option where we could prompt a user that we think maybe they lost their session, but maybe not. Like a bubble or one of those little bars that we use for enabling plugins and such.

My suggested heuristic would be 'current session is empty, a recent (say, within 24 hours) session backup exists'. Under this condition, it would be good to prompt the user that they can restore the non-empty session backup, if they'd like (and if they explicitly cancel, then of course, don't ask again).
Nightly just lost my session, again.

I actually had a lot of work-related tabs and would like to recover my session - I've backed up my session files, could anyone give some brief instructions on how you go about manually recovering a session?
(In reply to Chris Lord [:cwiiis] from comment #5)
> Nightly just lost my session, again.
> 
> I actually had a lot of work-related tabs and would like to recover my
> session - I've backed up my session files, could anyone give some brief
> instructions on how you go about manually recovering a session?

How about replacing the files mentioned in Yoric's comment 3, with the one you backed up? (When Firefox is not running)

If that doesn't work, extracting URLs from JSON and using "Bulk URL Opener" like add-on might be a less efficient way.
(In reply to Chris Lord [:cwiiis] from comment #5)
> Nightly just lost my session, again.
> 
> I actually had a lot of work-related tabs and would like to recover my
> session - I've backed up my session files, could anyone give some brief
> instructions on how you go about manually recovering a session?

You might want to try the way in bug 1365713 comment 0.
Since the break of the handy extension 'session manager' was introduced by our transition for WebExtension, some of my colleagues(who is either using Nightly or Release version) start to encounter a situation:
1. run into a mysterious session lost (for many possible reasons)
2. but have no 'session manager' to recover.

They might be able to find an old backup in profile folder, but way too old.

Implementing a UI for users to select/restore might not be easy at this moment, we probably could consider implementing a trivial snapshot mechanism which periodically saves session into the profile folder and at least advanced user can find it if they are very painful and eager to recover their working session.

For example, we could save the session every hour (or even every day), and only keep the last 10 sessions to avoid excessive backup files.

I think this can largely ease the pain of users who lost their valuable session.
Summary: It is too easy to lose your session: We should perform periodic session backup and let the user restore a particular backup → Multiple snapshot: Perform periodic session backup and let the user restore a particular backup
Mike, what do you think about the comment 8? 
Is that a bad idea at this moment? :)
Flags: needinfo?(mdeboer)
Hmm, sure, might be something worth having - pref'ed off by default, of course.
Flags: needinfo?(mdeboer)
Hi Mike,

I already made a patch which done the comment 8, could you help to give feedback? :)

- It's pref'ed off by default
- If enabled, make snapshot every 1 hour
- Keep the last 10 snapshots to avoid excessive backup files

Minor:
- refactor for reusing functions
- remove legacy code

If this patch is OK, I will add more comments and polish it for your review.

(BTW, just for your information, while making this patch, I saw a comment(bug 1201111 comment 1) which raise the similar requirement)
Attachment #8924079 - Flags: feedback?(mdeboer)
Cool stuff! I think it'd be a very good idea to get this in, but I'd really like to add a control interface in about:preferences for this feature as well, because it'd be a shame to have beneath the surface from the start.

I have a number of comments about the implementation of this patch, would you like me to post those here? Or wait for the next iteration?
Attachment #8924079 - Flags: feedback?(mdeboer)
(In reply to Mike de Boer [:mikedeboer] from comment #12)
> Cool stuff! I think it'd be a very good idea to get this in, but I'd really
> like to add a control interface in about:preferences for this feature as
> well, because it'd be a shame to have beneath the surface from the start.
Nice :D
Exposing this feature to about:preferences would be great to many users!
Could you share a bit about your imagination for the control interface?
such as, what kind of options we would like to offer, say:
A = "show your windows and tabs from last time"
B = Multiple snapshots

Possible options:
1. enable both A and B (likely)
2. enable A, disable B (a bit strange?)
3. others?

Besides,
as comment 8 mentioned, implementing a UI for users to select/restore might not be trivial, what do you consider about this part, or did I take it too complicated?


> I have a number of comments about the implementation of this patch, would
> you like me to post those here? Or wait for the next iteration?
I'm more than happy to receive your feedback, which is very valuable to me.
Could you share them with me? Thus I can fix/adjust my patch in the earlier stage :)
> Exposing this feature to about:preferences would be great to many users!

This will be definitely nice to have this option in about:preferences 
But even better would to have it separately, the same way like History or Bookmarks


> Could you share a bit about your imagination for the control interface?
> such as, what kind of options we would like to offer, say:
> A = "show your windows and tabs from last time"
> B = Multiple snapshots
> 
> Possible options:
> 1. enable both A and B (likely)
> 2. enable A, disable B (a bit strange?)
> 3. others?
> 
> Besides,
> as comment 8 mentioned, implementing a UI for users to select/restore might
> not be trivial, what do you consider about this part, or did I take it too
> complicated?


Is it possible at this time to have the following options?:

* setting up the number of sessions stored

* setting up period between session savings

* opening separate window (pop-up or in different tab) showing 
   a) variant A (easier): sessions saved (date, number of windows/tabs)
   b) variant B (better): sessions saved (date) + for each session: list of windows and tabs (like in Session Manager); 
      it should be possible to unclick some windows or tabs
   # it should be possible to delete session or save with generic name
   # option to add saved session (or part - by ) to current session as separate windows or to add tabs to current window

* option to save session at this moment with date or better with chosen name

* option to create button1 next to address bar; this button should open menu with preferences for session restore

* option to create button2 next to address bar; this button should open menu for saving current session

* option if session opening is done using lazy tabs


If you can please, check Session Manager for more ideas.

Thanks
Supplemental information to comment 14 & 13

Related bugs describing the most important futures needed which should be introduced together with Bug 1298912:
Bug 845820
Bug 591957
Bug 1301041
Bug 1421673
(In reply to Robert Ab from comment #15)
> Supplemental information to comment 14 & 13
> 
> Related bugs describing the most important futures needed which should be
> introduced together with Bug 1298912:
> Bug 845820
> Bug 591957
> Bug 1301041
> Bug 1421673

Other important bug:
Bug 590448
Lost my session *again* today, this time in release Firefox on a Mac after it upgraded to the most recent version. When the browser started up again, it remembered 2 of my app tabs, then it had 2 other empty app tabs and no restored tabs (I had several dozen open).

Firefox's session storage and recovery is very clearly not infallible, is there any chance of something being done about this? This is the sort of thing that makes people switch browsers, and is so unnecessary. We shouldn't be telling users "Oh, Firefox does store all that data, but it's in some hidden directory and you'll need to copy and rename some of these files, and you'll have to find the right session by trial-and-error"

n?yoric, sorry if you aren't the correct person, I haven't really kept up with things enough to know who to ping for this.
Flags: needinfo?(dteller)
here i made an addon for you nightly and beta guys ! dont loose your sessions anymore :) i know how it hurts!

https://github.com/Ulf3000/sessionBuddy

for you mozilla employees , please recycle my addon .. its really just so easy .. 


the buildin sessionstore service or jsm is perfect never failed me in all the years !
(In reply to alexmehler from comment #18)
> here i made an addon for you nightly and beta guys ! dont loose your
> sessions anymore :) i know how it hurts!
> 
> https://github.com/Ulf3000/sessionBuddy
> 
> for you mozilla employees , please recycle my addon .. its really just so
> easy .. 
> 
> 
> the buildin sessionstore service or jsm is perfect never failed me in all
> the years !

That looks very interesting! At the risk of being off topic, how reliable is it? Do you really think it's reliable enough for Firefox to incorporate it?
> … risk of being off topic, …

FYI we also have discussions of alexmehler's SessionBuddy at <https://redd.it/9oygw7> (original), <https://redd.it/9p0z2r> and the Firefox subreddit at <https://www.reddit.com/comments/9ojqi0/-/e7xl5l8/>
(In reply to swleefers from comment #19)
> (In reply to alexmehler from comment #18)
> > here i made an addon for you nightly and beta guys ! dont loose your
> > sessions anymore :) i know how it hurts!
> > 
> > https://github.com/Ulf3000/sessionBuddy
> > 
> > for you mozilla employees , please recycle my addon .. its really just so
> > easy .. 
> > 
> > 
> > the buildin sessionstore service or jsm is perfect never failed me in all
> > the years !
> 
> That looks very interesting! At the risk of being off topic, how reliable is
> it? Do you really think it's reliable enough for Firefox to incorporate it?

yes it is , id say it is 98% reliable now .. it is basically just a menu and a folder which saves some session backupfiles , the format and internal saving/loading is the same as the crash sessionrestore from mozilla(and that system is literally bugfree), theres no custom module or function or sorting happing from my side - just saving/restoring the restorepoint with mozilla's internal module "sessionstore.jsm". 

mozilla could make it even more reliable though , im just grabbing one of two backupfiles on firefox startup and make a copy of it into another folder and leave the 20 most recent  backups in that folder , 
mozilla could obviously just save to that folder directly (which would make it 100% reliable)
(i could also just grab my session and save it every 15 seconds directly to my folder, like the browsers does , that would make my addon 100% reliable but want to try it like this for now , should it ever fail ill just implement it and be good)
(In reply to swleefers from comment #19)


the reason firefox`s session restore sometimes fails is NOT becasue the sessionrestore system is buggy .. its just that sometimes its missing the data file , thats all really .. would they just save a list of 10 files instead of just 1 and delete the backupfile after startup instead on shutdown theres no chance they could ever loose the sessions, NEVER , thats why i say its so easy and basically hassle free .. i programmed that thing in a few days , the wizards from mozilla could make this in a n evening
Forwarding the ni? to mdeboer, who has been working on this more recently than me.
Flags: needinfo?(dteller) → needinfo?(mdeboer)

I've lost my tabs four times over the last three months, on both release Firefox on Windows (once), and release Firefox on Android (thrice). I was doing nothing unusual, as far as I can remember - no multiple windows open, no crashes... It'd been months, possibly years since it last happened, so it feels like something has changed recently to have such a spate.

And, while a recovery UI as described here might be nice, why is it even necessary? I've never lost tabs on any other browser. What are they doing that Firefox isn't?

See Also: → 1512802
Blocks: 1512802
See Also: 1512802
See Also: → 1445464
See Also: 1445464

It's highly unlikely that I will have the time available to spend on this feature, unfortunately.

Flags: needinfo?(mdeboer)
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: