Open Jeff-WuYo opened 4 months ago
hey @Jeff-WuYo thanks for making this! I hadn't noticed the zombie process' before. I am working on this now and will link the PR to it
Just letting you know @Jeff-WuYo there is a new version out both here and on the AUR. Also addressed the build dependency problem you also pointed out over there. LMK if it works, and I will close if it all looks good to you
It doesn't show zombie process anymore, but even if I close librewolf, systemd-inhibit --what idle --who swayidle-inhibit --why audio playing --mod block sh -c sleep 60
still remain. It dispon and respon, prohibiting swayidle to suspend my screen. Is there any possible event will trigger swaddle?
it may take about a minute for the process to clear. Currently, swaddle wont kill the current process if you pause or close, but rather keep it running until it times out (60s) at which point it will clean up. If you close it and then wait approx 1-2 minutes it should clear, and wont spawn anything else. I have played with the idea of having it immediately close, but for my use case, i found it much simpler to just let the process time out after 60s.
tldr; the process should close within 1-2 minutes of closing librewolf
If you close it and then wait approx 1-2 minutes it should clear, and wont spawn anything else.
I still observed new process being spawn, even if I closed librewolf (sorry for the previous typo).
ahh are you closing librewolf while something is playing ? I dont think i accounted for that properly. Just pushed another patch out for you to try
It works sometime, but not consistent. I'll get back when I done more testing.\ Is there any scenario you want me to test? e.g. open librewolf -> go to yt -> play a video -> directly exit librewolf, etc.
These are what I've tested, they are somewhat consistent.
hmm interesting. This is good info for me to try and reproduce on my end. It seems like things work as expected, except in a specific case where for some reason the closing of the browser or moving away from it, doesnt seem to be seen by the dbus logic i have. I've been playing around, and still digging for what could be the problem
After 5a91352b3fc84d3af5d82eeda90f4b6844126dcb , number 3. still persist. Another way to produce 3. is to close the tab ---> after systemd-inhibit despawn ---> ctrl + shift + T reopen the tab and play it. Another problem, sometimes I only close youtube tab, but still using librewolf, there's no any stream playing, systemd-inhibit still respawn. This is inconsistent. As for 1 and 2, it behaves much like it's meant to be, so a fix I suppose.
Side Note: If I terminate wayland, swaddle still stay. If I launch x11, swaddle still function. It doesn't seems to effect anything on x11, but it would be nice if it terminate itself if wayland died.
Any development on this? I've got a similar behavior on Qtile/Wayland. I've tried other inhibitors (sway-audio-idle-inhibit + idle-hack and wayland-pipewire-idle-inhibit) and encountered in all cases faulty inhibition after playing videos on my chrome-based browser.
Glad to provide any sort of log.
yeah i still havent made any progress on this. I haven't tried chrome browsers, but you are encountering ? I have noticed that the dbus signals can sometimes be incorrect, which might be whats happening here. Specifically i have noticed there is somtimes delay when moving from Paused
or Stopped
and Playing
unsure about this behavior but trying to see if this is visible anywhere else. If you can find something that points to this, it may help get me looking at a decent solution
I've been investigating this a little and I cannot seriously say now that this issue comes from inhibitors. In my case, the systemd-inhibit
process does actually get killed at the end of a video/audio stream but swayidle (which gets the information) fails to resume the countdown. Its github has some reports pointing similar behaviors. Let you know if I find something of interest.
just to update here, I have started a rewrite of the app where I periodically check the playback status vs waiting for dbus to report it. Hopefully this makes the tracking of the current status much more reliable
@tpaniaki or @Jeff-WuYo would you mind building off the rewrite_swaddle
branch and testing it out ? It seems to be in a good place for myself (endeavouros running hyprland w Zen browser or Brave browser). You can look at the updated readme for help building from source if you need it, and make sure to switch to the rewrite_swaddle
branch https://github.com/ATTron/swaddle/tree/rewrite_swaddle Thanks!
Just built and tested. On my system this doesn't change the underlying problem. As I said in a previous comment, systemd-inhibit
responds properly to playback actions but it looks like swayidle
itself randomly react to it when the inhibition has stopped. See for instance #151.
Ahh okay that sounds like it's outside the scope of this. I have been running the rewrite for a bit, and haven't hit anything on my side yet. I'm going to let it run for a few more days on my machine to confirm everything is going ok before cutting a new release
On my end, qtile behaves weird compare to dwl, either swaddle or sway-audio-idle-inhibit. On qtile, I open a youtube video, systemd-inhibit spawn, after 30 sec or so, it become a zombie process. Close the tab, it get killed after few minutes. I don't know why, but I don't want to test it on qtile. I'll test it on dwl to gather some data.
As for swayidle itself randomly react to it when the inhibition has stopped, I do encounter few random inhibition, keeping screen on when there's no any audio or video playback (dwl + sway-audio-idle-inhibit). I didn't log anything, I thought it's some website triggering it, I just don't know which.
Quick update: On dwl, it behave the same, systemd-inhibit become a zombie.
hmm i cant seem to replicate the zombie processes on my end. Can you run it in debug mode via RUST_LOG=debug swaddle
after building the rewrite branch and do some basic workflows (watching videos, closing, etc) and paste the logs here ?
still behave the same, here are some logs
[2024-11-02T01:58:48Z DEBUG swaddle] Listing players! []
[2024-11-02T01:58:48Z DEBUG swaddle] should_block: false -- process_running: false
[2024-11-02T01:58:48Z DEBUG swaddle] hey we made it into the timing check
[2024-11-02T01:58:53Z DEBUG swaddle] Listing players! ["org.mpris.MediaPlayer2.brave.instance5918"]
[2024-11-02T01:58:53Z DEBUG swaddle] response is Ok(Message { Type: MethodReturn, Sender: ":1.49", Destination: ":1.32", Serial: 12, ReplySerial: 14, Args: [Variant("Playing")] })
[2024-11-02T01:58:53Z DEBUG swaddle] ARG IS Variant(Str("Playing"))
[2024-11-02T01:58:53Z DEBUG swaddle] showing unwrapped: Playing
[2024-11-02T01:58:53Z DEBUG swaddle] should_block: true -- process_running: false
[2024-11-02T01:58:53Z DEBUG swaddle] hey we made it into the timing check
[2024-11-02T01:58:53Z DEBUG swaddle] HEY WE SHOULD BLOCK
[2024-11-02T01:58:53Z DEBUG swaddle] systemd-inhibit has been spawned
[2024-11-02T01:58:53Z DEBUG swaddle] Swayidle is inhibiting now!
[2024-11-02T01:59:23Z DEBUG swaddle] Listing players! ["org.mpris.MediaPlayer2.brave.instance5918"]
[2024-11-02T01:59:23Z DEBUG swaddle] response is Ok(Message { Type: MethodReturn, Sender: ":1.49", Destination: ":1.32", Serial: 13, ReplySerial: 16, Args: [Variant("Playing")] })
[2024-11-02T01:59:23Z DEBUG swaddle] ARG IS Variant(Str("Playing"))
[2024-11-02T01:59:23Z DEBUG swaddle] showing unwrapped: Playing
[2024-11-02T01:59:23Z DEBUG swaddle] should_block: true -- process_running: true
[2024-11-02T01:59:23Z DEBUG swaddle] hey we made it into the timing check
[2024-11-02T01:59:53Z DEBUG swaddle] Listing players! ["org.mpris.MediaPlayer2.brave.instance5918"]
[2024-11-02T01:59:53Z DEBUG swaddle] response is Ok(Message { Type: MethodReturn, Sender: ":1.49", Destination: ":1.32", Serial: 14, ReplySerial: 18, Args: [Variant("Playing")] })
[2024-11-02T01:59:53Z DEBUG swaddle] ARG IS Variant(Str("Playing"))
[2024-11-02T01:59:53Z DEBUG swaddle] showing unwrapped: Playing
[2024-11-02T01:59:53Z DEBUG swaddle] should_block: true -- process_running: true
[2024-11-02T01:59:53Z DEBUG swaddle] hey we made it into the timing check
[2024-11-02T02:00:23Z DEBUG swaddle] Listing players! ["org.mpris.MediaPlayer2.brave.instance5918"]
[2024-11-02T02:00:23Z DEBUG swaddle] response is Ok(Message { Type: MethodReturn, Sender: ":1.49", Destination: ":1.32", Serial: 16, ReplySerial: 20, Args: [Variant("Playing")] })
[2024-11-02T02:00:23Z DEBUG swaddle] ARG IS Variant(Str("Playing"))
[2024-11-02T02:00:23Z DEBUG swaddle] showing unwrapped: Playing
[2024-11-02T02:00:23Z DEBUG swaddle] should_block: true -- process_running: true
[2024-11-02T02:00:23Z DEBUG swaddle] hey we made it into the timing check
[2024-11-02T02:00:53Z DEBUG swaddle] Listing players! ["org.mpris.MediaPlayer2.brave.instance5918"]
[2024-11-02T02:00:53Z DEBUG swaddle] response is Ok(Message { Type: MethodReturn, Sender: ":1.49", Destination: ":1.32", Serial: 24, ReplySerial: 22, Args: [Variant("Playing")] })
[2024-11-02T02:00:53Z DEBUG swaddle] ARG IS Variant(Str("Playing"))
[2024-11-02T02:00:53Z DEBUG swaddle] showing unwrapped: Playing
[2024-11-02T02:00:53Z DEBUG swaddle] should_block: true -- process_running: true
[2024-11-02T02:00:53Z DEBUG swaddle] hey we made it into the timing check
[2024-11-02T02:01:23Z DEBUG swaddle] Listing players! ["org.mpris.MediaPlayer2.brave.instance5918"]
[2024-11-02T02:01:23Z DEBUG swaddle] response is Ok(Message { Type: MethodReturn, Sender: ":1.49", Destination: ":1.32", Serial: 35, ReplySerial: 24, Args: [Variant("Stopped")] })
[2024-11-02T02:01:23Z DEBUG swaddle] ARG IS Variant(Str("Stopped"))
[2024-11-02T02:01:23Z DEBUG swaddle] showing unwrapped: Stopped
[2024-11-02T02:01:23Z DEBUG swaddle] should_block: false -- process_running: true
[2024-11-02T02:01:23Z DEBUG swaddle] hey we made it into the timing check
[2024-11-02T02:01:28Z DEBUG swaddle] Listing players! ["org.mpris.MediaPlayer2.brave.instance5918"]
[2024-11-02T02:01:28Z DEBUG swaddle] response is Ok(Message { Type: MethodReturn, Sender: ":1.49", Destination: ":1.32", Serial: 36, ReplySerial: 26, Args: [Variant("Stopped")] })
[2024-11-02T02:01:28Z DEBUG swaddle] ARG IS Variant(Str("Stopped"))
[2024-11-02T02:01:28Z DEBUG swaddle] showing unwrapped: Stopped
[2024-11-02T02:01:28Z DEBUG swaddle] should_block: false -- process_running: false
[2024-11-02T02:01:28Z DEBUG swaddle] hey we made it into the timing check
[2024-11-02T02:01:33Z DEBUG swaddle] Listing players! ["org.mpris.MediaPlayer2.brave.instance5918"]
[2024-11-02T02:01:33Z DEBUG swaddle] response is Ok(Message { Type: MethodReturn, Sender: ":1.49", Destination: ":1.32", Serial: 47, ReplySerial: 28, Args: [Variant("Playing")] })
[2024-11-02T02:01:33Z DEBUG swaddle] ARG IS Variant(Str("Playing"))
[2024-11-02T02:01:33Z DEBUG swaddle] showing unwrapped: Playing
[2024-11-02T02:01:33Z DEBUG swaddle] should_block: true -- process_running: false
[2024-11-02T02:01:33Z DEBUG swaddle] hey we made it into the timing check
[2024-11-02T02:01:33Z DEBUG swaddle] HEY WE SHOULD BLOCK
[2024-11-02T02:01:33Z DEBUG swaddle] systemd-inhibit has been spawned
[2024-11-02T02:01:33Z DEBUG swaddle] Swayidle is inhibiting now!
[2024-11-02T02:02:03Z DEBUG swaddle] Listing players! ["org.mpris.MediaPlayer2.brave.instance5918"]
[2024-11-02T02:02:03Z DEBUG swaddle] response is Ok(Message { Type: MethodReturn, Sender: ":1.49", Destination: ":1.32", Serial: 48, ReplySerial: 30, Args: [Variant("Playing")] })
[2024-11-02T02:02:03Z DEBUG swaddle] ARG IS Variant(Str("Playing"))
[2024-11-02T02:02:03Z DEBUG swaddle] showing unwrapped: Playing
[2024-11-02T02:02:03Z DEBUG swaddle] should_block: true -- process_running: true
[2024-11-02T02:02:03Z DEBUG swaddle] hey we made it into the timing check
[2024-11-02T02:02:33Z DEBUG swaddle] Listing players! ["org.mpris.MediaPlayer2.brave.instance5918"]
[2024-11-02T02:02:33Z DEBUG swaddle] response is Ok(Message { Type: MethodReturn, Sender: ":1.49", Destination: ":1.32", Serial: 49, ReplySerial: 32, Args: [Variant("Playing")] })
[2024-11-02T02:02:33Z DEBUG swaddle] ARG IS Variant(Str("Playing"))
[2024-11-02T02:02:33Z DEBUG swaddle] showing unwrapped: Playing
[2024-11-02T02:02:33Z DEBUG swaddle] should_block: true -- process_running: true
[2024-11-02T02:02:33Z DEBUG swaddle] hey we made it into the timing check
[2024-11-02T02:03:03Z DEBUG swaddle] Listing players! ["org.mpris.MediaPlayer2.brave.instance5918"]
[2024-11-02T02:03:03Z DEBUG swaddle] response is Ok(Message { Type: MethodReturn, Sender: ":1.49", Destination: ":1.32", Serial: 50, ReplySerial: 34, Args: [Variant("Playing")] })
[2024-11-02T02:03:03Z DEBUG swaddle] ARG IS Variant(Str("Playing"))
[2024-11-02T02:03:03Z DEBUG swaddle] showing unwrapped: Playing
[2024-11-02T02:03:03Z DEBUG swaddle] should_block: true -- process_running: true
[2024-11-02T02:03:03Z DEBUG swaddle] hey we made it into the timing check
[2024-11-02T02:03:33Z DEBUG swaddle] Listing players! ["org.mpris.MediaPlayer2.brave.instance5918"]
[2024-11-02T02:03:33Z DEBUG swaddle] response is Ok(Message { Type: MethodReturn, Sender: ":1.49", Destination: ":1.32", Serial: 72, ReplySerial: 36, Args: [Variant("Playing")] })
[2024-11-02T02:03:33Z DEBUG swaddle] ARG IS Variant(Str("Playing"))
[2024-11-02T02:03:33Z DEBUG swaddle] showing unwrapped: Playing
[2024-11-02T02:03:33Z DEBUG swaddle] should_block: true -- process_running: true
[2024-11-02T02:03:33Z DEBUG swaddle] hey we made it into the timing check
[2024-11-02T02:04:03Z DEBUG swaddle] Listing players! ["org.mpris.MediaPlayer2.brave.instance5918"]
[2024-11-02T02:04:03Z DEBUG swaddle] response is Ok(Message { Type: MethodReturn, Sender: ":1.49", Destination: ":1.32", Serial: 73, ReplySerial: 38, Args: [Variant("Playing")] })
[2024-11-02T02:04:03Z DEBUG swaddle] ARG IS Variant(Str("Playing"))
[2024-11-02T02:04:03Z DEBUG swaddle] showing unwrapped: Playing
[2024-11-02T02:04:03Z DEBUG swaddle] should_block: true -- process_running: true
[2024-11-02T02:04:03Z DEBUG swaddle] hey we made it into the timing check
[2024-11-02T02:07:56Z DEBUG swaddle] Listing players! []
[2024-11-02T02:07:56Z DEBUG swaddle] should_block: false -- process_running: false
[2024-11-02T02:07:56Z DEBUG swaddle] hey we made it into the timing check
[2024-11-02T02:08:01Z DEBUG swaddle] Listing players! ["org.mpris.MediaPlayer2.firefox.instance_1_57"]
[2024-11-02T02:08:01Z DEBUG swaddle] response is Ok(Message { Type: MethodReturn, Sender: ":1.57", Destination: ":1.59", Serial: 81, ReplySerial: 8, Args: [Variant("Playing")] })
[2024-11-02T02:08:01Z DEBUG swaddle] ARG IS Variant(Str("Playing"))
[2024-11-02T02:08:01Z DEBUG swaddle] showing unwrapped: Playing
[2024-11-02T02:08:01Z DEBUG swaddle] should_block: true -- process_running: false
[2024-11-02T02:08:01Z DEBUG swaddle] hey we made it into the timing check
[2024-11-02T02:08:01Z DEBUG swaddle] HEY WE SHOULD BLOCK
[2024-11-02T02:08:01Z DEBUG swaddle] systemd-inhibit has been spawned
[2024-11-02T02:08:01Z DEBUG swaddle] Swayidle is inhibiting now!
[2024-11-02T02:08:31Z DEBUG swaddle] Listing players! ["org.mpris.MediaPlayer2.firefox.instance_1_57"]
[2024-11-02T02:08:31Z DEBUG swaddle] response is Ok(Message { Type: MethodReturn, Sender: ":1.57", Destination: ":1.59", Serial: 83, ReplySerial: 10, Args: [Variant("Playing")] })
[2024-11-02T02:08:31Z DEBUG swaddle] ARG IS Variant(Str("Playing"))
[2024-11-02T02:08:31Z DEBUG swaddle] showing unwrapped: Playing
[2024-11-02T02:08:31Z DEBUG swaddle] should_block: true -- process_running: true
[2024-11-02T02:08:31Z DEBUG swaddle] hey we made it into the timing check
[2024-11-02T02:09:01Z DEBUG swaddle] Listing players! ["org.mpris.MediaPlayer2.firefox.instance_1_57"]
[2024-11-02T02:09:01Z DEBUG swaddle] response is Ok(Message { Type: MethodReturn, Sender: ":1.57", Destination: ":1.59", Serial: 86, ReplySerial: 12, Args: [Variant("Playing")] })
[2024-11-02T02:09:01Z DEBUG swaddle] ARG IS Variant(Str("Playing"))
[2024-11-02T02:09:01Z DEBUG swaddle] showing unwrapped: Playing
[2024-11-02T02:09:01Z DEBUG swaddle] should_block: true -- process_running: true
[2024-11-02T02:09:01Z DEBUG swaddle] hey we made it into the timing check
[2024-11-02T02:09:31Z DEBUG swaddle] Listing players! ["org.mpris.MediaPlayer2.firefox.instance_1_57"]
[2024-11-02T02:09:31Z DEBUG swaddle] response is Ok(Message { Type: MethodReturn, Sender: ":1.57", Destination: ":1.59", Serial: 95, ReplySerial: 14, Args: [Variant("Playing")] })
[2024-11-02T02:09:31Z DEBUG swaddle] ARG IS Variant(Str("Playing"))
[2024-11-02T02:09:31Z DEBUG swaddle] showing unwrapped: Playing
[2024-11-02T02:09:31Z DEBUG swaddle] should_block: true -- process_running: true
[2024-11-02T02:09:31Z DEBUG swaddle] hey we made it into the timing check
[2024-11-02T02:10:01Z DEBUG swaddle] Listing players! ["org.mpris.MediaPlayer2.firefox.instance_1_57"]
[2024-11-02T02:10:01Z DEBUG swaddle] response is Ok(Message { Type: MethodReturn, Sender: ":1.57", Destination: ":1.59", Serial: 98, ReplySerial: 16, Args: [Variant("Playing")] })
[2024-11-02T02:10:01Z DEBUG swaddle] ARG IS Variant(Str("Playing"))
[2024-11-02T02:10:01Z DEBUG swaddle] showing unwrapped: Playing
[2024-11-02T02:10:01Z DEBUG swaddle] should_block: true -- process_running: true
[2024-11-02T02:10:01Z DEBUG swaddle] hey we made it into the timing check
^C
Just quickly adding here some results from further testing.
Whatever inhibitor I choose, as soon as inhibition starts / stops swayidle (or hypridle) cannot restart properly and this even if I kill and start swayidle afterwards. This last symptom is really peculiar. Something still inhibits swayidle to run even if all inhibitors debug logs are clear from any sort of inhibition. I need to reload qtile for swayidle to run as it should.
Hi,\ I am using with qtile + swayidle + swaddle under wayland. For initial start, playing youtube via librewolf (firefox fork), it works normally. However, when I stop playing video, it keeps prohibit swayidle to suspend my screen, even I quit librewolf. It keeps sponning
systemd-inhibit --what idle --who swayidle-inhibit --why audio playing --mod block sh -c sleep 60
.