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

Setting xdg.portal.gtkUsePortal=true causes a significant delay when starting a GNOME session #135898

Closed
alexeymuranov opened this issue Aug 27, 2021 · 12 comments
Labels
0.kind: bug Something is broken 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS

Comments

@alexeymuranov
Copy link
Contributor

Describe the bug

After setting xdg.portal.gtkUsePortal = true, logging into a GNOME session (with GDM) until the desktop is shown takes about 70 seconds on my system, while with xdg.portal.gtkUsePortal = false it takes about 20 seconds.

Steps To Reproduce

  1. Try logging in when xdg.portal.gtkUsePortal = false.
  2. Try logging in when xdg.portal.gtkUsePortal = true.

Expected behavior

I would not expect a 3x slowdown.

Additional context

Notify maintainers

Metadata

$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 5.10.60-hardened1, NixOS, 21.05.2729.9d6766c0f0b (Okapi)`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.3.15`
 - channels(alexey): `""`
 - channels(root): `"nixos-21.05.2729.9d6766c0f0b"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`

Maintainer information:

# a list of nixpkgs attributes affected by the problem
attribute:
# a list of nixos modules affected by the problem
module:
@alexeymuranov alexeymuranov added the 0.kind: bug Something is broken label Aug 27, 2021
@jansol
Copy link
Contributor

jansol commented Aug 27, 2021

Is this on Wayland or X11?

Portals seem to be a bit wonky on KDE (Wayland) too, as screensharing (obs, teams; for some bizarre reason discord does not have a problem there) complains about the relevant protocol not being supported although the compositor clearly advertises it. Maybe GNOME is trying to find some services and blocking until it times out?

@alexeymuranov
Copy link
Contributor Author

This was on X11.

@jansol
Copy link
Contributor

jansol commented Aug 27, 2021

Ah, the OBS vs discord thing seems to be because discord is running in XWayland, using Xcomposite capture rather than the desktop portal (and does indeed only see other XWayland windows). Forcing OBS to run in XWayland with QT_QPA_PLATFORM=xcb obs confirms this.

@veprbl veprbl added the 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS label Aug 28, 2021
@maydayv7
Copy link

maydayv7 commented Sep 17, 2021

Facing the same issue, X11 GNOME 40.1, even gdm seems to be affected
No related logs found

@ivankovnatsky
Copy link
Contributor

ivankovnatsky commented Nov 20, 2021

I had similar issue on sway: swaywm/sway#6587

added overlay for git xdg-desktop-portal: https://github.com/ivankovnatsky/nixos-config/blob/main/overlays/xdg-desktop-portal.nix

I see that this PR fixes it: https://github.com/NixOS/nixpkgs/pull/145619/files -- already landed in nixos-unstable.

@SuperSamus
Copy link
Contributor

Is there any reason why this isn't closed yet?

@alexeymuranov
Copy link
Contributor Author

Is there any reason why this isn't closed yet?

It is not resolved.

@Lyndeno
Copy link
Contributor

Lyndeno commented May 22, 2022

Seems to still not be resolved. I have not tried setting gtkUsePortal = false yet to confirm however.

Facing the same issue, X11 GNOME 40.1, even gdm seems to be affected No related logs found

What issues were you experiencing with gdm? I am experiencing this thing on unstable where when the screen times out while in gnome, I'll wake the screen to find the tty is switched to the gdm lock screen. I have to switch the tty back to my current gnome session.

@maydayv7
Copy link

maydayv7 commented Jun 18, 2022

What issues were you experiencing with gdm?.

GDM takes almost 3x the amount of time to load in, as well as about 5x the amount of time to start session after login. Memory usage shoots up from about 600MB on idle to 2.4GB. Suspension sometimes crashes the system, TTY switching sometimes logs out session. None of these problems occur when gtkUsePortal = false

On GNOME 42, NixOS 22.05

jtojnar added a commit to jtojnar/nixpkgs that referenced this issue Jun 26, 2022
It was never meant to be used for anything other than testing
and setting it globally can cause weird loops in GTK-based portals,
where the portal will end up waiting for itself until it times out.

NixOS#135898

Or it can mess up fonts:

NixOS#155291 (comment)

Having the option in NixOS makes it look like it is okay or even
desirable to enable, when in fact it is a hack that can subtly break apps.

Some apps allow opting into using portal-based APIs, e.g. for Firefox,
you can set `widget.use-xdg-desktop-portal.file-picker` to `1` in about:config.
Otherwise, you can set the `GTK_USE_PORTAL` environment variable to 1
for individual apps.

People who really want it and aware of the downsides can just set
`environment.sessionVariables.GTK_USE_PORTAL = "1";` NixOS option
directly to set the environment variable globally.
@SuperSamus
Copy link
Contributor

I think that this can now be closed, since xdg.portal.gtkUsePortal has been removed.

@jtojnar
Copy link
Member

jtojnar commented Jul 8, 2022

We still have it in 22.05 so unless we backport #179204, it might be better to keep it open for visibility.

@SuperSamus
Copy link
Contributor

With NixOS 22.11 coming soon, I guess that this can now be closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: bug Something is broken 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS
Projects
None yet
Development

No branches or pull requests

8 participants