Skip to content
This repository has been archived by the owner on Dec 18, 2024. It is now read-only.

playerctl + mpv + mpris causes AwesomeWM to crash #215

Open
musjj opened this issue Aug 24, 2023 · 5 comments
Open

playerctl + mpv + mpris causes AwesomeWM to crash #215

musjj opened this issue Aug 24, 2023 · 5 comments

Comments

@musjj
Copy link

musjj commented Aug 24, 2023

When you have the mpris plugin installed on mpv and a playerctl signal active in the background, trying to open a video with mpv will freeze and crash AwesomeWM.

To reproduce:

  1. Install the mpris plugin (https://github.com/hoyon/mpv-mpris)
  2. Make sure there is an active, connected playerctl signal in your config
  3. Open a video with mpv
@musjj
Copy link
Author

musjj commented Aug 24, 2023

I made a minimal reproduction:

local gears = require("gears")
local lgi = require("lgi")
local wibox = require("wibox")

local widget = wibox.widget.textbox()
local Playerctl = lgi.Playerctl

gears.timer.delayed_call(function()
  local manager = Playerctl.PlayerManager()

  function manager:on_name_appeared(name)
    local player = Playerctl.Player.new_from_name(name)
    manager:manage_player(player)

    function player:on_metadata(metadata)
      if self:get_title() then
        widget:set_text(self:get_artist() .. "" .. self:get_title())
      else
        widget:set_text("-")
      end
    end

    function player:on_playback_status()
      if self:get_title() then
        widget:set_text(self:get_artist() .. "" .. self:get_title())
      else
        widget:set_text("-")
      end
    end

    widget:connect_signal("button::press", function() player:play_pause() end)
  end
end)

It seems that the issue only happens when you use Playerctl.PlayerManager. If you use Playerctl.Player directly, the issue no longer occurs. This is probably an upstream issue, but the repo has not been active for almost 2 years now...

@Aire-One
Copy link

Aire-One commented Aug 24, 2023

EDIT: Oops sorry. I thought we were in the Awesome repository. Feel free to dismiss my comment.

Hello @musjj,

This issue sounds unrelated to Awesome.

LGI (https://github.com/lgi-devs/lgi) is a Lua binding to GObject based libraries. It can be used independently from Awesome. So you could try to make the minimal example be a simple script.

Also, when reporting issues, stack strace/error messages/logs are useful to understand what's going on.

@musjj
Copy link
Author

musjj commented Aug 24, 2023

No worries, that's actually helpful. This time, AwesomeWM didn't crash, but the player still took a long time to launch. So I looked at AwesomeWM's stderr and I found this:

2023-08-24 15:13:52 W: awesome: a_glib_poll:477: Last main loop iteration took
25.012281 seconds! Increasing limit for this warning to that value.

It looks like it got stuck in a loop somewhere? This might be an AwesomeWM issue, rather than playerctl, but I'm not so sure.

@Aire-One
Copy link

Aire-One commented Aug 24, 2023

This error basically means that something blocked the Awesome process for a long period of time. It is problematic because while Awesome is blocked, the computer feels frozen to the user.

I guess the something blocking Awesome is the Payerctl stuff, but I also can't guarantee it's that. 🤷

@musjj
Copy link
Author

musjj commented Aug 25, 2023

The error disappears if I remove the playerctl part. So I guess either lgi or playerctl is the culprit here.

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

No branches or pull requests

2 participants