Solved: Firefox Freezes Every 10 Seconds, Scrolling is Jumpy

Problem

Firefox (3.6.13) intermittently freezes. This happens during scrolling, text input, basically everywhere in the user interface, rendering the browser nearly useless.

Analysis

While browsing amazon.de I created a log of Firefox's activities by recording system activity for 85 seconds with Sysinternals Process Monitor. I then filtered the log to include only Firefox activities. Clicking on Tools -> Process Activity Summary I got:

Every 10 seconds, a lot of file I/O occurs. Let's examine that closer:

Tools -> File Summary:

Wow, Firefox writes a whopping 415 MB to sessionstore-2.js during our 85 second analysis period. With the help of our process activity summary graph we can determine that it does so in bursts which occur approximately every 10 seconds and last 1-2 seconds.

Googling for "sessionstore-2.js" yields a promising first result: The mozilla support document Firefox hangs which recommends deleting all instances of sessionstore*.js if there is more than one. There was. I deleted sessionstore.bak, sessionstore.js and sessionstore-1.js, each roughly 25 MB in size, and restarted Firefox.

The immediate effect: Firefox forgot the tabs opened in the last session. I guess that is what is stored in sessionstore.js then. But why 25 MB for a simple list of tabs? Taking a closer look at sessionstore.js we see this:

Obviously Javascript code, but why so much of if? It seems Firefox keeps a record of every URL opened since it was started, but also of form input and cookies. In order to be able to restore the previous session after a crash it writes this session information every 10 seconds to disk, replacing sessionstore.js with bigger and bigger versions each time a new URL is opened. This goes on until sessionstore.js becomes so big that the process of recreating it every 10 seconds freezes the user interface for a short time.

Workarounds

Until the developers fix this problem, there are two ways to get around these periodical freezes of the browser UI:

  1. Delete sessionstore*.js every time the freezes reappear, as I did. The easiest way to navigate to the profile folder containing sessionstore.js is by clicking on Help -> Troubleshooting Information -> Open Containing Folder.
  2. Disable the session store altogether. This does not disable the history, just the ability to restore the previous session after a restart of the browser. To do so, open about:config and set browser.sessionstore.max_tabs_undo and browser.sessionstore.max_windows_undo to 0.