Closed Bug 670308 Opened 9 years ago Closed 9 years ago

Sessions get corrupted randomly (tabs lost after session restore)

Categories

(Firefox :: Session Restore, defect, critical)

5 Branch
All
Other
defect
Not set
critical

Tracking

()

VERIFIED DUPLICATE of bug 669196

People

(Reporter: remixedcat, Unassigned)

References

Details

User Agent: Mozilla/5.0 (Windows NT 6.0; WOW64; rv:5.0) Gecko/20100101 Firefox/5.0
Build ID: 20110615151330

Steps to reproduce:

I would have my 22 tabs open
I would close the browser for any reason (like shutting down or installing addons or becuase I needed to close it for gaming)
I would re open Firefox
I would only have 8 of the 22 last opened tabs restored. 
I had it set to re-open my last tabs as my home page.


Actual results:

it would only re-open 8 of the 22 tabs I had open for example, instead of loading all the tabs I had open last time. 


Expected results:

it should have re-opened all my tabs.
Please check that the sessionstore.js file in your profile (in C:\Documents and Settings\username\Application Data\Mozilla\Firefox\Profiles\random-profile-name\) is updated within a few seconds of you loading a page or typing into a form in a page.

Is the set of 8 tabs that reopen always the same?
yes and no....
See also http://forums.mozillazine.org/viewtopic.php?f=23&t=2244623
Severity: normal → critical
Status: UNCONFIRMED → NEW
Component: Tabbed Browser → Session Restore
Ever confirmed: true
Keywords: dataloss, regression
QA Contact: tabbed.browser → session.restore
Version: 8 Branch → 5 Branch
Thank you. Glad I'm not the only one.
I think the better title would be "Firefox is randomly forgetting last opened tabs". But that might be just me.
Summary: does not restore all of my last opened tabs → Sessions get corrupted randomly
It lost my entire session (which is still there, backed up as sessionstore.bak, but manually restoring it does nothing).

sessionstore.js seems to be updating as expected. It just won't load the old one. My old session is quite large, about 40 tabs in a 905KB file.
This time it resumed with all 23 tabs in tact and in order. It does seem to be intermittent.
It happened again today. this time only 6 were resumed.
Depends on: 669196
Is there a pattern?
I believe if there's a JS error restoring a tab it may stop; do you have a copy of the sessionstore.js that caused the problem?  Can you tell us what the tab held?  

