Closed Bug 1917750 Opened 1 year ago Closed 11 months ago

[Snap] opening firefox in weston taking more than 25secs

Categories

(Core :: Widget: Gtk, defect, P3)

Firefox 130
Other
Linux
defect

Tracking

()

RESOLVED WONTFIX
Performance Impact low

People

(Reporter: pvharsha, Assigned: gerard-majax)

References

(Blocks 1 open bug)

Details

(Keywords: perf:startup)

Attachments

(9 files)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36

Steps to reproduce:

Start weston on Ubuntu22.04 as mentioned in below link:
https://gitlab.freedesktop.org/wayland/weston

In weston try to open Firefox browser from terminal provided in weston from /usr/bin/firefox

Actual results:

Firefox browser takes more than 25secs to open & while opening in terminal we can see below error:

Gtk-Message: 14:39:44.888: Not loading module "atk-bridge": The functionality is
provided by GTK natively. Please try to not load it.
[53235, Main Thread] WARNING: Settings portal not found: Error calling StartServ
iceByName for org.freedesktop.portal.Desktop: Timeout was reached: 'glib warning
', file /build/firefox/parts/firefox/build/toolkit/xre/nsSigHandlers.cpp:187

(firefox:53235): Gdk-WARNING **: 14:40:09.916: Settings portal not found: Error
calling StartServiceByName for org.freedesktop.portal.Desktop: Timeout was reach
ed

This issue is not seen when we launch firefox in X11.
Also delay issue is not seen when I compile & run firefox code from below link:
https://github.com/mozilla/gecko-dev

Expected results:

Firefox should have opened within 5secs.

OS: Unspecified → Linux
Hardware: Unspecified → Other
Summary: opening firefox in weston taking more than 25secs to open → opening firefox in weston taking more than 25secs
Component: Untriaged → Performance
Product: Firefox → Core

This bug was moved into the Performance component.

:pvharsha, could you make sure the following information is on this bug?

  • For slowness or high CPU usage, capture a profile with http://profiler.firefox.com/, upload it and share the link here.
  • For memory usage issues, capture a memory dump from about:memory and attach it to this bug.
  • Troubleshooting information: Go to about:support, click "Copy raw data to clipboard", paste it into a file, save it, and attach the file here.

If the requested information is already in the bug, please confirm it is recent.

Thank you.

Flags: needinfo?(pvharsha)

need more information w.r.t below profile capturing:
"For slowness or high CPU usage, capture a profile with http://profiler.firefox.com/, upload it and share the link here."

How do i start capturing while opening the firefox browser is taking time. Can you please help me the exact steps to capture the profile.

Thanks

Flags: needinfo?(pvharsha) → needinfo?(fdoty)

The Performance Impact Calculator has determined this bug's performance impact to be low. If you'd like to request re-triage, you can reset the Performance Impact flag to "?" or needinfo the triage sheriff.

Platform: Linux [x]
Impact on browser: Causes noticeable startup delay
Configuration: Specific but common

Performance Impact: --- → low
Component: Performance → Widget: Gtk

Can you try plain Mozilla binaries?
https://fedoraproject.org/wiki/How_to_debug_Firefox_problems#Testing_Mozilla_binaries

Also please attach your about:support page.
Thanks.

Flags: needinfo?(pvharsha)
Priority: -- → P3
Attached file firefox_raw_data.txt
Flags: needinfo?(pvharsha)
Attached file firefox_text.txt

Downloaded new firexfox tar file 64 bit from this link: https://www.mozilla.org/en-US/firefox/new/
When i open firefox from the tar folder its opening immediately.

But when I open the already installed firefox in linux its still taking time. Have attached about:support details of the installed firefox browser which is taking time to open : firefox_raw_data.txt & firefox_text.txt

I see you're using Snap - it may be related.

Blocks: snap
Summary: opening firefox in weston taking more than 25secs → [Snap] opening firefox in weston taking more than 25secs

I guess we're hitting a Snap sandbox restrictions here.

Long shot but what desktop environment? Could it be some dbus related timeout ? Or Wayland proxy ?

I think journalctl -fxe might help checking if there are apparmor issue

Can you also share more details on how to reproduce from scratch?

Flags: needinfo?(pvharsha)

Amin, do you know of known issue related to bare Weston usage ?

Flags: needinfo?(bandali)

