How to debug slow session start of Gnome 3?

Solution 1:

I know this question is ancient, but it shows up near the top of the Google results, so I thought I'd throw up an answer to the question in the title —

One way to identify the problem works like this:

Start to log in to your session, but, also have another session (as another user, or on a "tty" session (Control+Alt+[F2…]), or via ssh, or …) already open, with a text shell (bash) prompt ready.

Key in (but don't hit Return yet) this command:

  • you may need to sudo this command if your other shell is a different user account
  • This is one, long line

gdb attach /usr/bin/gnome-shell $(pgrep -u your login gnome-shell) -ex 'call gjs_dumpstack ()'

e.g. gdb attach /usr/bin/gnome-shell $(pgrep -u jdoe gnome-shell) -ex 'call gjs_dumpstack ()'

As soon as the shell is "too busy," i.e. "catch it in the act," in your other shell, hit Return to trap it. It will freeze up the shell and might kill your login attempt, but you'll have your backtrace.

You'll get a welcome banner from the debugger. (You may also be told that you need to install some debuginfo packages, on Fedora at least, I'm not sure if Ubuntu will do the same, but I presume it's similar. You shouldn't actually need these to debug the JavaScript side of things; that only applies to debugging the C part of the code.)

This will show the stack of active JavaScript functions, which will almost certainly show the culprit.

You can find more detailed information here: https://wiki.gnome.org/Projects/GnomeShell/Debugging

Solution 2:

I had a similar problem, and pinned it down to the contacts system -- I did that by running strace -p on the gnome-shell process, and looking for the contents of the system calls.

I give my eventual solution in my blog entry here. Hope that helps!

--- /usr/share/gnome-shell/js/ui/overview-dist.js   2012-07-20 13:12:23.564769756 -0700
+++ /usr/share/gnome-shell/js/ui/overview.js    2012-07-20 16:40:14.076527986 -0700
@@ -210,7 +210,7 @@
         this.addSearchProvider(new AppDisplay.AppSearchProvider());
         this.addSearchProvider(new AppDisplay.SettingsSearchProvider());
         this.addSearchProvider(new PlaceDisplay.PlaceSearchProvider());
-        this.addSearchProvider(new ContactDisplay.ContactSearchProvider());
+        // this.addSearchProvider(new ContactDisplay.ContactSearchProvider());

         // Load remote search providers provided by applications
         RemoteSearch.loadRemoteSearchProviders(Lang.bind(this, this.addSearchProvider));

Solution 3:

Do you have many pictures and use Nautilus? Maybe you are affected by LaunchPad Bug 505085 - gnome-settings-daemon extensive disk usage? See comment 13 or 18 for workarounds.