If you can either post the sessionstore (if it's not full of sensitive info), or use a JSON-pretty-printer on Linux to find the tab and cut-and-paste the data for just that tab, that would help a lot.  If this would work, I can point you to instructions.

SessionManager (extension) makes it a lot easier to hunt down a "bad" tab that causes problems restoring.
I can't post the sessionstore.js too sensitive at the moment... 

the dates and times do change on it and the size changes.... I'm on windows so I can't do the pretty-printer thing...
I just fired up Firefox to try and install SessionManager to follow the above suggestion, and, after about 3 minutes of showing nothing on screen as it was churning though Cache.Trash, it comes up saying it can't restore my latest session, which was just one window and one tab. I can't post that sessionstore.js up here because it's 26KB and contains lots of browsing history, but for what it's worth I can open it using Python's JSON library and it seems to parse perfectly. The same applies for the previous session I mentioned above (the 40 tab, 905KB one). So I don't think it's a problem with the format of the data or anything.
I've analyzed my sessionstore.js on 2 cases where it went wrong, did it through jsonlint since I'm also on windows.
I've found that some windows._closedTabs.state.storage elements had unescaped quotes.
It was always under "http://www.google.com" if it helps.

Some samples :
- <a href=\\\"#\\\">Undo</a></div><div class=\\\"f kb\\\">1 answer - 11 Jul 2010</div><span class=st>I can't import my bookmarks for mozilla "<em>JSON</em>file" says unsupported <b>...</b> The file is probably corrupted. When you backup your bookmarks, <b>...</b><br></span></div></div><h3 id=\\\"tbpr_10\\\" class=tbpr style=\\\"display:none\\\">
- <a href=\\\"#\\\">Undo</a></div><span class=st>Today, goal (a) "<em>t7</em>: <em>start</em>" is currently implemented by "<em>t7</em>: <em>run</em>" with "<wbr>tomcatSetAwait" set to "false", and goal (c) is currently implemented by "<em>t7</em>: <em>run</em><wbr>" with <b>...</b><br></span></div></div><!--n--><!--m--><li class=\\\"g w0\\\">

The bug starts to appear when the quote is immediately followed by <em> it seems.
I hope that'll give someone a lead to fix it :)
Thank you very much for your report Nicolas! ;-)
(In reply to comment #13)
> I've analyzed my sessionstore.js on 2 cases where it went wrong, did it
> through jsonlint since I'm also on windows.
> I've found that some windows._closedTabs.state.storage elements had
> unescaped quotes.
> It was always under "http://www.google.com" if it helps.
> 
> Some samples :
> - <a href=\\\"#\\\">Undo</a></div><div class=\\\"f kb\\\">1 answer - 11 Jul
> 2010</div><span class=st>I can't import my bookmarks for mozilla
> "<em>JSON</em>file" says unsupported <b>...</b> The file is probably
> corrupted. When you backup your bookmarks,
> <b>...</b><br></span></div></div><h3 id=\\\"tbpr_10\\\" class=tbpr
> style=\\\"display:none\\\">
> - <a href=\\\"#\\\">Undo</a></div><span class=st>Today, goal (a)
> "<em>t7</em>: <em>start</em>" is currently implemented by "<em>t7</em>:
> <em>run</em>" with "<wbr>tomcatSetAwait" set to "false", and goal (c) is
> currently implemented by "<em>t7</em>: <em>run</em><wbr>" with
> <b>...</b><br></span></div></div><!--n--><!--m--><li class=\\\"g w0\\\">
> 
> The bug starts to appear when the quote is immediately followed by <em> it
> seems.
> I hope that'll give someone a lead to fix it :)

I wonder, are you using ADB?
I do, the nightlies. Would it be the cause ?
Well if you using dev builds, then no. It was happening to me, but it stopped, so I'm trying to find a pattern.
Try to delete ALL cokies.
To be accurate I'm on nightlies for ADB and Aurora for Firefox, but the results seems the same as the OP so I thought it'd help but maybe it's a different issue. I'm going to try clearing all cookies anyway.
so you think Adblock Plus is doing it? 

however the other addons I have are as follows:

adblock plus
screen capture elite
yet another smooth scrolling
showip
status-4-evar
stylish
greasemonkey
context search
(In reply to comment #19)
> To be accurate I'm on nightlies for ADB and Aurora for Firefox, but the
> results seems the same as the OP so I thought it'd help but maybe it's a
> different issue. I'm going to try clearing all cookies anyway.

Which version of ADB you're using?
I'm using ADB 1.3.9

I will install the nightly to see how it performs....
I already had build 3096.

We have ABP and GM in common, which are both nightly here, but I wouldn't have thought any of them would interfere with sessionstore.

FYI, before erasing cookies yesterday, I had the same problem happening so I checked the sessionstore again and found that the json was perfectly valid this time... :(
What is your plug-in list?
Ok I installed that .xpi file terepin has provided. I will give it a shot and see if it happens anymore with that...

here's my plugin list:
http://i.imgur.com/rH7TC.jpg
ok seems to be fine with the .xpi that terepin provided. Hope this lasts.
I don't think this is to do with Adblock Plus. I have never used Adblock Plus and yet this happened to me. The comments over at related bug #669196 seem to suggest Google+ as a possible cause.
I'm not using G+ on this browser though.
And I'm not using Adblock. :) So either we have 2 totally separate bugs with identical symptoms that just happened to appear at roughly the same time, or we haven't found the actual cause yet.
mine has occured with no addons as well with a fresh profile... ;-(
It hasn't occurred to me since I've cleared my cookies, so far so good. I'll come again if it was a false positive.
Ok, I didn't expect it to fail so fast... :)

This time the json is again perfectly valid.

I've noticed one more thing that might help. I'm using the portable version synchronized across home and work computers. The work computer is still running WinXP and it seems to cause the failure each time.

@remixedcat: are you also on WinXP ?
I am on windows server 2008 R1 x64

and you've cleared the cookies and that is a no-go for correction?
Yes cookies didn't help. Since I've been away from my work computer the last few days, and right after I use it, it happens again, I cannot help but think the problem lies in it... McAfee maybe ?
I use Sophos A/V.....
I don't have any AV. I'm pretty sure this isn't a system problem, it's a browser problem. Nothing else is touching that sessionstore except Firefox. I find it a bit concerning that bug 669196 has been resolved as fixed when that addresses a problem with saving the session, when this seems to clearly be a problem with loading a session. Is anybody looking at this bug?
yes and this bug has happened 3 times since last report. I even had a new session as well.
is this duplicate of bug 669196 ?
For those reporting it still happening, are you running Nightly? I added some protection in bug 669196, but there may be other causes.

(In reply to comment #37)
> I don't have any AV. I'm pretty sure this isn't a system problem, it's a
> browser problem. Nothing else is touching that sessionstore except Firefox.

Good to know.

> I find it a bit concerning that bug 669196 has been resolved as fixed when
> that addresses a problem with saving the session, when this seems to clearly
> be a problem with loading a session. Is anybody looking at this bug?

Nothing has made it clear to me that this is a problem loading the session. In fact, I'm willing to bet it's a problem saving the session. But you can prove me wrong - check your sessionstore.bak immediately after a restore that fails. If all of your tabs that should be there are, then this is a problem with restoring. The file is tough to read though, so if you want to upload the file here (or email me directly), then I can take a look at it.

FWIW, this is similar to bug 668417, but definitely different (might be the same root cause).

Another thing that would be helpful to know: are the few tabs restored up to date (most recent navigation, form data)? Or are they pages you went to previously in that tab?
I am running nightly 8.0ax64 

I can't send the sessionstore becuase the data is too sensitive. I know the file size changes and the date as well. 

I will report with the rest of the data when I pay attention to it. 

Thanks.
(In reply to comment #41)
> I am running nightly 8.0ax64 

Unfortunately our nightly version numbers aren't as helpful as they used to be. The patch appeared in yesterday's nightly so as long as you're up to date there then you're covered.

> I can't send the sessionstore becuase the data is too sensitive. I know the
> file size changes and the date as well. 

Fair enough, but if you happen to make it happen in a less sensitive session let me know. Good to know that the file is updating (if it is in fact the same issue as bug 669196, the patch there would keep you safer)
Paul, I mentioned this already in comment #12 above: I started Firefox and the session was gone, without even the 'this is embarrassing' dialogue - but sessionstore.bak was indeed still full of my stuff. So I renamed sessionstore.bak to sessionstore.js, but it does not load. So I fired up Python and confirmed that the JSON content in sessionstore.bak is at least well-formed. Firefox just won't read it.

Similarly, comment #13 implies someone else has a well-formed sessionstore.js which Firefox just wasn't restoring properly.

I am a bit ignorant of which different Firefox build is which at the moment but I currently have Firefox 6.0 on the Beta channel which claims to be up to date, and it can't load my old session which it lost weeks ago.

However - this just inspired me to check the error console on load, and I see this message:

  SessionStore: The session file is invalid: TypeError: this._initialState.windows[0] is undefined

Which looks like Bug 495123 .
8.0a1 (2011-07-27) is the version I am running. 

I just applied the update and the session restarted properly! 

I will let you know if I run into any other problems with this. ;-)
Since I'd prefer to stay on aurora if possible, any chance this patch is merged onto this branch ?
(In reply to comment #43)
> Paul, I mentioned this already in comment #12 above: I started Firefox and
> the session was gone, without even the 'this is embarrassing' dialogue - but
> sessionstore.bak was indeed still full of my stuff. So I renamed
> sessionstore.bak to sessionstore.js, but it does not load. So I fired up
> Python and confirmed that the JSON content in sessionstore.bak is at least
> well-formed. Firefox just won't read it.
[..]
> However - this just inspired me to check the error console on load, and I
> see this message:
> 
>   SessionStore: The session file is invalid: TypeError:
> this._initialState.windows[0] is undefined

I've seen this as well a few weeks ago. I managed to shuffle around the sessionstore.js contents so that my window would actually be in the windows array.
Just lost my session again. Since I had seen the assert dialog from bug 669196 before, I guess this means that fix didn't help here.
[IMG]http://i.imgur.com/WJL1J.jpg[/IMG]

Just had this on hotmail!
http://i.imgur.com/WJL1J.jpg

corrected link
I'm having this on many sites, resulting into half-functioning browser and requiring restart.
This sounds like a different bug. Once your tabs are gone, a restart wouldn't bring them back, as far as this bug is concerned.

Not sure what "half-functioning" means, but it sounds like a separate issue as well.
I meant refresh wasn't working, as well as back/forward buttons. After the alert window, I clicked on link to finish operation on my SkyDrive. It started loading, but ended in blank page. Restart fixes this.
That's probably bug 670318 or some variation of it. This bug is about lost tabs.
Yes but this could lead to it not being able to save the tabs, so they can't be restored. 

Oh and after that message I restarted Nightly and half my tabs were gone! 

I also couldn't refresh or have back,fwd,or stop functionality like Terepin said.
(In reply to comment #53)
> That's probably bug 670318 or some variation of it. This bug is about lost
> tabs.

I don't have G+ and that alert window originates from bug 669196, on which this bug depends.
(In reply to comment #55)
> (In reply to comment #53)
> > That's probably bug 670318 or some variation of it. This bug is about lost
> > tabs.
> 
> I don't have G+

Which is why I said "or some variation of it".

> and that alert window originates from bug 669196, on which
> this bug depends.

Because I hoped bug 669196 would fix this, but it didn't.
(In reply to comment #56)
> (In reply to comment #55)
> > (In reply to comment #53)
> > > That's probably bug 670318 or some variation of it. This bug is about lost
> > > tabs.
> > 
> > I don't have G+
> 
> Which is why I said "or some variation of it".

Variation in what meaning?
(In reply to comment #57)
> (In reply to comment #56)
> > (In reply to comment #55)
> > > (In reply to comment #53)
> > > > That's probably bug 670318 or some variation of it. This bug is about lost
> > > > tabs.
> > > 
> > > I don't have G+
> > 
> > Which is why I said "or some variation of it".
> 
> Variation in what meaning?

In that it doesn't need to be limited to goggle+. Any page using history.pushState like google+ does can trigger it.

Bottom line is, if you lost tabs, this bug is for you. If back/forward are broken, bug 670318 is for you. Both issues might be connected, of course, especially if you're actually hitting both. But if you haven't lost your tabs, commenting here isn't useful.
But I did loose tabs after I had to restart Nightly because I lost my functionality like Terepin did. 

After I restarted Nightly I lost half my tabs.
(In reply to comment #59)
> But I did loose tabs after I had to restart Nightly because I lost my
> functionality like Terepin did. 

I know, I read comment 54. And it's good to know that both issues happened to you.

Comment 50 and comment 52 however don't mention lost tabs after session restore, which this bug happens to be about.

Can we end this conversation now? It's making this bug less useful.
However, I think it might be connected to this. 

I did still loose tabs though...

However, we shall focus on this issue 670308, however if I have more problems that involve BOTH the message, and the lost tabs with restart like I just did then the issue needs to be looked at again.
(In reply to comment #61)
> However, I think it might be connected to this.

Which I acknowledged.

All you say is in line with what I said, so I'm not sure why you keep responding as if it wasn't. :/
OK.... fair enough.
It might be interesting to point out that while I stopped experiencing this bug, bug 670318 is till alive. Even more interesting is I had G+ pinned, but don't anymore. It seems that one bug is triggering the other one and/or vice-versa. It is even possible they're the same bug.
Summary: Sessions get corrupted randomly → Sessions get corrupted randomly (tabs lost after session restore)
I'm most concerned here with people on Nightly, to determine just how related to bug 669196 this is. If you're not on Nightly, 

If you notice a corrupted state after restoring...
1. Do you only have app tabs?
   --> Please go to bug 668417
2. Check the error console
   Does it say something about "this._initialState.windows[0] is undefined"
   --> That's a known issue with closing an empty window last. It's been around a long time and while it needs to be fixed, it's not a sudden new issue.
   --> See bug 495123, bug 668359, probably some others

If you're seeing broken back/forward/reload, that seems to be a side effect of bug 670318 (which isn't exclusive to G+, despite the title). That could be an indication of a broken session, so check to see if your sessionstore.js is updating. If you're not updating AND you're on latest nightly, you can comment here or bug 669196. If you see the assert dialog, your file *should* be updating.

If you're using Aurora/Beta/5/4 then the fix for bug 669196 hasn't been applied for you so it's possible that's what you're seeing, but additional comments of "I got the dialog" and "I don't use G+" don't help.

(In reply to comment #46)
> I've seen this as well a few weeks ago. I managed to shuffle around the
> sessionstore.js contents so that my window would actually be in the windows
> array.
(In reply to comment #47)
> Just lost my session again. Since I had seen the assert dialog from bug
> 669196 before, I guess this means that fix didn't help here.

Dão, I'm guessing you haven't had a sudden change in browsing behavior that would lead to #2 above, but keep an eye out for that. After you see the assert, can you check sessionstore.js and see if the modified timestamp keeps updating when you do some additional browsing (open a new tab, close a tab, etc... you know the drill).
I don't have app tabs. 

Console mode (at least on version 3.6 and 4) sometimes triggers BSODs, however I will not report until I figure out if it's an issue with my system or not. (don't take it seriously until I isolate that) 

My browsing behaviour has remained the same for months. I normally have between 15-32 tabs open at any given time. I don't use app tabs much maybe once a month and that is for an hour or so.  

My session store file does increase in size and the date is changing.
(In reply to comment #65)
> Dão, I'm guessing you haven't had a sudden change in browsing behavior that
> would lead to #2 above, but keep an eye out for that. After you see the
> assert, can you check sessionstore.js and see if the modified timestamp
> keeps updating when you do some additional browsing (open a new tab, close a
> tab, etc... you know the drill).

Yeah, I got the assert an hour ago. Looks like sessionstore.js hasn't been touched anymore ever since.
And just for the fun of it, I restarted Firefox and lost most of my tabs "as expected".
Duplicate of this bug: 672095
my [url=https://bugzilla.mozilla.org/show_bug.cgi?id=672095]bug 672095[/url] that was terminated had a link to [url=http://forums.mozillazine.org/viewtopic.php?f=23&t=2255273&p=11075093#p11075093]my post at mozillazine[/url] where i laid out the things i removed and re-added with screen shots.

Landis.
whit this mornings (30.07.11) 'update' the problem is again, gone.
The ONLY difference is that because I was using Nightly (8.0a1) since yesterday with a persona (brushed metal) and not Office Black by t-rand (https://addons.mozilla.org/en-US/firefox/user/919099/?src=api).

Thanks, 
Landis.
(In reply to comment #67)
> (In reply to comment #65)
> > Dão, I'm guessing you haven't had a sudden change in browsing behavior that
> > would lead to #2 above, but keep an eye out for that. After you see the
> > assert, can you check sessionstore.js and see if the modified timestamp
> > keeps updating when you do some additional browsing (open a new tab, close a
> > tab, etc... you know the drill).
> 
> Yeah, I got the assert an hour ago. Looks like sessionstore.js hasn't been
> touched anymore ever since.

It's being written on shutdown, though, and is much smaller afterwards.
had assert message on hotmail and G+ had to restart becuase refresh stopped working and lost all but 5 tabs.
I think this is fixed now.
Status: NEW → RESOLVED
Closed: 9 years ago
No longer depends on: 669196
Resolution: --- → DUPLICATE
Duplicate of bug: 669196
Status: RESOLVED → VERIFIED
Thanks. I will let you know if the issue does persist.
It's still broken on FF 8 on Win 7.
You need to log in before you can comment on or make changes to this bug.