[Ext]Session Manager 0.6.1.13 for FF 2.0+ [Mar 10, 2008]

Announce and Discuss the Latest Theme and Extension Releases.
Locked
User avatar
Vano
Posts: 403
Joined: December 26th, 2007, 8:21 pm

Re: [Ext]Session Manager 0.6.1.13 for FF 2.0+ [Mar 10, 2008]

Post by Vano »

Ok, here is how I reproduce it with absolutely fresh FF 3.0.1 and SM 0.6.1.13
SM settings are all default only "Maximum amount of POSTDATA to be stored" is set to -1

Open any websites which allows you upload a file (it really doesn't matter what kind of file and size it allows you upload, as long as it uses basic HTML post form and (this is important!) doesn't have header redirect after upload (if after submitting form you refresh the page and FF doesn't ask you resubmit form - the site uses redirects)
Upload a file about 1mb size and try save the session. In my tests uploading 850kb file would trigger the error.

After this error occur, the are few ways restore SM to a working state:
- go out the page where you uploaded the file and clear history
- close 10 tabs (10 by default). Opening and closing the same tab doesn't count ;)
User avatar
Morac
Posts: 2519
Joined: February 9th, 2004, 8:20 pm
Contact:

Re: [Ext]Session Manager 0.6.1.13 for FF 2.0+ [Mar 10, 2008]

Post by Morac »

Vano wrote:Hello!
When POSTDATA set to -1 (all) and you send a huge post (for instance in a forum), the session no longer can be saved, it returns error message when manually saved or when FF closing:
This operation failed due to a file access error:
'[JavaScript Error: "script stack space quota is exhausted" {file: "file:///Firefox/modules/JSON.jsm" line: 176}]' when calling method: [nsISessionStore::getBrowserState]

It's probably has nothing to do with Session Manager per se, however, would be nice if SM would at least did a check or warn user about possible error AND show which tab causes it.

P.S. to fix this error you either have to close that tab (window) or better go back in history before the "big post" and browse somewhere else, so it would delete it from "forward".


That error is related to changes that were made in Firefox 3.0 to prevent infinite loops in javascript, but the stack space also appears to be used for Regular Expression functions that run on Strings. During the Firefox 3.0 alpha testing, I ran into an issue with this which led me to file bug 420869 which resulted in the stack space being increased from 32 MB to 100 MB. This allows Regular Expression functions to work on strings up to a little over 1 million characters in length. Anything over about 1,252,165 characters will throw the "...stack space..." exception. Unfortunately there's no real way to test for it without doing a catch try around every regular expression function call.

The settings on the SessionStore page actually set hidden Firefox settings (i.e. - Session Manager doesn't use them, Firefox does). If the setting for POSTDATA is set to -1, nsSessionStore issues a .replace function (which is a RegEx function) on line 989 in nsSessionStore.js. My guess is that's what's triggering the exception. Since the exception is happening in nsISessionStore you should file a bug against Firefox's Session Restore component. Actually since the problem is actually in the javsascript functionality so it might be better to file the bug in the Core javascript component (or both).
User avatar
Morac
Posts: 2519
Joined: February 9th, 2004, 8:20 pm
Contact:

Re: [Ext]Session Manager 0.6.1.13 for FF 2.0+ [Mar 10, 2008]

Post by Morac »

Vano wrote:Open any websites which allows you upload a file (it really doesn't matter what kind of file and size it allows you upload, as long as it uses basic HTML post form and (this is important!) doesn't have header redirect after upload (if after submitting form you refresh the page and FF doesn't ask you resubmit form - the site uses redirects)
Upload a file about 1mb size and try save the session. In my tests uploading 850kb file would trigger the error.


Uploaded files are considered POSTDATA, so that explains how you got a strong over about 1.2 million characters in length. You should probably go ahead and file a bug with Firefox. If you post or send me the bug number I'll add more technical details to it.

I will mention though that if you set the POSTDATA setting to -1, your session files will be very large in length, because they will contain the entire uploaded file (converted to B64) in the session files. This is one of the reasons the POSTDATA setting doesn't default to -1.
User avatar
Vano
Posts: 403
Joined: December 26th, 2007, 8:21 pm

Re: [Ext]Session Manager 0.6.1.13 for FF 2.0+ [Mar 10, 2008]

Post by Vano »

The thing is, without SM, FF doesn't give that error, in fact it doesn't produce any errors even when I upload 100mb files...
User avatar
Morac
Posts: 2519
Joined: February 9th, 2004, 8:20 pm
Contact:

Re: [Ext]Session Manager 0.6.1.13 for FF 2.0+ [Mar 10, 2008]

Post by Morac »

I just looked at the SessionStore code and it does look like it catches the exceptions for POSTDATA so I checked line 176 in JSON.jsm and it is doing a .test() function call which is the same function I had issues with in my code when I filed bug 420869. The function is JSON.jsm is called by SessionStore's internal function called "_toJSONString" which is called a lot of different places.

When Session Manager calls SessionStore for the session data it will put up an alert if an exception is thrown in SessionStore to let the user know that it failed to get the session data from Firefox. Without Session Manager installed, the same exception will be thrown, but it will silently be reported to the Error Console (Tools->Error Console). At that point Firefox will stop saving the session data, so while you won't see any pop-up errors, there is still a problem.

Like I mentioned, the issue is technically with the core javascript functionality in Firefox, but SessionStore may want to try and catch the error thrown by JSON.jsm.
zeniko
Posts: 201
Joined: October 19th, 2007, 4:50 am
Location: Swiss Confederation
Contact:

Re: [Ext]Session Manager 0.6.1.13 for FF 2.0+ [Mar 10, 2008]

Post by zeniko »

Morac: JSON.jsm is only used for the extension facing API, internally we do without it - hence vanilla Firefox isn't affected by that bug. And once we switch over to using native JSON (hopefully for Firefox 3.1), the error should be gone again. As for right now, please file a bug against SessionStore (I'll look into fixing JSON.jsm).
User avatar
Morac
Posts: 2519
Joined: February 9th, 2004, 8:20 pm
Contact:

Re: [Ext]Session Manager 0.6.1.13 for FF 2.0+ [Mar 10, 2008]

Post by Morac »

zeniko wrote:Morac: JSON.jsm is only used for the extension facing API, internally we do without it - hence vanilla Firefox isn't affected by that bug. And once we switch over to using native JSON (hopefully for Firefox 3.1), the error should be gone again. As for right now, please file a bug against SessionStore (I'll look into fixing JSON.jsm).


Okay I filed bug 450633 against SessionStore, but like I mentioned, technically the problem isn't with JSON.jsm, but is deep within the javascript RegExp handling code since they cannot handle large strings.
User avatar
Vano
Posts: 403
Joined: December 26th, 2007, 8:21 pm

Re: [Ext]Session Manager 0.6.1.13 for FF 2.0+ [Mar 10, 2008]

Post by Vano »

Morac wrote:Without Session Manager installed, the same exception will be thrown, but it will silently be reported to the Error Console (Tools->Error Console). At that point Firefox will stop saving the session data, so while you won't see any pop-up errors, there is still a problem.
Then how do you explain that in my tests I uploaded 50mb file to the site, closed FF (SM disabled), deleted the file on my computer that I've uploaded, started FF and after it asked me resend post data the file was again successfully uploaded?


P.S.
btw, when I upload large files FF freezes for a few seconds, then it freezes for a minute on close and on startup.
User avatar
Morac
Posts: 2519
Joined: February 9th, 2004, 8:20 pm
Contact:

Re: [Ext]Session Manager 0.6.1.13 for FF 2.0+ [Mar 10, 2008]

Post by Morac »

Vano wrote:Then how do you explain that in my tests I uploaded 50mb file to the site, closed FF (SM disabled), deleted the file on my computer that I've uploaded, started FF and after it asked me resend post data the file was again successfully uploaded?.


I was mistaken. See Zeniko's post, two posts up.
User avatar
Vano
Posts: 403
Joined: December 26th, 2007, 8:21 pm

Re: [Ext]Session Manager 0.6.1.13 for FF 2.0+ [Mar 10, 2008]

Post by Vano »

Oh, ok, so is there a way avoid this bug? or we should wait for FF 3.1?
User avatar
Morac
Posts: 2519
Joined: February 9th, 2004, 8:20 pm
Contact:

Re: [Ext]Session Manager 0.6.1.13 for FF 2.0+ [Mar 10, 2008]

Post by Morac »

At this point there's nothing really that I can do. I'm hoping that the bug I filed will be fixed in one of the 3.0.x builds (before 3.1 comes out).

As for avoiding it, unless you really need entire uploaded files saved in the session data (and I'm not sure why you would), you can put a limit on the amount of POSTDATA saved. You can start out at 1200000 and just keep backing down until the error goes away.
q00u
Posts: 5
Joined: August 15th, 2008, 1:40 pm

Re: [Ext]Session Manager 0.6.1.13 for FF 2.0+ [Mar 10, 2008]

Post by q00u »

59 pages? No one is going to see this...

Session Manager is GREAT, and I love it except for one thing:

If I close Firefox with just an empty tab, it SAVES THAT SINGLE EMPTY TAB. And enough of those empty tabs will push out the rest of my sessions.

Boy that sure is frustrating.

Other than THAT, this extension has saved my bacon more than once. I consider it essential, install it on every machine I use, and highly recommend it to others. I didn't even NOTICE the single-empty-tab-saving-problem until today (why would I ever close all my tabs when I have session manager to take care of them for me?)
User avatar
Morac
Posts: 2519
Joined: February 9th, 2004, 8:20 pm
Contact:

Re: [Ext]Session Manager 0.6.1.13 for FF 2.0+ [Mar 10, 2008]

Post by Morac »

I added some checks for windows with empty tabs, but I don't think I did so for backups. I could probably do so, but the problem with empty windows is sometimes they're not really "empty". They have tab history, closed tabs, etc.
q00u
Posts: 5
Joined: August 15th, 2008, 1:40 pm

Re: [Ext]Session Manager 0.6.1.13 for FF 2.0+ [Mar 10, 2008]

Post by q00u »

Ah, didn't think about the tab history, closed tabs, etc. H'rmm.

I suppose I'll have to have it ask me each time I close FF. Which is a bummer because the vast majority of the time, I DO want it to save session. Just not when there is just the empty tab open.

(Looking in the history now, there are four (4) saved sessions with one empty tab each.)
User avatar
Morac
Posts: 2519
Joined: February 9th, 2004, 8:20 pm
Contact:

Re: [Ext]Session Manager 0.6.1.13 for FF 2.0+ [Mar 10, 2008]

Post by Morac »

Well in the version I'm working on I put the back-up sessions in their own folder in the session list. This makes the list cleaner if there are a lot of backup sessions so the option at some point might just be to bump up the default number of backed-up sessions.
Locked