hydrus icon indicating copy to clipboard operation
hydrus copied to clipboard

MPV player opens new unclosable window (Linux)

Open ranenvious opened this issue 1 year ago • 8 comments

Hydrus version

521

Qt major version

Qt 6

Operating system

Linux (specify distro and version in comments)

Install method

Third party (AUR, Docker, Chocolatey, etc. Specify in comments)

Install and OS comments

EndeavourOS, up-to-date, used yay AUR helper

Bug description and reproduction

  1. Whenever a video plays, instead of playing inside of hydrus it instead force-opens an mpv player window externally.
  2. These windows do not respond to being closed and do not even appear to respond to kill signals, existing as zombie processes. (it's hard to be sure since the process names aren't super clear though. They may respond to sigkills and I just wasn't looking at the right process. In eithercase though they should still close from simply clicking on the close button on the window, or just play inside of hydrus directly which I believe is the intended behaviour) Addendum : Does not respond to sig-kills. I used the KDE kill-process shortcut that kills whatever process you click on and the MPV window did not close. client - 2023-05.log

Log output

<The log file was attached above, below is the terminal output from running the client from the terminal>
v521, 2023/03/24 18:08:56: hydrus client started
qt.qpa.plugin: Could not find the Qt platform plugin "wayland" in ""
v521, 2023/03/24 18:08:57: booting controller…
v521, 2023/03/24 18:08:57: booting db…
v521, 2023/03/24 18:08:57: checking database
v521, 2023/03/24 18:08:57: preparing db caches
v521, 2023/03/24 18:08:57: initialising managers
v521, 2023/03/24 18:08:57: booting gui…
v521, 2023/03/24 18:08:57: starting services…
v521, 2023/03/24 18:08:58: Running "client api" on port 45869.
v521, 2023/03/24 18:08:58: services started
v521, 2023/03/24 18:10:44: Uncaught exception:
v521, 2023/03/24 18:10:44: ShutdownError
libmpv core has been shutdown
  File "/opt/hydrus/hydrus/client/gui/canvas/ClientGUICanvas.py", line 1343, in ClearMedia
    Canvas.ClearMedia( self )
  File "/opt/hydrus/hydrus/client/gui/canvas/ClientGUICanvas.py", line 737, in ClearMedia
    self.SetMedia( None )
  File "/opt/hydrus/hydrus/client/gui/canvas/ClientGUICanvas.py", line 1577, in SetMedia
    Canvas.SetMedia( self, media )
  File "/opt/hydrus/hydrus/client/gui/canvas/ClientGUICanvas.py", line 1221, in SetMedia
    self._media_container.ClearMedia()
  File "/opt/hydrus/hydrus/client/gui/canvas/ClientGUICanvasMedia.py", line 1781, in ClearMedia
    self._DestroyOrHideThisMediaWindow( self._media_window )
  File "/opt/hydrus/hydrus/client/gui/canvas/ClientGUICanvasMedia.py", line 1468, in _DestroyOrHideThisMediaWindow
    media_window.ClearMedia()
  File "/opt/hydrus/hydrus/client/gui/canvas/ClientGUIMPV.py", line 270, in ClearMedia
    self.SetMedia( None )
  File "/opt/hydrus/hydrus/client/gui/canvas/ClientGUIMPV.py", line 560, in SetMedia
    self._player.pause = True
  File "/usr/lib/python3.10/site-packages/mpv.py", line 2015, in __setattr__
    self._set_property(_py_to_mpv(name), value)
  File "/usr/lib/python3.10/site-packages/mpv.py", line 2001, in _set_property
    self.check_core_alive()
  File "/usr/lib/python3.10/site-packages/mpv.py", line 976, in check_core_alive
    raise ShutdownError('libmpv core has been shutdown')

v521, 2023/03/24 18:10:48: Uncaught exception:
v521, 2023/03/24 18:10:48: ShutdownError
libmpv core has been shutdown
  File "/opt/hydrus/hydrus/client/gui/ClientGUIShortcuts.py", line 1262, in eventFilter
    shortcut_processed = self._ProcessShortcut( shortcut )
  File "/opt/hydrus/hydrus/client/gui/ClientGUIShortcuts.py", line 1202, in _ProcessShortcut
    command_processed = self._parent.ProcessApplicationCommand( command )
  File "/opt/hydrus/hydrus/client/gui/canvas/ClientGUICanvas.py", line 4296, in ProcessApplicationCommand
    command_processed = CanvasMediaListNavigable.ProcessApplicationCommand( self, command )
  File "/opt/hydrus/hydrus/client/gui/canvas/ClientGUICanvas.py", line 4052, in ProcessApplicationCommand
    self._ShowNext()
  File "/opt/hydrus/hydrus/client/gui/canvas/ClientGUICanvas.py", line 3526, in _ShowNext
    self.SetMedia( self._GetNext( self._current_media ) )
  File "/opt/hydrus/hydrus/client/gui/canvas/ClientGUICanvas.py", line 1234, in SetMedia
    self._media_container.SetMedia( self._current_media, maintain_zoom, maintain_pan )
  File "/opt/hydrus/hydrus/client/gui/canvas/ClientGUICanvasMedia.py", line 2199, in SetMedia
    self._MakeMediaWindow()
  File "/opt/hydrus/hydrus/client/gui/canvas/ClientGUICanvasMedia.py", line 1571, in _MakeMediaWindow
    self._media_window.SetMedia( self._media, start_paused = self._start_paused )
  File "/opt/hydrus/hydrus/client/gui/canvas/ClientGUIMPV.py", line 583, in SetMedia
    self._player.visibility = 'always'
  File "/usr/lib/python3.10/site-packages/mpv.py", line 2015, in __setattr__
    self._set_property(_py_to_mpv(name), value)
  File "/usr/lib/python3.10/site-packages/mpv.py", line 2001, in _set_property
    self.check_core_alive()
  File "/usr/lib/python3.10/site-packages/mpv.py", line 976, in check_core_alive
    raise ShutdownError('libmpv core has been shutdown')

v521, 2023/03/24 18:10:49: Uncaught exception:
v521, 2023/03/24 18:10:49: ShutdownError
libmpv core has been shutdown
  File "/opt/hydrus/hydrus/client/gui/ClientGUIShortcuts.py", line 1262, in eventFilter
    shortcut_processed = self._ProcessShortcut( shortcut )
  File "/opt/hydrus/hydrus/client/gui/ClientGUIShortcuts.py", line 1202, in _ProcessShortcut
    command_processed = self._parent.ProcessApplicationCommand( command )
  File "/opt/hydrus/hydrus/client/gui/canvas/ClientGUICanvas.py", line 4296, in ProcessApplicationCommand
    command_processed = CanvasMediaListNavigable.ProcessApplicationCommand( self, command )
  File "/opt/hydrus/hydrus/client/gui/canvas/ClientGUICanvas.py", line 4052, in ProcessApplicationCommand
    self._ShowNext()
  File "/opt/hydrus/hydrus/client/gui/canvas/ClientGUICanvas.py", line 3526, in _ShowNext
    self.SetMedia( self._GetNext( self._current_media ) )
  File "/opt/hydrus/hydrus/client/gui/canvas/ClientGUICanvas.py", line 1234, in SetMedia
    self._media_container.SetMedia( self._current_media, maintain_zoom, maintain_pan )
  File "/opt/hydrus/hydrus/client/gui/canvas/ClientGUICanvasMedia.py", line 2199, in SetMedia
    self._MakeMediaWindow()
  File "/opt/hydrus/hydrus/client/gui/canvas/ClientGUICanvasMedia.py", line 1599, in _MakeMediaWindow
    self._DestroyOrHideThisMediaWindow( old_media_window )
  File "/opt/hydrus/hydrus/client/gui/canvas/ClientGUICanvasMedia.py", line 1468, in _DestroyOrHideThisMediaWindow
    media_window.ClearMedia()
  File "/opt/hydrus/hydrus/client/gui/canvas/ClientGUIMPV.py", line 270, in ClearMedia
    self.SetMedia( None )
  File "/opt/hydrus/hydrus/client/gui/canvas/ClientGUIMPV.py", line 560, in SetMedia
    self._player.pause = True
  File "/usr/lib/python3.10/site-packages/mpv.py", line 2015, in __setattr__
    self._set_property(_py_to_mpv(name), value)
  File "/usr/lib/python3.10/site-packages/mpv.py", line 2001, in _set_property
    self.check_core_alive()
  File "/usr/lib/python3.10/site-packages/mpv.py", line 976, in check_core_alive
    raise ShutdownError('libmpv core has been shutdown')

v521, 2023/03/24 18:10:50: Failed to produce a tile! Info is: f8d561f3b1ad65fb6f21a9d6a83366b95a67a84cd4bab5779fba1df361693a59, (2833, 3000), PySide6.QtCore.QRect(0, 3978, 2833, -978), PySide6.QtCore.QSize(765, 435)
v521, 2023/03/24 18:10:50: Failed to produce a tile! Info is: f8d561f3b1ad65fb6f21a9d6a83366b95a67a84cd4bab5779fba1df361693a59, (2833, 3000), PySide6.QtCore.QRect(3978, 0, -1145, 3000), PySide6.QtCore.QSize(285, 765)
v521, 2023/03/24 18:10:50: Failed to produce a tile! Info is: f8d561f3b1ad65fb6f21a9d6a83366b95a67a84cd4bab5779fba1df361693a59, (2833, 3000), PySide6.QtCore.QRect(3978, 3978, -1145, -978), PySide6.QtCore.QSize(285, 435)

ranenvious avatar Mar 24 '23 22:03 ranenvious

There doesn't seem to be a hydrus bug for this specifically but it's a known Wayland/MPV bug*, the workaround is to tell hydrus (QT actually) not to use Wayland: env --unset=WAYLAND_DISPLAY --unset=QT_QPA_PLATFORM hydrus-client

*: https://github.com/hydrusnetwork/hydrus/issues/1267 https://github.com/mpv-player/mpv/issues/9654 https://gitlab.freedesktop.org/wayland/wayland-protocols/-/issues/74

RunningDroid avatar Mar 24 '23 23:03 RunningDroid

#1267 seems to be a distinct issue, and the other two you listed (while I do think they are to blame) don't seem to be on the path to being fixed anytime soon. If wayland isn't going to bother supporting embeded playback it's probably worth it to implement a workaround directly within hydrus itself. edit : also I tried launching the client with the command you suggested and the issue persists even with it.

ranenvious avatar Mar 25 '23 00:03 ranenvious

I have the same problem, and env --unset=WAYLAND_DISPLAY --unset=QT_QPA_PLATFORM hydrus-client also didn't fix it for me.

theoretischer avatar May 07 '23 17:05 theoretischer

Does anything change if you do QT_QPA_PLATFORM=xcb hydrus-client? (explicitly telling QT to use the X11 backend) @Churchexe Sorry for the delay, I missed your edit

Here's a log from the variant I can reproduce, the traces are different but that could just be because I'm on 526: client - 2023-05.log

RunningDroid avatar May 07 '23 22:05 RunningDroid

Does anything change if you do QT_QPA_PLATFORM=xcb hydrus-client? (explicitly telling QT to use the X11 backend)

Scratch that, MPV doesn't listen to what QT's been told to do. Try running hydrus as QT_QPA_PLATFORM=xcb hydrus-client and telling it to use this mpv.conf (or adding gpu-context=x11egl to your existing one if you have one.)

Just a heads up, hydrus will crash if you tell mpv to use X11 but don't tell QT to use X11.

RunningDroid avatar May 11 '23 03:05 RunningDroid

Where do i have to place the mpv.conf?

theoretischer avatar May 11 '23 13:05 theoretischer

I believe the only way to get hydrus to use the mpv.conf is by giving it the file through the options menu here: 2023-05-11T15:14:45,869537862-04:00

RunningDroid avatar May 11 '23 19:05 RunningDroid

I got some free time over the past week and got back around to setting up hydrus on my computer. I found a much cleaner workaround that should help and could likely even mark this as closed with a tiny packaging tweak. If you install Hydrus as a flatpak and then disable "Wayland windowing system" in flatseal it appears to work perfectly as expected. (well, aside from the "A window with frame key "media_viewer" that wanted to display at "PySide6.QtCore.QPoint(70,70)" was rescued from apparent off-screen..." errors, but I think those are a different issue and eitherway they're easy enough to ignore)

I admittedly don't have much experience with packaging, but from what I understand it's possible to package flatpaks with their permissions pre-loaded so you could package the hydrus flatpak with the "Wayland windowing system" option flipped off and then it would be "fixed" automatically. Of course you are then basically ruling off native installations which is definitely not great, but it's a perfectly functional fix that should be easy enough to implement. Personally I try to avoid Flatpaks in favour of native installations, but given the responses given for the issues linked by RunningDroid I'm guessing there won't be a native fix anytime soon.

Unfortunately going by https://hydrusnetwork.github.io/hydrus/getting_started_installing.html I'm not sure whether this would technically be a "fix" or not since the flatpak is maintained unofficially. While this does fix the problem, it would require marking that unoffical installation method as the primary installation method.

I'm no developer so I won't make any statements eitherway, but I know that this at least works as a workaround for now, whether it should count as an official fix or not is another question entirely.

ranenvious avatar Aug 06 '23 23:08 ranenvious