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

Bundled MPRIS plugin can error on SIGINT #81

Closed
pabloab opened this issue Aug 5, 2022 · 30 comments
Closed

Bundled MPRIS plugin can error on SIGINT #81

pabloab opened this issue Aug 5, 2022 · 30 comments

Comments

@pabloab
Copy link

pabloab commented Aug 5, 2022

As mentioned on this mpv issue, every time I run mpv from cli and then ctrl_c (SIGNINT) I get this on stdout:

(process:2): GLib-GIO-CRITICAL **: 18:25:10.679: g_dbus_connection_emit_signal: assertion 'G_IS_DBUS_CONNECTION (connection)' failed
(process:2): GLib-GIO-CRITICAL **: 18:25:10.685: g_dbus_connection_unregister_object: assertion 'G_IS_DBUS_CONNECTION (connection)' failed
(process:2): GLib-GIO-CRITICAL **: 18:25:10.685: g_dbus_connection_unregister_object: assertion 'G_IS_DBUS_CONNECTION (connection)' failed

CounterPillow mention:

mpv itself does not utilise dbus in any way, therefore you're at the wrong place here.

So I suspect here is the right place.

@fastrizwaan
Copy link
Collaborator

mpv flatpak includes mpris support which uses dbus. When you press ctrl+c you also break the dbus connection.

try

flatpak run io.mpv.Mpv --ytdl-format=best "https://youtu.be/jfKfPfyJRdk" 2>/dev/null

or enter sandbox cli, and when you press ctrl+c, the dbus connection is not killed.

flatpak run --command=bash io.mpv.Mpv
mpv --ytdl-format=best "https://youtu.be/jfKfPfyJRdk"

Press CTRL+C, you won't get the error message.

@fastrizwaan
Copy link
Collaborator

also if you press ctrl+c on the playing video window, you won't get those gdus errors.

@fastrizwaan
Copy link
Collaborator

fastrizwaan commented Aug 5, 2022

or simply press "q" instead of ctrl+c in the cli or playback window.

@pabloab
Copy link
Author

pabloab commented Aug 5, 2022

I'm using mpv inside a Bash script, running flatpak run io.mpv.Mpv --quiet --no-video --ytdl-format=best "https://youtu.be/jfKfPfyJRdk".

Sure, I could hide all stderr. Wouldn't be better to handle the SIGINT signal and close everything gracefully?

@fastrizwaan
Copy link
Collaborator

Yes, but, I am not a flatpak dev.
If it's for your own use, you could remove org.mpris.MediaPlayer2.mpv.* using
flatseal
image

If you want to distribute your script, you could use other mpv players in flathub like: celluloid

flatpak run --command=mpv io.github.celluloid_player.Celluloid --quiet --no-video --ytdl-format=best "https://youtu.be/jfKfPfyJRdk"

@pabloab
Copy link
Author

pabloab commented Aug 6, 2022

Removing the session bus doesn't stop the error message from showing up.

image

@fastrizwaan
Copy link
Collaborator

fastrizwaan commented Aug 6, 2022

Yes, then please, handle the stderr 2

flatpak run io.mpv.Mpv --quiet --no-video --ytdl-format=best "https://youtu.be/jfKfPfyJRdk" 2>/tmp/log

the above handles flatpak erros, we can still get mpv error output, like:

shaz@debian:~$ flatpak run io.mpv.Mpv --quiet --no-video /tmp/nofile 2>/tmp/log
[file] Cannot open file '/tmp/nofile': No such file or directory
Failed to open /tmp/nofile.

Exiting... (Errors when loading file)

@pabloab
Copy link
Author

pabloab commented Aug 6, 2022

We could leave this issue open for a flatpak developer interested in handling SIGINT and close everything gracefully. For the time being I'll 2> /dev/null (BTW, odd that some errors are sent to stdout and others to stderr).

@Erick555
Copy link
Contributor

Erick555 commented Aug 6, 2022

Generic flatpak issues should be reported here. It's quite improbable developers will find this thread.

@pabloab
Copy link
Author

pabloab commented Aug 8, 2022

Flatpak's developers believe this isn't a generic issue on their side. Maybe a duplicate of this issue?

@fastrizwaan
Copy link
Collaborator

or you could simply delete the mpris.so

sudo find /var/ -iname "*mpris*"

/var/lib/flatpak/app/io.mpv.Mpv/x86_64/stable/2e360423f2c8ca9162f9c610f85b31f839a1bb647c19c491dbad5efaacaa6de7/files/etc/mpv/scripts/mpris.so

@fastrizwaan
Copy link
Collaborator

fastrizwaan commented Aug 10, 2022

@Erick555 could you help me making the script into flatpak extention? mpris.so is a script included with the main package.

@fastrizwaan fastrizwaan reopened this Aug 10, 2022
@Erick555
Copy link
Contributor

Erick555 commented Aug 10, 2022

For creating extension/plugin, at first you need to declare it in main manifest with specific mountpoint i.e. etc/mpv/scripts/, example here (some sections are optional). After that you need to submit new extension-flatpak i.e. io.mpv.Mpv.Plugin.mpris to flathub (separate github repo), example here

@fastrizwaan
Copy link
Collaborator

fastrizwaan commented Aug 10, 2022

@Erick555 kindly check the yml files, please,
io.mpv.Mpv.yml
mpv-mpris extension.yml

Followed both VLC and https://blog.tingping.se/2018/03/18/flatpaking-plugins.html, but extension.yml fails to build :-(

@TingPing Kindly guide if you can spare some time for the extension. Thanks.

I've uploaded the yml files here:
The main io.mpv.Mpv.yml builds and installs flatpak-builder --user --install --force-clean build-dir io.mpv.Mpv.yml

but flatpak-builder --user --install --force-clean build-dir io.mpv.Mpv.Script.mpv-mpris.yml throws error:

Starting build of io.mpv.Mpv.scripts.mpv-mpris
========================================================================
Building module mpv-mpris in /home/rizvan/.build/mpv_extensions/io.mpv.Mpv.Script.mpv-mpris/.flatpak-builder/build/mpv-mpris-1
========================================================================
error: No extension point matching io.mpv.Mpv.Script.mpv-mpris in app/io.mpv.Mpv/x86_64/stable
Error: module mpv-mpris: Child process exited with code 1

Many thanks.

@TingPing
Copy link
Member

I cannot reproduce this issue.

I think the best solution is just to fix any bugs in the MPRIS plugin. Its a small and simple plugin. However since I cannot reproduce I cannot fix it.

@TingPing
Copy link
Member

TingPing commented Aug 13, 2022

Feel free to try out this patch, it probably solves it: TingPing/mpv-mpris@db49099

@TingPing TingPing changed the title GLib-GIO-CRITICAL after sending SIGINT Bundled MPRIS plugin can error on SIGINT Aug 13, 2022
@fastrizwaan
Copy link
Collaborator

I cannot reproduce this issue.

I think the best solution is just to fix any bugs in the MPRIS plugin. Its a small and simple plugin. However since I cannot reproduce I cannot fix it.

Hi @TingPing,

To reproduce:

  1. open gnome-terminal / konsole
  2. flatpak install flathub --user io.mpv.Mpv
  3. flatpak run io.mpv.Mpv --quiet --no-video --ytdl-format=best "https://youtu.be/jfKfPfyJRdk"
  4. press Ctrl+C at the gnome-terminal while the video is being loaded or being played
  5. we get
Exiting... (Quit)

(process:2): GLib-GIO-CRITICAL **: 06:51:15.224: g_dbus_connection_emit_signal: assertion 'G_IS_DBUS_CONNECTION (connection)' failed

(process:2): GLib-GIO-CRITICAL **: 06:51:15.224: g_dbus_connection_unregister_object: assertion 'G_IS_DBUS_CONNECTION (connection)' failed

(process:2): GLib-GIO-CRITICAL **: 06:51:15.224: g_dbus_connection_unregister_object: assertion 'G_IS_DBUS_CONNECTION (connection)' failed

I built mpv flapak using the suggested patch (using your cloned git), but the issue remains same as above.

I'd like to make mpv-mpris a flatpak extension, for that, I followed your guide and @Erick555's suggested VLC plugin, this is what I came up with.

Application manifest: https://github.com/fastrizwaan/mpv_extensions/blob/main/io.mpv.Mpv/io.mpv.Mpv.yml
Extension manifest: https://github.com/fastrizwaan/mpv_extensions/blob/main/io.mpv.Mpv.Scripts.mpv-mpris/io.mpv.Mpv.Script.mpv-mpris.yml

Kindly help me with flatpak addon/extensions, so that I could bundle other useful mpv addons like subtitle downloader, video-cutter, etc.

Thank you.

@David-Else
Copy link

or you could simply delete the mpris.so

sudo find /var/ -iname "*mpris*"

/var/lib/flatpak/app/io.mpv.Mpv/x86_64/stable/2e360423f2c8ca9162f9c610f85b31f839a1bb647c19c491dbad5efaacaa6de7/files/etc/mpv/scripts/mpris.so

@fastrizwaan Hi, I am looking for a solution to this bug. I don't want mpris.so, so deleting it is fine, but won't it just come back after a flatpak update? Is there any other solution?

@fastrizwaan
Copy link
Collaborator

fastrizwaan commented May 16, 2023

  1. Using Alias (you may put it in ~/.bashrc
alias mpv="flatpak run io.mpv.Mpv 2>/dev/null"

wont't show errors at all. pressing ctrl+c won't show any error

  1. you could put find and delete mpris.so in crontab to delete it if found sudo find /var/ -iname "*mpris*so.*" -delete

@David-Else
Copy link

David-Else commented May 16, 2023

@fastrizwaan Thanks for the quick reply! I don't really understand what the error means though, does it mean processes are left running when they should be shut down, or even possible memory leaks? I think the CRITICAL in caps is a bit worrying...

@in-plaintext
Copy link

in-plaintext commented Dec 2, 2023

I'm currently frequently getting the error when playing videos:

(process:2): GLib-GIO-CRITICAL **: 14:15:49.179: g_dbus_connection_emit_signal: assertion 'G_IS_DBUS_CONNECTION (connection)' failed

The error is printed when starting playback, but not always. The media keys appear to still work. I'll create a fresh VM and report back with logs (EDIT: it may be challenging to play video formats in a VM, no support for H.264).


mpv v0.37.0 Copyright © 2000-2023 mpv/MPlayer/mplayer2 projects
libplacebo version: v6.338.1
FFmpeg version: n6.1
FFmpeg library versions:
   libavutil       58.29.100
   libavcodec      60.31.102
   libavformat     60.16.100
   libswscale      7.5.100
   libavfilter     9.12.100
   libswresample   4.12.100

@fastrizwaan

This comment was marked as off-topic.

@fastrizwaan fastrizwaan self-assigned this Dec 2, 2023
@in-plaintext
Copy link

Just enable system-bus in flatseal or set --socket=system-bus it will not throw that error anymore. image

I enabled both D-Bus options in Flatseal, the error persists when launching a video.

@fastrizwaan
Copy link
Collaborator

I enabled both D-Bus options in Flatseal, the error persists when launching a video.

Sorry, I wasn't replying to you, it was the solution for the original bug about ctrl+c SIGINT causing error. It is fixed by enabling the system-bus permission.

@fastrizwaan
Copy link
Collaborator

@pabloab the issue is resolved by allowing system-bus permission to mpv.

@fastrizwaan
Copy link
Collaborator

I enabled both D-Bus options in Flatseal, the error persists when launching a video.

@in-plaintext could you check with other distro or in an another distro in a virtual machine. Launching a video does not cause errors for me.

@pabloab
Copy link
Author

pabloab commented Dec 4, 2023

@fastrizwaan flatpak run --socket=system-bus io.mpv.Mpv --ytdl-format=best "https://youtu.be/jfKfPfyJRdk" still show those errors when ctrl+c SIGINT, like mentioned by @in-plaintext (btw, I can't see the image he posted. I don't see them with a regular webm file, though.

Flatpak 1.11.1, mpv v0.37.0, dbus 1.12.16-2ubuntu2.3, Ubuntu 20.04.6 LTS.

@fastrizwaan
Copy link
Collaborator

fastrizwaan commented Dec 4, 2023

try

flatpak run --socket=session-bus io.mpv.Mpv --ytdl-format=best "https://youtu.be/jfKfPfyJRdk"

flatpak run --socket=session-bus io.mpv.Mpv --quiet --no-video --ytdl-format=best "https://youtu.be/jfKfPfyJRdk"

TingPing added a commit that referenced this issue Dec 4, 2023
It is a third party plugin that is causing crashes.

It is unfair to mpv to include it by default. This should go into an extension.

Closes #81
@fastrizwaan
Copy link
Collaborator

@pabloab with the latest release 0.38.0 flathub, pressing ctrl+c for flatpak run io.mpv.Mpv --quiet --no-video --ytdl-format=best "https://youtu.be/jfKfPfyJRdk" is not showing any error on my fedora silverblue 40 x86_64.

@fastrizwaan
Copy link
Collaborator

cli is not the intended use case.. Anyways can't reproduce the bug.

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

Successfully merging a pull request may close this issue.

6 participants