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

g_dbus_connection_register_object: assertion 'error == NULL || *error == NULL' failed #82

Open
WhyNotHugo opened this issue Nov 3, 2022 · 6 comments

Comments

@WhyNotHugo
Copy link

I'm seeing this every time mpv runs with this plugin:

(process:378104): GLib-GIO-CRITICAL **: 20:46:25.185: g_dbus_connection_register_object: assertion 'error == NULL || *error == NULL' failed

Nothing seems to be broken yet, but I'm pointing this out because I'm not sure if something will break in upcoming gio releases due to this.

@hoyon
Copy link
Owner

hoyon commented Nov 5, 2022

I'm not seeing this when running on my machine with glib2 2.74.1 and mpv 0.34.1.

What versions are you running?

Looking at the code here: https://github.com/hoyon/mpv-mpris/blob/master/mpris.c#L825 it looks like it could be because you're getting an error with the first call to g_dbus_connection_register_object. Are you getting any additional logging? It looks like it should if error != NULL but it's possible error->message is an empty string.

I suppose the warning could be fixed by resetting error to NULL between the calls but I would have thought that either of those calls failing would be pretty fatal.

@jman-schief
Copy link

jman-schief commented Aug 12, 2023

I've been seeing this error since long time, can't say when it started. I'm on Debian trixie/sid and using mpv 0.36.0 and libglib2 2.77.1

I've tried running mpv --msg-level=all=trace <something.mp4> but nothing interesting in the logs.

So I've tried getting more logs from GLIB with:

$ G_MESSAGES_DEBUG=all mpv <something.mp4>
(process:406894): GLib-GIO-DEBUG: 13:42:47.410: Using cross-namespace EXTERNAL authentication (this will deadlock if server is GDBus < 2.73.3)
An object is already exported for the interface org.mpris.MediaPlayer2 at /org/mpris/MediaPlayer2
(process:406894): GLib-GIO-CRITICAL **: 13:42:47.413: g_dbus_connection_register_object: assertion 'error == NULL || *error == NULL' failed
An object is already exported for the interface org.mpris.MediaPlayer2 at /org/mpris/MediaPlayer2

Anything interesting or relevant?

@hoyon
Copy link
Owner

hoyon commented Aug 21, 2023

Is it possible you have mpv-mpris installed multiple times? eg once in the mpv system directory (/etc/mpv/scripts) and once in your config directory (~/.config/mpv/scripts)?

This error can pop up if it's been loaded multiple times which seems to be the case as it's saying it's already exported.

@WhyNotHugo
Copy link
Author

I'm not using the host on which I was seeing that error any more (which ran ArchLinux),

I can't repro this on Alpine, but I'll leave the issue open since others are reporting seeing it too.

@jman-schief
Copy link

Is it possible you have mpv-mpris installed multiple times? eg once in the mpv system directory (/etc/mpv/scripts) and once in your config directory (~/.config/mpv/scripts)?

@hoyon Thanks for the suggestion! I only have one mpv-mpris under ~/.config/mpv/scripts/mpris.so but nonethless your idea makes me want to investigate into the dbus registry for possible duplicates of the interface /org/mpris/MediaPlayer2 (e.g. I also have Celluloid installed). The dbus-send cli is user-hostile so I will be back when I've figured out the incantation to find all occurrences :)

@trinitronx
Copy link

trinitronx commented Sep 18, 2023

Reproducible also on Manjaro (based on ArchLinux, mpv-mpris v1.0-1). Initial symptoms were that playerctl status was showing Stopped, even while mpv was the only player currently playing. The same output could be seen in mpv command output:

An object is already exported for the interface org.mpris.MediaPlayer2 at /org/mpris/MediaPlayer2
(process:141405): GLib-GIO-CRITICAL **: 16:04:51.595: g_dbus_connection_register_object: assertion 'error == NULL || *error == NULL' failed
An object is already exported for the interface org.mpris.MediaPlayer2 at /org/mpris/MediaPlayer2

Using D-Spy, I can see the following Bus Names with prefix: org.mpris.MediaPlayer2:

  • org.mpris.MediaPlayer2.playerctld - playerctld
    • From package: playerctl
    • Started by: /usr/share/dbus-1/services/org.mpris.MediaPlayer2.playerctld.service line: Exec=/usr/bin/playerctld
  • org.mpris.MediaPlayer2.chromium.instance283357 - Google Chrome

I tried stopping Google Chrome, then restarting mpv and although the same messages were output to the logs, playerctl status then correctly showed Playing. Not sure what restarting Chrome did, but it must have been some buggy behavior due to interactions between Chrome & mpv grabbing the D-Bus player interface?

After stopping & restarting Chrome, the org.mpris.MediaPlayer2.chromium.* instances were gone. Only while playing a YouTube video, did Chrome create a new instance in D-Bus names listing viewed in D-Spy. I experimented with playerctl status and playerctl stop when both Chrome & mpv were playing (starting YouTube video in Chrome first, then mpv after). In that case, playerctl status correctly displayed Playing. playerctl stop resulted in the mpv stopping, while Chrome's YouTube video was still left playing. Another playerctl stop command after that stopped Chrome from playing, and playerctl status displayed Stopped. So all seemed working again, or at least everything seemed working for as long as I wanted to spend testing it. However, the initial state observed was that no tabs in Chrome were playing anything, and there was only a Google search result tab left open overnight. Maybe in some cases Chrome does not clean up its D-Bus org.mpris.MediaPlayer2.chromium.* interface?

Also it's not clear why the log message still appears in mpv even while playerctl is behaving correctly and outputting status, and responding correctly to pause, stop and other commands.

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

No branches or pull requests

4 participants