(In reply to :gerard-majax from comment #15)

Long shot but what desktop environment? Could it be some dbus related timeout ? Or Wayland proxy ?

I think journalctl -fxe might help checking if there are apparmor issue

Can you also share more details on how to reproduce from scratch?

Like maybe the snap is expecting something exposed from the desktop environment that gnome/kde/others provides but bare Weston lacks?

Just to give you an overview of how to check in weston:

  1. clone code, compile & install wayland as mentioned in below link:
    https://gitlab.freedesktop.org/wayland/wayland
  2. Similar way clone code, compile & install wayland-protocols:
    https://gitlab.freedesktop.org/wayland/wayland-protocols
  3. clone code, compile & install weston as mentioned in below link:
    https://gitlab.freedesktop.org/wayland/weston

and as mentioned in above link after compilation of all three modules, launch weston in using tty terminal in linux as mentioned in above weston link. In that you have terminal icon which opens terminal, which you can use to launch firefox.

Flags: needinfo?(pvharsha)

(In reply to Sriharsha P V from comment #18)

Just to give you an overview of how to check in weston:

  1. clone code, compile & install wayland as mentioned in below link:
    https://gitlab.freedesktop.org/wayland/wayland
  2. Similar way clone code, compile & install wayland-protocols:
    https://gitlab.freedesktop.org/wayland/wayland-protocols
  3. clone code, compile & install weston as mentioned in below link:
    https://gitlab.freedesktop.org/wayland/weston

and as mentioned in above link after compilation of all three modules, launch weston in using tty terminal in linux as mentioned in above weston link. In that you have terminal icon which opens terminal, which you can use to launch firefox.

Please answer all my questions, because we ran tests with Weston with gnome Wayland for something else and never had a problem.

(In reply to :gerard-majax from comment #15)

Long shot but what desktop environment? Could it be some dbus related timeout ? Or Wayland proxy ?

I think journalctl -fxe might help checking if there are apparmor issue

Can you also share more details on how to reproduce from scratch?

I think comment 0 has the info:

Start weston on Ubuntu22.04 as mentioned in below link:
https://gitlab.freedesktop.org/wayland/weston

In weston try to open Firefox browser from terminal provided in weston from /usr/bin/firefox

Actual results:

Firefox browser takes more than 25secs to open & while opening in terminal we can see below error:

Gtk-Message: 14:39:44.888: Not loading module "atk-bridge": The functionality is
provided by GTK natively. Please try to not load it.
[53235, Main Thread] WARNING: Settings portal not found: Error calling StartServ
iceByName for org.freedesktop.portal.Desktop: Timeout was reached: 'glib warning
', file /build/firefox/parts/firefox/build/toolkit/xre/nsSigHandlers.cpp:187

(firefox:53235): Gdk-WARNING **: 14:40:09.916: Settings portal not found: Error
calling StartServiceByName for org.freedesktop.portal.Desktop: Timeout was reach
ed

What should we do if we fail to get that ? It might break a few things no? https://searchfox.org/mozilla-central/search?q=org.freedesktop.portal.Desktop&path=&case=false&regexp=false

(In reply to :gerard-majax from comment #19)

(In reply to Sriharsha P V from comment #18)

Just to give you an overview of how to check in weston:

  1. clone code, compile & install wayland as mentioned in below link:
    https://gitlab.freedesktop.org/wayland/wayland
  2. Similar way clone code, compile & install wayland-protocols:
    https://gitlab.freedesktop.org/wayland/wayland-protocols
  3. clone code, compile & install weston as mentioned in below link:
    https://gitlab.freedesktop.org/wayland/weston

and as mentioned in above link after compilation of all three modules, launch weston in using tty terminal in linux as mentioned in above weston link. In that you have terminal icon which opens terminal, which you can use to launch firefox.

Please answer all my questions, because we ran tests with Weston with gnome Wayland for something else and never had a problem.

Can you please let me know what exact information you are looking for. I already gave information about how to reproduce issue on weston & what is the error log I am getting while opening.

Desktop environment? Logs from journalctl ? about:support?

org.freedesktop.portal. Desktop is supposed to be here but we may work without it - we'll miss camera capture, portals (flatpak system interfaces), GIO (filetypes), wakelock and getting system themes. But I wonder why stock Mozilla binaries works and Snap fails.

(In reply to :gerard-majax from comment #23)

Desktop environment? Logs from journalctl ? about:support?

Desktop environment:
Linux -> 6.8.12
Ubuntu 22.04 x86_64
From tty terminal we are launching opensource weston & then launching firefox from weston terminal.
Attaching about:support but journalctl is more than 150mb collected. Here i can attach only maximum 10mb file. So need any shared link where i can attach journalctl.

Attached file firefox_raw_data.txt
Attached file firefox_raw_data1.txt
Attached file firefox_text1.txt

It's instant for me

(In reply to Sriharsha P V from comment #25)

(In reply to :gerard-majax from comment #23)

Desktop environment? Logs from journalctl ? about:support?

Desktop environment:
Linux -> 6.8.12
Ubuntu 22.04 x86_64

Do you repro on 24.04 ? This may be a bug on Ubuntu level rather (missing backported fix)

From tty terminal we are launching opensource weston & then launching firefox from weston terminal.

It would help if your video includes before you launch weston. tty terminal do you mean you are launching weston from a real TTY console? Or just from GNOME Terminal or some other emulator?

Attaching about:support but journalctl is more than 150mb collected. Here i can attach only maximum 10mb file. So need any shared link where i can attach journalctl.

Window Protocol: wayland
Target Frame Rate: 60

There should be a line mentionning ubuntu:gnome if you were running under GNOME. This suggest you are not, hence why I keep asking on precise STR, because missing GNOME Desktop running would explain why you lack proper DBus (and we do some sync call on it). I still dont get why it would be different between the snap and non snap, but maybe the handling of DBus differs there?

You can mach repackage snap --snap-name firefox on your nightly build and try to install that using sudo snap install --dangerous ./path/to/firefox.snap --name firefox_nightly and then you should be able to run snap run firefox_nightly.

You can also use this build from our CI: https://firefox-ci-tc.services.mozilla.com/api/queue/v1/task/OfYtxpJTRtWrf0guy7Y8xw/runs/0/artifacts/public/build/firefox_132.0a1_amd64.snap it's a debug build of the snap (more on https://treeherder.mozilla.org/jobs?repo=mozilla-central&searchStr=snap-upstream%2Cnightly%2Cdebug)

I can reproduce when starting Weston in the console.

Problem is, xdg-desktop-portal-wlr cannot be started. This does not happen in other window managers such as Hyperland or Sway.

Please try https://wiki.archlinux.org/title/XDG_Desktop_Portal#xdg-desktop-portal-wlr_does_not_start_automatically_on_sway.

Flags: needinfo?(pvharsha)

I'm curious about the usecase of:

  • depending on the snap while at the same time
  • building weston from 0

I suspect there's a specific usecase here, and the goal is to leverage Snap's updating mechanism/compatibility and Weston's use is to make sure not to depend on the whole GNOME desktop.

I'm really curious what a debug snap build would show of errors so we can track where precisely it is waiting so long.

Assignee: nobody → lissyx+mozillians

Building Weston from 0 is not a variable here, I tested with packaged Weston.

In the case of sandboxed Firefox I'm not sure there is any avoiding the portal without losing functionality — I can remember GTK_USE_PORTAL though. To be clear, I'm completely in favor of never getting tied to a particular desktop environment.

(In reply to Martin Stránský [:stransky] (ni? me) from comment #24)

org.freedesktop.portal. Desktop is supposed to be here but we may work without it - we'll miss camera capture, portals (flatpak system interfaces), GIO (filetypes), wakelock and getting system themes. But I wonder why stock Mozilla binaries works and Snap fails.

I just thought about that, and I think it's obvious: the Snap needs the portal to work, but our binaries dont use it by default unless a pref is flipped. That's likely the difference.

(In reply to Nathan Teodosio :nteodosio from comment #33)

Building Weston from 0 is not a variable here, I tested with packaged Weston.

That was not what I was implying, rather than reproducing with a custom build of weston and (allegedly) without a running GNOME sounds like a specific usecase, so I'm curious if non Snap works well why trying to use the Snap.

And if the need of the Snap is really there, lack of portal, even if we fix the delay, will impair severely the features. But maybe in this usecase it's not a problem? Or maybe it would be and the fix should not be on our side ?

Is Dbus running? What is the output of env? Even forcing GTK_USE_PORTAL=1 DBUS_SESSION_BUS_ADDRESS='' I cannot reproduce so far.

(In reply to Nathan Teodosio :nteodosio from comment #31)

I can reproduce when starting Weston in the console.

Problem is, xdg-desktop-portal-wlr cannot be started. This does not happen in other window managers such as Hyperland or Sway.

Please try https://wiki.archlinux.org/title/XDG_Desktop_Portal#xdg-desktop-portal-wlr_does_not_start_automatically_on_sway.

I just installed sway in my linux system & launched firefox from sway terminal without setting any XDG_CURRENT_DESKTOP, it launched firefox browser within 2-3secs. Dint see any delay.

Flags: needinfo?(pvharsha)

Sway has this /etc/sway/config.d/50-systemd-user.conf, you could try to execute the same commands to solve your problem.

--->

import variables into system-user enviroment

based on the instructions in the sway wiki

see also https://github.com/swaywm/sway/issues/5732

and https://github.com/systemd/systemd/blob/dfc637d0ff756889e8e5b7cb4ec991eb06069aa1/xorg/50-systemd-user.sh

exec systemctl --user import-environment DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP

exec hash dbus-update-activation-environment 2>/dev/null &&
dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP=sway
<---

Not implying this dismisses the bug from Firefox' side.

(In reply to Sriharsha P V from comment #36)

(In reply to Nathan Teodosio :nteodosio from comment #31)

I can reproduce when starting Weston in the console.

Problem is, xdg-desktop-portal-wlr cannot be started. This does not happen in other window managers such as Hyperland or Sway.

Please try https://wiki.archlinux.org/title/XDG_Desktop_Portal#xdg-desktop-portal-wlr_does_not_start_automatically_on_sway.

I just installed sway in my linux system & launched firefox from sway terminal without setting any XDG_CURRENT_DESKTOP, it launched firefox browser within 2-3secs. Dint see any delay.

Could you please answer to the best you can about the usecase behind this ? Especially, does lacking desktop portal (file open, save, etc) is a problem ?

Flags: needinfo?(pvharsha)

I have seen this reported in a different context, but could be related: https://gitlab.gnome.org/GNOME/xdg-desktop-portal-gnome/-/issues/104.

(In reply to :gerard-majax from comment #38)

(In reply to Sriharsha P V from comment #36)

(In reply to Nathan Teodosio :nteodosio from comment #31)

I can reproduce when starting Weston in the console.

Problem is, xdg-desktop-portal-wlr cannot be started. This does not happen in other window managers such as Hyperland or Sway.

Please try https://wiki.archlinux.org/title/XDG_Desktop_Portal#xdg-desktop-portal-wlr_does_not_start_automatically_on_sway.

I just installed sway in my linux system & launched firefox from sway terminal without setting any XDG_CURRENT_DESKTOP, it launched firefox browser within 2-3secs. Dint see any delay.

Could you please answer to the best you can about the usecase behind this ? Especially, does lacking desktop portal (file open, save, etc) is a problem ?

Sorry for late reply was away. Actually the usecase is Ubuntu22.04 already comes with Firefox browser installed by default. So when we launch weston on same Ubuntu machine via tty terminal, we want to use this already installed firefox for browsing in weston also. But on Ubuntu22.04 we dont see the delay in firefox opening via ubuntu terminal but when we try launching firefox from weston terminal it takes about more than 25secs to open which kind of keep user waiting for a long time. So it would be helpful if it can open fast in similar way as in ubuntu.

Flags: needinfo?(pvharsha)

(In reply to Sriharsha P V from comment #40)

(In reply to :gerard-majax from comment #38)

(In reply to Sriharsha P V from comment #36)

(In reply to Nathan Teodosio :nteodosio from comment #31)

I can reproduce when starting Weston in the console.

Problem is, xdg-desktop-portal-wlr cannot be started. This does not happen in other window managers such as Hyperland or Sway.

Please try https://wiki.archlinux.org/title/XDG_Desktop_Portal#xdg-desktop-portal-wlr_does_not_start_automatically_on_sway.

I just installed sway in my linux system & launched firefox from sway terminal without setting any XDG_CURRENT_DESKTOP, it launched firefox browser within 2-3secs. Dint see any delay.

Could you please answer to the best you can about the usecase behind this ? Especially, does lacking desktop portal (file open, save, etc) is a problem ?

Sorry for late reply was away. Actually the usecase is Ubuntu22.04 already comes with Firefox browser installed by default. So when we launch weston on same Ubuntu machine via tty terminal, we want to use this already installed firefox for browsing in weston also. But on Ubuntu22.04 we dont see the delay in firefox opening via ubuntu terminal but when we try launching firefox from weston terminal it takes about more than 25secs to open which kind of keep user waiting for a long time. So it would be helpful if it can open fast in similar way as in ubuntu.

Thanks, it still does not explain why you want to use Firefox from a TTY console via Weston and without any desktop environment, and it does not answers whether the lack of feature I mentionned earlier would be a problem in your usecase.

Have you also had a look at https://gitlab.gnome.org/GNOME/xdg-desktop-portal-gnome/-/issues/104 ? If you experience this only on 24.04, then it's likely related. Unfortunately, I dont have enough time to try and repro that more than I could so far (i.e. trying to run firefox snap under GNOME but breaking DBus and others would not reproduce the issue for me), and if the problem really is on the desktop portal side, there's probably not a lot we can do without risking breaking badly the experience.

Flags: needinfo?(pvharsha)

So it would be helpful if it can open fast in similar way as in ubuntu.

Switching to dbus-broker seems to help with https://gitlab.gnome.org/GNOME/xdg-desktop-portal-gnome/-/issues/104, maybe try that?

(In reply to Matthijs Velsink [:velsinki] from comment #42)

So it would be helpful if it can open fast in similar way as in ubuntu.

Switching to dbus-broker seems to help with https://gitlab.gnome.org/GNOME/xdg-desktop-portal-gnome/-/issues/104, maybe try that?

I cannot find that information in their issue?

(In reply to :gerard-majax from comment #41)

(In reply to Sriharsha P V from comment #40)

(In reply to :gerard-majax from comment #38)

(In reply to Sriharsha P V from comment #36)

(In reply to Nathan Teodosio :nteodosio from comment #31)

I can reproduce when starting Weston in the console.

Problem is, xdg-desktop-portal-wlr cannot be started. This does not happen in other window managers such as Hyperland or Sway.

Please try https://wiki.archlinux.org/title/XDG_Desktop_Portal#xdg-desktop-portal-wlr_does_not_start_automatically_on_sway.

I just installed sway in my linux system & launched firefox from sway terminal without setting any XDG_CURRENT_DESKTOP, it launched firefox browser within 2-3secs. Dint see any delay.

Could you please answer to the best you can about the usecase behind this ? Especially, does lacking desktop portal (file open, save, etc) is a problem ?

Sorry for late reply was away. Actually the usecase is Ubuntu22.04 already comes with Firefox browser installed by default. So when we launch weston on same Ubuntu machine via tty terminal, we want to use this already installed firefox for browsing in weston also. But on Ubuntu22.04 we dont see the delay in firefox opening via ubuntu terminal but when we try launching firefox from weston terminal it takes about more than 25secs to open which kind of keep user waiting for a long time. So it would be helpful if it can open fast in similar way as in ubuntu.

Thanks, it still does not explain why you want to use Firefox from a TTY console via Weston and without any desktop environment, and it does not answers whether the lack of feature I mentionned earlier would be a problem in your usecase.

Have you also had a look at https://gitlab.gnome.org/GNOME/xdg-desktop-portal-gnome/-/issues/104 ? If you experience this only on 24.04, then it's likely related. Unfortunately, I dont have enough time to try and repro that more than I could so far (i.e. trying to run firefox snap under GNOME but breaking DBus and others would not reproduce the issue for me), and if the problem really is on the desktop portal side, there's probably not a lot we can do without risking breaking badly the experience.

Looks like got confused. I am launching weston from tty terminal which has its own desktop environment like sway. Weston also has its own terminal like ubuntu22.04 & it doesnot show any icons like other than terminal by default. So in weston to launch any application we use terminal. Similar fashion I am launching firefox from terminal. Please check the video I have attached Comment#1 and Comment#2 for your understanding.

Flags: needinfo?(pvharsha)

Weston is not a full desktop environment, it's just a wayland display server. So I still dont know how bad it is in your case if Firefox gets fixed but lacks some important features provided by XDG Desktop Portal. Also, have you checked linked in comment 42 and 44 and the dbus-broker workaround ? I'm really really unsure there's a bug on our side here.

Flags: needinfo?(pvharsha)

You may build Firefox with --disabled-dbus option for such case.

(In reply to :gerard-majax from comment #46)

Weston is not a full desktop environment, it's just a wayland display server. So I still dont know how bad it is in your case if Firefox gets fixed but lacks some important features provided by XDG Desktop Portal. Also, have you checked linked in comment 42 and 44 and the dbus-broker workaround ? I'm really really unsure there's a bug on our side here.

Installing dbus-broker and then launching weston, could see firefox browser launching soon.

Flags: needinfo?(pvharsha)

Martin, Nathan, do you think there's still something we may want to fix here? I would assume that it's a problem outside of firefox and its packaging at that point and comment 48 shows how to fix.

Flags: needinfo?(stransky)
Flags: needinfo?(nathan.teodosio)
Flags: needinfo?(bandali)

I agree with you.

Flags: needinfo?(nathan.teodosio)

(In reply to :gerard-majax from comment #49)

Martin, Nathan, do you think there's still something we may want to fix here? I would assume that it's a problem outside of firefox and its packaging at that point and comment 48 shows how to fix.

Not actionable on Firefox side -> wontfix.

Flags: needinfo?(stransky)

Fine by me and this documents the problem and solution

Status: UNCONFIRMED → RESOLVED
Closed: 11 months ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: