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

Realtime error: Could not map pid: Could not determine pid namespace: Could not find instance-id in process's /.flatpak-info #1167

Closed
tekstryder opened this issue Oct 22, 2023 · 18 comments
Labels
bug need more info needs diagnosis Root cause of the issue needs to be diagnosed portal: realtime RealTime portal

Comments

@tekstryder
Copy link

tekstryder commented Oct 22, 2023

Operating System

Arch Linux

XDG Desktop Portal version

1.18

XDG Desktop Portal version (Other)

xdg-desktop-portal-gtk 1.15.1
xdg-desktop-portal-gnome 45.0

Desktop Environment

GNOME

Desktop Environment (Other)

gnome-shell --no-x11

Expected Behavior

Run without logging errors in the system journal.

Current Behavior

I can reproduce this easily by launching Evolution mail app for instance:

Oct 22 10:14:12 xdg-desktop-por[8439]: Realtime error: Could not map pid: Could not determine pid namespace: Could not find instance-id in process's /.flatpak-info

Steps to Reproduce

  1. Launch any of {evolution | libreoffice | firefox | chrome | thunar}
  2. Observe error in system journal

Note: those were just the apps I noticed that, when launched, triggered this error emitted by xdg-desktop-portal at a quick grep.
I'm sure there are many more.

Anything else we should know?

  • Arch Linux | Kernel 6.5.8
  • nVidia | Wayland
  • Gnome-shell | Mutter 45.0
  • xdg-desktop-portal 1.18.0

xdg-desktop-portal was pulled in recently as a dependency by nautilus/libportal.

I do not use flatpak.

xdg-desktop-portal
├─libportal
│ ├─libportal-gtk3
│ │ └─file-roller
│ ├─libportal-gtk4
│ │ └─nautilus
@tekstryder tekstryder added the bug label Oct 22, 2023
@hfiguiere
Copy link
Collaborator

This might just be excessively verbose. And not even caused by Evolution per-see.

@tekstryder
Copy link
Author

tekstryder commented Oct 22, 2023

I just used Evolution launch as a quick reproducer.

This also occurs when starting Libreoffice, Firefox, Chrome, Thunar, etc.

EDIT: Edited description thusly.

@GeorgesStavracas GeorgesStavracas added needs diagnosis Root cause of the issue needs to be diagnosed portal: realtime RealTime portal need more info labels Oct 22, 2023
@GeorgesStavracas
Copy link
Member

You can use dbus-monitor to see which application is generating the call to the RealTime portal

swick added a commit to swick/xdg-desktop-portal that referenced this issue Oct 23, 2023
Mapping pids/tids is only necessary when apps are running inside another
pid namespace. Apps on the host usually do not. If they put parts of
themselves into one, it's their responsibility to do the mapping.

Instead of having to make sure that the app is not a host app before
calling this function, handle host apps trivially by not mapping
anything and returning success.

Closes: flatpak#1167
@swick
Copy link
Contributor

swick commented Oct 23, 2023

I do not use flatpak.

@tekstryder are those apps by any chance running as snap then? It's either that or we incorrectly classify something which would be really weird.

@tekstryder
Copy link
Author

I do not use flatpak.

@tekstryder are those apps by any chance running as snap then? It's either that or we incorrectly classify something which would be really weird.

Nope, native host apps. I'll build with swick@71bc452 patch and test...

@tekstryder
Copy link
Author

tekstryder commented Oct 23, 2023

swick@71bc452 solved this for most of the apps I tested.

Firefox, Chrome, Libreoffice, and Thunar no longer trigger the error. Thanks for the quick turnaround time here @swick !

Evolution still does trigger this... it's always been a bit special :)

@swick
Copy link
Contributor

swick commented Oct 23, 2023

The point is, it shouldn't. The patch isn't a behavioral change.

@tekstryder
Copy link
Author

The point is, it shouldn't. The patch isn't a behavioral change.

I'm not clear what you mean by this.

I tested further, and launched every app I have installed (50-ish).

No other app except Evolution causes this error to emit now after applying your change. Seems like a win to me.

@swick
Copy link
Contributor

swick commented Oct 23, 2023

Can you test upstream main?

@tekstryder
Copy link
Author

Can you test upstream main?

Sure, I'll build from 0fb760e. Gimme a few...

@tekstryder
Copy link
Author

tekstryder commented Oct 23, 2023

Hmm, building from main failed meson tests. Should I disable tests and build regardless?

Build test failures

==> Starting check()...
ninja: Entering directory `/build/xdg-desktop-portal/src/build'
ninja: no work to do.
 1/28 xdg-desktop-portal / testdb                             OK               0.00s   3 subtests passed
 2/28 xdg-desktop-portal / test-doc-portal                    SKIP             0.00s   0 subtests passed
 3/28 xdg-desktop-portal:portals / test-portals-account       OK               1.75s   7 subtests passed
 4/28 xdg-desktop-portal:portals / test-portals-background    OK               1.04s   5 subtests passed
 5/28 xdg-desktop-portal:portals / test-portals-camera        OK               1.55s   9 subtests passed
 6/28 xdg-desktop-portal:portals / test-portals-color         OK               1.54s   5 subtests passed
 7/28 xdg-desktop-portal:portals / test-portals-email         OK               1.75s   9 subtests passed
▶  8/28 /portal/inhibit/monitor - xdg-desktop-portal:ERROR:../xdg-desktop-portal/tests/inhibit.c:327:session_state_changed_cb: assertion failed (state == XDP_LOGIN_SESSION_RUNNING): (2 == 1) FAIL          
▶  8/28                                                       ERROR         
 8/28 xdg-desktop-portal:portals / test-portals-inhibit       ERROR            2.18s   killed by signal 6 SIGABRT
>>> XDG_DATA_DIRS=/build/xdg-desktop-portal/src/build/tests/share XDP_UNINSTALLED=1 XDG_CURRENT_DESKTOP=test G_TEST_BUILDDIR=/build/xdg-desktop-portal/src/build/tests G_DEBUG=gc-friendly G_TEST_SRCDIR=/build/xdg-desktop-portal/src/xdg-desktop-portal/tests MALLOC_PERTURB_=219 /build/xdg-desktop-portal/src/build/tests/test-portals --verbose --keep-going --tap -p /portal/inhibit
――――――――――――――――――――――――――――――――――――― ✀  ―――――――――――――――――――――――――――――――――――――
Listing only the last 100 lines from a long log.
XDP: providing portal org.freedesktop.portal.PowerProfileMonitor
XDP: providing portal org.freedesktop.portal.NetworkMonitor
XDP: providing portal org.freedesktop.portal.ProxyResolver
XDP: providing portal org.freedesktop.portal.Trash
XDP: providing portal org.freedesktop.portal.GameMode

(/build/xdg-desktop-portal/src/build/tests/../src/xdg-desktop-portal:2749): xdg-desktop-portal-WARNING **: 08:42:42.263: Failed to create RealtimeKit proxy: Could not connect: No such file or directory
XDP: providing portal org.freedesktop.portal.Realtime
XDP: Found 'test' in configuration for default
XDP: Using test.portal for org.freedesktop.impl.portal.Settings (config)
XDP: providing portal org.freedesktop.portal.Settings
XDP: Found 'test' in configuration for default
XDP: Using test.portal for org.freedesktop.impl.portal.FileChooser (config)
XDP: providing portal org.freedesktop.portal.FileChooser
XDP: Found 'test' in configuration for default
XDP: Using test.portal for org.freedesktop.impl.portal.AppChooser (config)
XDP: providing portal org.freedesktop.portal.OpenURI
XDP: Found 'test' in configuration for default
XDP: Using test.portal for org.freedesktop.impl.portal.Print (config)
XDP: providing portal org.freedesktop.portal.Print
XDP: Found 'test' in configuration for default
XDP: Using test.portal for org.freedesktop.impl.portal.Notification (config)
XDP: providing portal org.freedesktop.portal.Notification
XDP: Found 'test' in configuration for default
XDP: Using test.portal for org.freedesktop.impl.portal.Inhibit (config)
XDP: providing portal org.freedesktop.portal.Inhibit
XDP: Found 'test' in configuration for default
XDP: Using test.portal for org.freedesktop.impl.portal.Access (config)
XDP: providing portal org.freedesktop.portal.Device
XDP: providing portal org.freedesktop.portal.Location

(/build/xdg-desktop-portal/src/build/tests/../src/xdg-desktop-portal:2749): xdg-desktop-portal-WARNING **: 08:42:42.265: Failed connect to PipeWire: Couldn't connect to PipeWire
XDP: providing portal org.freedesktop.portal.Camera
XDP: Found 'test' in configuration for default
XDP: Using test.portal for org.freedesktop.impl.portal.Screenshot (config)
XDP: providing portal org.freedesktop.portal.Screenshot
XDP: Found 'test' in configuration for default
XDP: Using test.portal for org.freedesktop.impl.portal.Background (config)
XDP: Starting background app monitor
XDP: providing portal org.freedesktop.portal.Background
XDP: Found 'test' in configuration for default
XDP: Using test.portal for org.freedesktop.impl.portal.Wallpaper (config)
XDP: providing portal org.freedesktop.portal.Wallpaper
XDP: Found 'test' in configuration for default
XDP: Using test.portal for org.freedesktop.impl.portal.Account (config)
XDP: using org.freedesktop.impl.portal.Account at org.freedesktop.impl.portal.Test

XDP: providing portal org.freedesktop.portal.Account
XDP: Found 'test' in configuration for default
XDP: Using test.portal for org.freedesktop.impl.portal.Email (config)
XDP: providing portal org.freedesktop.portal.Email
XDP: Found 'test' in configuration for default
XDP: Using test.portal for org.freedesktop.impl.portal.GlobalShortcuts (config)
XDP: providing portal org.freedesktop.portal.GlobalShortcuts
XDP: Found 'test' in configuration for default
XDP: Using test.portal for org.freedesktop.impl.portal.RemoteDesktop (config)
XDP: providing portal org.freedesktop.portal.RemoteDesktop
XDP: Found 'test' in configuration for default
XDP: Using test.portal for org.freedesktop.impl.portal.Clipboard (config)
XDP: providing portal org.freedesktop.portal.Clipboard
XDP: Found 'test' in configuration for default
XDP: Using test.portal for org.freedesktop.impl.portal.InputCapture (config)
XDP: providing portal org.freedesktop.portal.InputCapture
XDP: org.freedesktop.portal.Desktop acquired
XDP: No 'inhibit' permissions found: No entry for inhibit
XDP: Inhibit permissions for : 15
XDP: Calling inhibit backend for : 3
XDP: No 'inhibit' permissions found: No entry for inhibit
XDP: Inhibit permissions for : 15
XDP: Calling inhibit backend for : 10
XDP: No 'inhibit' permissions found: No entry for inhibit
XDP: Inhibit permissions for : 15
XDP: Calling inhibit backend for : 10
XDP: No 'inhibit' permissions found: No entry for inhibit
XDP: Inhibit permissions for : 15
XDP: Calling inhibit backend for : 10

(/build/xdg-desktop-portal/src/build/tests/../src/xdg-desktop-portal:2749): xdg-desktop-portal-WARNING **: 08:42:42.979: A backend call failed: Canceled
XDP: No 'inhibit' permissions found: No entry for inhibit
XDP: Inhibit permissions for : 15
XDP: Calling inhibit backend for : 10
XDP: No 'inhibit' permissions found: No entry for inhibit
XDP: Inhibit permissions for : 15
XDP: Calling inhibit backend for : 10
XDP: No 'inhibit' permissions found: No entry for inhibit
XDP: Inhibit permissions for : 15
XDP: Calling inhibit backend for : 10
XDP: Inhibit permissions for : 5
XDP: Calling inhibit backend for : 1
XDP: inhibit session owned by ':1.0' created
XDP: Received state-changed /org/freedesktop/portal/desktop/session/1_0/portal920089439: screensaver-active: 0, session-state: 1
XDP: Received state-changed /org/freedesktop/portal/desktop/session/1_0/portal920089439: screensaver-active: 0, session-state: 2
**
xdg-desktop-portal:ERROR:../xdg-desktop-portal/tests/inhibit.c:327:session_state_changed_cb: assertion failed (state == XDP_LOGIN_SESSION_RUNNING): (2 == 1)
cleaning up pid 2734
XDP: inhibit session owned by ':1.0' closed
XDP: Starting permission store
XDP: Name lost.

(test program exited with status code -6)
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――

 9/28 xdg-desktop-portal:portals / test-portals-location      OK               1.04s   1 subtests passed
10/28 xdg-desktop-portal:portals / test-portals-notification  OK               1.44s   6 subtests passed
11/28 xdg-desktop-portal:portals / test-portals-openfile      OK               2.56s   15 subtests passed
12/28 xdg-desktop-portal:portals / test-portals-openuri       OK               1.55s   8 subtests passed
13/28 xdg-desktop-portal:portals / test-portals-prepareprint  OK               1.75s   7 subtests passed
14/28 xdg-desktop-portal:portals / test-portals-print         OK               1.54s   7 subtests passed
15/28 xdg-desktop-portal:portals / test-portals-savefile      OK               1.74s   7 subtests passed
16/28 xdg-desktop-portal:portals / test-portals-screenshot    OK               1.54s   6 subtests passed
17/28 xdg-desktop-portal:portals / test-portals-trash         OK               1.03s   2 subtests passed
18/28 xdg-desktop-portal:portals / test-portals-wallpaper     OK               1.85s   6 subtests passed
19/28 xdg-desktop-portal:portals / limited-portals-openfile   OK               2.55s   15 subtests passed
20/28 xdg-desktop-portal:portals / limited-portals-savefile   OK               1.74s   7 subtests passed
21/28 xdg-desktop-portal / test-permission-store              OK               0.01s   14 subtests passed
22/28 xdg-desktop-portal / test-xdp-utils                     OK               0.00s   6 subtests passed
23/28 xdg-desktop-portal:pytest / pytest test_trash           OK               0.61s
24/28 xdg-desktop-portal:pytest / pytest test_clipboard       OK               4.04s
25/28 xdg-desktop-portal:pytest / pytest test_inputcapture    OK               5.50s
26/28 xdg-desktop-portal:pytest / pytest test_email           OK               5.85s
27/28 xdg-desktop-portal:pytest / pytest test_remotedesktop   OK               7.84s
28/28 xdg-desktop-portal:pytest / pytest test_globalshortcuts OK              12.81s

Summary of Failures:

 8/28 xdg-desktop-portal:portals / test-portals-inhibit       ERROR            2.18s   killed by signal 6 SIGABRT

Ok:                 26  
Expected Fail:      0   
Fail:               1   
Unexpected Pass:    0   
Skipped:            1   
Timeout:            0   

Full log written to /build/xdg-desktop-portal/src/build/meson-logs/testlog.txt
==> ERROR: A failure occurred in check().
    Aborting...
==> ERROR: Build failed, check /tmp/ramdisk/chroot/myusername/build

@tekstryder
Copy link
Author

tekstryder commented Oct 23, 2023

Can you test upstream main?

Ah, the same results as #1167 (comment) when testing main.

I packaged 1.18.0+r32+g0fb760e, albeit skipping a meson build failure. Looks good.

EDIT: I'm a bit flummoxed as to why this is behaving differently on main vs release 1.18.0?

Nothing jumps out at me after reviewing the relatively small changeset: 1.18.0...main

@swick
Copy link
Contributor

swick commented Oct 23, 2023

I also looked at the blame and didn't see anything suspicious. Still think we can close this.

@tekstryder
Copy link
Author

I also looked at the blame and didn't see anything suspicious. Still think we can close this.

Okay, thanks for your prompt investigation.

I'll stay on today's main build until next release.

Closing.

@tekstryder
Copy link
Author

Reopening this, having come full-circle among involved projects.

Subsequently reported against evolution here:
https://gitlab.gnome.org/GNOME/evolution/-/issues/2582

And then off to WebKitGTK here:
https://bugs.webkit.org/show_bug.cgi?id=267497

Alas, now directed per Webkit folks back here to where I began.

Milan's (Evolution developer) comment, after his investigation, made sense to me that this would be an issue in WebKit's sandbox implementation.

For what it's worth, when I run Evolution from a terminal as:

WEBKIT_DISABLE_SANDBOX_THIS_IS_DANGEROUS=1 evolution

there is no such warning added into the journal, which I consider as a proof that the problem is related to the WebKit's sandbox. There's not much Evolution can do about it.

Furthermore, when I run devhelp, which also uses WebKitGTK, there is added the same warning into the journal. And the same when I run Epiphany, a WebKitGTK based web browser."

However, per the response on WebKit issue:

At least with the ID missing, xdg-desktop-portal has a chance to detect that there is no ID and take a fallback codepath instead of trying to work with a bogus ID and failing later on.

Perhaps this condition could be handled without logging an error to the system journal, as it appears there is not a functionality issue here.

Evolution's limited use of the D-Bus service succeeds, and WebKit "doesn't have a real flatpak instance".

@tekstryder tekstryder reopened this Jan 13, 2024
@mcatanzaro
Copy link
Contributor

Yeah, so just not printing a warning when the instance ID is missing would be a start. Alternatively, we could add some key to the flatpak-info to indicate that we're not really flatpak, and xdg-desktop-portal could print the warning only if that key is missing.

A more ambitious approach would be to define an entirely new file format to tell xdg-desktop-portal that we're sandboxed, so non-flatpak sandboxes don't have to create a flatpak-info file anymore. Probably not necessary, but it would certainly help avoid confusion and mistakes.

@mcatanzaro
Copy link
Contributor

Patrick was able to fix this in WebKit after all: WebKit/WebKit#23052

@tekstryder
Copy link
Author

I built webkit2gtk-4.1 2.42.4 + WebKit/WebKit#23052, and can confirm it resolved this.

Thanks everyone!

Closing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug need more info needs diagnosis Root cause of the issue needs to be diagnosed portal: realtime RealTime portal
Projects
Status: Triaged
Development

No branches or pull requests

5 participants