Closed Bug 1294507 Opened 9 years ago Closed 9 years ago

sessionstore.js file lost after restart of Firefox (from an upgrade), and then crash

Categories

(Firefox :: Session Restore, defect)

defect
Not set
critical

Tracking

()

RESOLVED WORKSFORME
Tracking Status
firefox51 - wontfix

People

(Reporter: whimboo, Assigned: wiwang)

References

Details

(Keywords: dataloss)

Today I upgraded to the latest Nightly build (20160811) and got a crash during the first startup right after the update. Specifically this is bug 1294449. So I restarted Firefox once again but nothing changed and Firefox crashed again while trying to restore my tabs from the last session. Then the sessionstore.js file was gone completely from my profile, so that I didn't even see about:sessionstore anymore during startup. :( Copying back the last version of the backup folder also didn't help, and the file always gets removed when Firefox crashes during startup. I call this a serious dataloss bug for normal users who do not know about the backup folder. They would completely loose their whole last session. Mike mentioned that we might have to write a bak file in case writing to sessionstore.js fails, and the file gets corrupted. But AFAIR that is what we were doing in the past. Maybe something has been changed here?
I don't know if things are worse recently for losing session data, but I personally have lost sessions about 4 times in the last 2-3 months. The stream of bug reports is pretty steady over the last 8 months [1] (modulo at least two reports in the bug query that are not really session loss). 4 reports are in the last 3 months. I've been triaging the bug reports over the last few weeks but it's slow going - especially when you lose sessions yourself :( (as I just did this morning) [1] https://bugzilla.mozilla.org/buglist.cgi?keywords=dataloss&keywords_type=allwords&list_id=13171124&o1=nowordssubstr&chfield=[Bug%20creation]&chfieldfrom=8m&f1=short_desc&o3=anywordssubstr&classification=Client%20Software&classification=Components&chfieldto=Now&query_format=advanced&f3=short_desc&f2=OP&component=Session%20Restore&product=Firefox&bug#
Summary: sessionstore.js lost after crash and restart of Firefox → sessionstore.js file lost after restart of Firefox (from an upgrade), and then crash
[Tracking Requested - why for this release]: This happened to me again now. After Firefox was frozen I had to kill it via the shell. After a restart Firefox does no longer who the session to be restored. Only the app tabs are restored. Copying back a file from the backup directory doesn't make a difference. I'm not able to restore my previous session. Can we please get this investigated ASAP? This really sounds like an awful user experience.
Flags: needinfo?(mdeboer)
Is there a way to turn on debugging for sessionstore? I would like to see why the sessionstore backup file is getting discarded during startup.
Tracking 51+ since this is dataloss - we need someone to own answering the questions Henrik has as well as the bug investigation.
Version: 42 Branch → Trunk
Hi :mconley, Not sure if your are the right one for this issue, can you help shed some light here or help find an owner for this bug?
Flags: needinfo?(mconley)
(In reply to Gerry Chang [:gchang] from comment #5) > Hi :mconley, > Not sure if your are the right one for this issue, can you help shed some > light here or help find an owner for this bug? Going to defer to mikedeboer on this for now, since he owns Session Store.
Flags: needinfo?(mconley)
Apologies for being late here, even though this is indeed potentially a big issue. Henrik, have you found a way to reproduce this state (more-or-less-)reliably? Were the previous.js and recovery.js files empty?
Flags: needinfo?(mdeboer) → needinfo?(hskupin)
Mike, I just noticed that for the affected profile the preference with the name of browser.sessionstore.resume_from_crash had a user value of False. Not sure why this happened, given that I definitely haven't done it manually. Could this maybe related to this issue at least partly? I haven't had crashes in the last time, so I haven't seen it again. But if you want to test yourself you can use the crash me now simple extension: https://addons.mozilla.org/en-US/firefox/addon/crash-me-now-simple/?src=search
Flags: needinfo?(hskupin)
I assume comment 8 is directed at mikedeboer?
Flags: needinfo?(hskupin)
Sure, or anyone else who knows about sessionstore and give a reply.
Flags: needinfo?(hskupin)
A quick scan around the tree shows that the pref is set to true by default, and we don't seem to ever write to it. http://kb.mozillazine.org/Browser.sessionstore.resume_from_crash gives details on what the pref does. My best guess is that it was either set by an add-on, or set/forget during some debugging.
So this pref is responsible for reloading the session after a restart when Firefox crashed. But I don't think it will stop generating the sessionstore.js file in case of crashes. So loosing this file should not be tied to this preference and whichever setting it has.
Normally, we don't have any code that removes sessionstore.js but we do have code that renames sessionstore.js to sessionstore-backups/previous.js (overwriting previous.js if it already exists). This should only happen after a clean recovery but I don't remember that we tested the behavior if `browser.sessionstore.resume_from_crash` is `false`, so there exists a possibility that it was moved, then overwritten with an empty file. We should write a test that tests this behavior.
Hi :mikedeboer, can you help find someone who can work on this?
Flags: needinfo?(mdeboer)
Hi :mikedeboer, I can help with this bug if you are OK. And as you mentioned in comment 7, we might still need a reliable STR to speedup, I am currently trying to reproduce with changing the related pref as comment 12/13 mentioned. Hi Henrik, Could you share more STR if it's possible? Thanks a lot!
Flags: needinfo?(hskupin)
QA Contact: wiwang
Assignee: nobody → wiwang
QA Contact: wiwang
Thanks much, Will, for stepping up here! Please feel free to reach out to me if you need any help.
Flags: needinfo?(mdeboer)
Hi mikedeboer, Many thanks for your friendly reply! I am going to need your confirmation below :p Hi Henrik, AFAIK, here are some info which might be needed for your reference, hope these help! 1. > the sessionstore.js file was gone completely from my profile sessionstore.js does not exist during the firefox runtime(renamed/moved after few seconds of firefox startup), and it will only be written to disk during the normal firefox shutdown process. As a result, it's a expected behavior since firefox crashes. 2. > I didn't even see about:sessionstore anymore during startup. sessionstore.js is not the only source of about:sessionREstore (not identical to about:sessionstore, which can be related with an add-on[1]), I suppose that's why :mikedeboer mentioned previous.js and recovery.js in comment 7, since session store can recover session from a series of files according to a order[2]. Besides, at least two pref are both needed to set properly for showing up the about:sessionrestore page: a. browser.sessionstore.resume_from_crash [3]: as you noticed in comment 8 b. browser.sessionstore.max_resumed_crashes [4] 3. > the file always gets removed when Firefox crashes during startup In fact, during each normal startup, firefox will rename/move it to sessionstore-backups/previous.js(ref comment 13) In sum, if I understand correctly: - Losing sessionstore.js should not be a problem here(we still have many other files for recovering). - Pref on the resume_from_crash will bring your session back in case of crashes since then(hope for no more crashes :/ ). Can these info solve your questions? please ni me if you need :) Hi mikedeboer and Yoric, Could you please help to confirm the info above? As a new comer of session restore, I might miss something, thanks for your help! :) [1] https://addons.mozilla.org/en-US/firefox/addon/about-sessionstore/ [2] http://searchfox.org/mozilla-central/rev/f5c9e9a249637c9abd88754c8963ecb3838475cb/browser/components/sessionstore/SessionFile.jsm#158-174 [3] http://kb.mozillazine.org/Browser.sessionstore.resume_from_crash [4] http://kb.mozillazine.org/Browser.sessionstore.max_resumed_crashes
Flags: needinfo?(mdeboer)
Flags: needinfo?(dteller)
Nothing to add. Well, one thing actually: I pointed out in comment 13 that there is at least one codepath that we haven't tested. I believe that it would be useful to write a test – and determine whether it's the right behavior. I'm pretty sure I saw someone volunteer to do just that in comment 15 :)
Flags: needinfo?(dteller)
I've got nothing to add to David's comment... Will, would you like to write a test as described in comment 13?
Flags: needinfo?(mdeboer)
(In reply to Will Wang [:WillWang] from comment #17) > In sum, if I understand correctly: > - Losing sessionstore.js should not be a problem here(we still have many > other files for recovering). > - Pref on the resume_from_crash will bring your session back in case of > crashes since then(hope for no more crashes :/ ). > > Can these info solve your questions? please ni me if you need :) I think that all this is correct! Thanks for that interesting information. I actually haven't noticed that we changed the behavior in how the files are handles. Formerly this js file and its backup where always present in the profile folder. So I also re-enabled the `resume_from_crash` preference given that something disabled it. The pref for `max_resumed_crashes` still has 1 as value and looks to be fine. Currently everything is working as expected on my Macbook and I believe it would also work on my former Linux machine. So I would say we close this bug as WFM based on the fact that sessionrestore was disabled for crashes.
Flags: needinfo?(hskupin)
Sure! Testing more code paths sounds great and make session restore more reliable! I would file a follow-up bug for writing that test and start to investigate, thanks!
(In reply to Henrik Skupin (:whimboo) from comment #20) > I think that all this is correct! Thanks for that interesting information. I > actually haven't noticed that we changed the behavior in how the files are > handles. Formerly this js file and its backup where always present in the > profile folder. > > So I also re-enabled the `resume_from_crash` preference given that something > disabled it. The pref for `max_resumed_crashes` still has 1 as value and > looks to be fine. Currently everything is working as expected on my Macbook > and I believe it would also work on my former Linux machine. > > So I would say we close this bug as WFM based on the fact that > sessionrestore was disabled for crashes. Henrik, Thanks for your report and following replies for clarifying the pref, and this also help us to discover one more code path which can be tested, thanks!
See Also: → 1315310
Will is going to continue work in bug 1315310 and following comment 20, we can close this bug. Thanks all!
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → WORKSFORME
Per comment #20, mark 51 won't fix and track 51-.
You need to log in before you can comment on or make changes to this bug.