Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Firefox stutters when not set as default browser #94502

Open
vorot93 opened this issue Aug 2, 2020 · 6 comments
Open

Firefox stutters when not set as default browser #94502

vorot93 opened this issue Aug 2, 2020 · 6 comments

Comments

@vorot93
Copy link
Contributor

vorot93 commented Aug 2, 2020

Firefox kept freezing on startup, opening preferences, interacting with address bar, etc.

Profiler output:
https://share.firefox.dev/2PhbAqx
Apparently freezes happened because of code responsible for checking default browser.

After setting Firefox as default browser the freezes went away.

After deleting ~/.config/mimeapps.list Firefox started freezing again.

nixos-unstable-small, Firefox 79, GNOME 3.36.4

@worldofpeace
Copy link
Contributor

I should mention nixos-unstable-small is not a good choice for user of a graphical environment. This is because the tests that run in order for that channel to advance are much fewer, and while this makes it advance faster (and nixos-unstable can be frequently blocked), this means tests like the gnome3 tests could fail and the environment could be broken. Just thought I should mention this.

@rastertail
Copy link
Member

I just recently started using NixOS and am running into the same issue, except it still occurs even when my default browser is set to Firefox.
Startup profile: https://share.firefox.dev/3eH4vLS
NixOS 20.09, Firefox 82.0.2, GNOME 3.36.5 (Wayland)

@worldofpeace
Copy link
Contributor

Hmm, I'd have to hear from @vorot93 if that can be reproduced by them. Because that could easily now be a different issue from @vorot93 @Rytone

@worldofpeace
Copy link
Contributor

Also, good that you specified the wayland session. I wonder what session @vorot93 was using.

Anyways, I will try to reproduce this with those versions.

@teto
Copy link
Member

teto commented Jan 17, 2021

happens to me even on X. Firefox is set as my default browser but the checkbox is greyed out because my "configuration is mangered by [my] organization" (configured via home-manager) .

@cmr-a
Copy link

cmr-a commented Apr 18, 2021

I have this issue as well (running on gnome3, both X11 and Wayland).

I found that when the freeze happens Firefox runs xdg-settings check default-web-browser firefox.desktop, and then it blocks for about 1 second waiting to read from the stdout pipe.

The code that does this check when running on Gnome is here.

The code only runs xdg-settings if Firefox is running as a snap, which is determined by checking if the SNAP_NAME env var is set to "firefox". I tried removing SNAP_NAME from the Firefox environment, and this stopped any calls being made to xdg-settings. This is one possible workaround but I don't know if it will break something else.

I tried setting "browser.shell.checkDefaultBrowser" to false in about:config, which should stop Firefox from performing the default browser check on startup. However, this did not seem to work. Possibly related #65679 .

I found that xdg-settings is calling xdg-mime, and this command is very slow on my system:

> time xdg-mime query default x-scheme-handler/http
firefox.desktop
xdg-mime query default x-scheme-handler/http  0.50s user 0.47s system 154% cpu 0.625 total

I enabled debug logging with XDG_UTILS_DEBUG_LEVEL=2, which shows xdg-mime is searching about 100 files, running grep on each one of them. This is probably why it is slow.

The first file searched is ~/.config/mimeapps.list, which on my system has no entries.

If you open Gnome3 Settings -> Default Applications, then change your default web browser to anything other than Firefox, then change it back to Firefox, entries will be added to ~/.config/mimeapps.list like this:

[Added Associations]
x-scheme-handler/http=firefox.desktop;
text/html=firefox.desktop;
application/xhtml+xml=firefox.desktop;
x-scheme-handler/https=firefox.desktop;

[Default Applications]
x-scheme-handler/http=firefox.desktop
text/html=firefox.desktop
application/xhtml+xml=firefox.desktop
x-scheme-handler/https=firefox.desktop

After doing this, xdg-mime completes in 0.01 seconds, and the freezes in Firefox are gone.

To reproduce this issue I suggest deleting ~/.config/mimeapps.list then checking how long xdg-mime query default x-scheme-handler/http takes to complete.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants