Posted by: benoitgirard | March 12, 2013

Shutdown Reporter Results

In a previous blog post I asked for volunteers to send in their shutdown profiles automatically. I’ve received hundreds of slow shutdown profiles, 30 profiles of which are over 10 seconds and one as high as 80 seconds! These profiles show us where Firefox is spending its time when closing down to the millisecond.

Before I started this experiment I asked around for what people thought was the cause of the slow shutdowns. The overwhelming response I got was that it was Garbage Collection and Cycle Collection. While those operations do make the shutdowns slower, they were rarely responsible for those 10 to 80 seconds shutdown times.

Here’s some interesting issues we found:

  • A few start-up optimizations moved operations off the startup path and into timers that would update the startup cache, or load fonts. These timers were never canceled when shutting down so they would lead to things such as font loading while shutting down. Since you have to open & close the browser within a minute to see these issues they are not critical for our users but these are certainly bugs we are cleaning up. Keep in mind if you are running timers you should stop them on shutdown before they fire if they are no longer useful.
  • On a related note we have timers going off during the shutdown. Particularly GC and CC timers. There is no guarantee that the shutdown will take long enough for these timers to run. If these are useless then we will waste time but if they are important they may not run.
  • Stopping plug-ins can take up to a second. I do not capture what is happening in the plug-in process so I can’t tell if it’s our container or the plug-in.
  • Releasing style sheets on shutdown will sometimes total over 1 second of execution on slow shutdown.
  • Time spent in sqlite3close in some profiles is as high as 10 seconds.
  • Bookmark backups are hurting us.
Shutdown metrics

Shutdown metrics

A big thumbs up to people who are submitting shutdown profiles. The data we are collecting is very valuable in helping us understand how Firefox behaves outside the labs.

About these ads

Responses

  1. Why does Gecko run timers during shutdown at all?

    • That’s a good question. We’re still servicing general events until very late in the shutdown process so timers still work. I’d like to investigate if we can disallow timers entirely during shutdown.

  2. I think the Flash plugin dispatches the flash.events.Event.UNLOAD event for the main SWF file and closes any open sockets (again potentially notifying client code), so that might be the reason for the long shutdown times of plugins.

  3. Would it be damaging to just pull the plug on all plugins last thing before turning out the lights? (If it’s possible.)

    • We handle crashes reasonably well and doing that should be strictly better then a crash. However right now we still have some more cost effective bugs to solve.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: