Closed Bug 427468 Opened 16 years ago Closed 16 years ago

Session restore sometimes fails to restore (after an OS shutdown?)

Categories

(Firefox :: Session Restore, defect)

All
macOS
defect
Not set
normal

Tracking

()

RESOLVED INCOMPLETE

People

(Reporter: bzbarsky, Unassigned)

Details

(Keywords: dataloss)

I apologize in advance for the vagueness of this bug, and more importantly for the fact that I don't know how to reliably reproduce it.  If there is any information that I can provide to help in debugging this that wouldn't take me hours to collect, please let me know.

Three times in the last 4 days, session restore has failed to restore my session.  I have the browser set to load my homepage on startup in preferences.  When I quit the browser, I get a dialog which asks:  "Do you want Minefield to save your tabs for the next time it starts?"  I select "Save and Quit".  Usually, when I restart the tabs are restored.  In the failure cases, the homepage has been shown instead, and the add-on manager window was shown.  The infobar in this claimed that two extensions were installed, and the main area was blank.  I had not in fact installed any extensions before quitting.  Given the correlation, I assume the two are somehow related.

I did just try to reproduce by installing a nightly update, then quitting with Command-Q, then starting the browser.  I also tried disabling an extension, then quitting with Command-Q and then starting the browser.  Then I tried the same, but with enabling an extension.  None of these reproduced the problem.
Are you running a current trunk build? There was a bug that would cause the add-ons manager to pop up at inappropriate points in older builds.
I was running a nightly that I probably updated to on Friday morning.
I think this may be a regression that occurred somewhere at the beginning of April.  The original reporter of this bug was using a Mac, however, there were two other similarly intentioned bug reports that I have found within the week that this one was posted which were similar.  One was also reported as a Mac bug (Bug 428086), the other was reported as All (Bug 428360). If there is a separate Mac bug here, then please forgive me, but I am experiencing something very similar on XP, and think this may be more than just a Mac issue.

It seems like these similar bug reports (this one being the earliest on I could find) are all describing a bug where the reporter is successfully exiting Firefox (e.g. no abnormal termination of the program is involved).  These do not deal with session restores not working on crashes or when the process is forced to close.

Some of the reporters had the "Save and Quit" prompt disabled ("Do not ask next time"), and some don't, so I don't think that is where this issue lies.  I just think it means that the issue lies within successful exiting of the program.  For me personally, I don't have the prompt disabled. 

I thought this was only happening when I was opening Firefox up by way of an external link, but this isn't the case.  When I run firefox.exe, it still doesn't work.

Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9pre) Gecko/2008052006 Minefield/3.0pre ID:2008052006
OS: Mac OS X → All
Hardware: Macintosh → All
Summary: Session restore sometimes fails to restore → Session restore fails to restore tabs on restart when Firefox is successfully exited (not forced to close or crashed)
Steps to Reproduce:

1.) Open at least two links in separate tabs (say igoogle.com and this bug report)
2.) Specifically click the 'X' button to close the Firefox window (not File -> Exit)
3.) Click "Save and Quit" if you have Firefox prompt you here
4.) Re-open Firefox by running firefox.exe

Expected Results:
The tabs are restored.

Actual Results:
A blank tab is restored.
In which nightly build was "Save and Quit" implemented?  I someone can tell me, we can test to see if this is a regression.
Summary: Session restore fails to restore tabs on restart when Firefox is successfully exited (not forced to close or crashed) → Session restore fails to restore tabs on restart when Firefox is successfully exited with the 'X' button (e.g. not forced to close or crashed)
Moving severity up to "Major" as this is the most common way that people close the browser, and the feature is completely broken.
Severity: normal → major
(In reply to comment #4)
This is WORKSFORME, at least on Windows. Can you reproduce this on a clean profile or could it be extension related?
(In reply to comment #7)
> (In reply to comment #4)
> This is WORKSFORME, at least on Windows. Can you reproduce this on a clean
> profile or could it be extension related?
> 

I investigated further, and it does, indeed, work on a clean profile.  It looks to be a prefs.js problem for me, as extensions being on or off didn't matter, but having Firefox create a new prefs.js file fixed the problem.  Now, this isn't to say that it couldn't still be a bug, though.  It could be that one setting is clashing with another.  I guess I will delete prefs one line at a time and see if I can find the problem, then I'll get back to you.
I found the bug.  When Sanitize on Shutdown is set to true, and it is set up to clear your "Browsing History", is when it breaks.
Summary: Session restore fails to restore tabs on restart when Firefox is successfully exited with the 'X' button (e.g. not forced to close or crashed) → Session restore ("Save and Quit") fails to restore tabs on restart when Firefox is successfully exited with the 'X' button, and Sanitize on Shutdown is set to clear "Browsing History" (e.g. not forced to close or crashed)
Summary: Session restore ("Save and Quit") fails to restore tabs on restart when Firefox is successfully exited with the 'X' button, and Sanitize on Shutdown is set to clear "Browsing History" (e.g. not forced to close or crashed) → Session restore ("Save and Quit") fails to restore tabs on restart when Firefox is successfully exited with the 'X' button (e.g. not forced to close or crashed), and Sanitize on Shutdown is set to clear "Browsing History"
(In reply to comment #9)
That's bug 398817 and certainly not what Boris reported in comment #0.
BTW: Boris, has this ever happened again with RC1?
Severity: major → normal
OS: All → Mac OS X
Summary: Session restore ("Save and Quit") fails to restore tabs on restart when Firefox is successfully exited with the 'X' button (e.g. not forced to close or crashed), and Sanitize on Shutdown is set to clear "Browsing History" → Session restore sometimes fails to restore
(In reply to comment #9)
That's bug 398817 and certainly not what Boris reported in comment #0.

Hopefully Boris gets back to you with something more specific.  My guess was that he was experiencing Bug 398817 and not knowing that that is what it was.  The two are not necessarily mutually exclusive.  But anyway, thanks for pointing out Bug 398817 to me, as that is where I need to be focusing my efforts.
I have no idea whether this still happens: I no longer rely on session restore to work.

It's certainly not bug 398817, since I have never used the "Sanitize on Shutdown" feature and am not using it now.
To be more precise, I no longer rely on this dialog to work; I've just set preferences to always restore my tabs from last time, and deal with the cases when that gives me broken behavior as they happen by deleting sessionstore.js manually.
Boris: What kind of broken behavior are you referring to that requires actually deleting sessionstore.js? And are you still experiencing Session Restore to fail at all?

If so, getting my hands on one of your defect sessionstore.js files would certainly help (should you start Firefox through a script, just having it create a backup of sessionstore.js before actually launching Firefox would be enough to ensure that Firefox doesn't overwrite the file before you can get to it).
The broken behavior is when I did not in fact want to restore the tabs but have to (because that's the preference setting).

> And are you still experiencing Session Restore to fail at all?

As I said in comment 14, I'm no longer trying to cause it to fail; instead I'm doing what I can to avoid the failure scenario...
Right, so by broken you mean that Firefox tries to restore tabs that you didn't want it to - and you didn't have a chance to reasonably opt out from. That's bug 407117, then.

As for my question about failures: Have you ever had Session Restore _not_ restore all the tabs it should have (which with your settings it should be doing all the time)? If not, I'd like to close this bug as INCOMPLETE to get it off my query of issues yet to be debugged.
> As for my question about failures: Have you ever had Session Restore _not_
> restore all the tabs it should have

Yes, when I had my preferences set as in comment 0....

I've been thinking some more.  If the preferences are set as in comment 0 and the browser is shut down without user interaction (e.g. OS shutdown), there is clearly no prompt.  In that case, do we default to restoring the tabs, or not?
(In reply to comment #18)
> the browser is shut down without user interaction (e.g. OS shutdown), there is
> clearly no prompt.

Actually, you shouldn't be able to shut down the browser without user interaction unless you've set Firefox to always resume the session or you've got only a single tab open (and in both cases, you wouldn't get the Quit prompt, either). So, if you manage to shut down Firefox without a Quit prompt when there should have been one, Session Restore is just as likely to fail because of the same base problem (because we rely on the same "quit-application-*" notifications). Such a bug would rather belong into 'Toolkit:XRE Startup', though.
> Actually, you shouldn't be able to shut down the browser without user
> interaction

Uh...  I gave an obvious example of just such a shutdown above: OS shutdown.

That is, the prompt may come up; I have no idea.  But if the process doesn't shut down cleanly, the OS will just kill it as it comes down.  In any case, we don't block OS shutdown on MacOS on this prompt, as far as I recall.
So, one possible issue here is that OS X doesn't allow Firefox to properly quit - resp. that Firefox doesn't properly react to a shutdown on OS X. Whichever it is, somebody actually running OS X will have to figure it out... Thanks for the hints, Boris.
Summary: Session restore sometimes fails to restore → Session restore sometimes fails to restore (after an OS shutdown?)
I'm happy to test myself if you give me a good idea of how to do it without wiping out my existing sessionstore stuff.  e-mail is fine if you don't think it's relevant to this bug.
Alright, to verify my assumptions, that'd be the following steps to reproduce:

1. Create yourself a new profile (or make sure that Firefox asks whether to save all tabs when quitting and that you're warned when otherwise closing a window with multiple tabs, and copy sessionstore.js out of your profile while Firefox doesn't run so that you can later restore your current session)

2. Open three windows with each containing two tabs with content of your choice (e.g. Google searches for "one", "two", "three", etc. so you can tell them apart)

3. Quit Firefox through Cmd+Q or File -> Exit and have it save the tabs

4. Make a copy of sessionstore.js and attach it to this bug for reference

5. Run Firefox again and make sure that all three windows are correctly restored

6. Wait about 15 seconds and then just shut down your OS (note if you get any prompts from Firefox during shut down)

7. Right after rebooting, make another copy of sessionstore.js and also attach it to this bug

8. Now restart Firefox and check whether all tabs are correctly restored

(9. For good measure: repeat a second time to verify that the observed behavior might indeed be consistent)

I'd expect that you're either prompted at step 6 (which happens on Windows) or that you get a Session Restore prompt at step 8. If it's neither, our UI team will have to confirm that we indeed want a complete session restoration without prompting on OS X.

Anyway, should you follow through with the above steps: Thanks for your time.
I'm not going to bother attaching the sessionstore files, since I didn't reproduce the bug...  At step 6, I get a prompt if I'm the one shutting down the OS (and shutdown doesn't proceed until I deal with the prompt).  If another user shuts down the OS, I get a session restore prompt in step 8.

I guess we should indeed resolve as incomplete for now, and if I can think of some other thing that might have triggered this I'll reopen...
Status: NEW → RESOLVED
Closed: 16 years ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.