-
-
Notifications
You must be signed in to change notification settings - Fork 98
swww-daemon crashes after a few image switching with error RustixIoErrno(Os { code: 9, kind: Uncategorized, message: "Bad file descriptor" }) #463
Description
BEFORE ANYTHING, PLEASE ENSURE YOU ARE TESTING IN THE LATEST GIT VERSION.
I tested using the latest git and in debug mode
Describe the bug
The swww-daemon crashes when changing the background a few times in a row when (I suspect) a monitor is detected and prepared to render to, but when the rendering starts it is no longer detected (the monitor).
To Reproduce
Run the following script multiple times in a row in Hyprland with the command cargo run -- path/to/image monitor ~/.config/hypr/hyprland.conf (where monitor is the name of your monitor, which for me is either eDP-1 for the integrated screen or HDMI-1-A for the external screen):
The hyprland.conf file is read and written to, but nothing is changed
The script uses
swww-git, this is just the compiled file that you put in you/bin/so it doesn't overwrite theswwwyou are already using
// File: src/main.rs
use std::{env, fs, io};
use hyprland::{
dispatch::{Dispatch, DispatchType},
keyword::Keyword,
};
#[allow(unused_must_use)]
fn main() -> io::Result<()> {
let bg_path = env::args().nth(1).unwrap_or_default();
let monitor = env::args().nth(2).unwrap_or_default();
let hyprland_conf_path = env::args().nth(3).unwrap_or_default();
let hyprland_contents = fs::read_to_string(&hyprland_conf_path)?;
fs::write(&hyprland_conf_path, hyprland_contents)?;
Keyword::set("monitor", format!("{monitor},disable"));
Dispatch::call(DispatchType::Exec(&format!("swww-git img {bg_path}")));
Ok(())
}# File: Cargo.toml
[package]
name = "repr-bug"
version = "1.0.0"
edition = "2021"
[dependencies]
hyprland = "0.4.0-beta.2"In your hyprland config, monitor must be enabled like so monitor = eDP-1, 1920x1080@60, auto, 1 (for me it is eDP-1 but for you it is the same as the command used to run the repoduce script)
Screenshots
Not really applicable here, it just crashes
Desktop (please complete the following information):
- Desktop Environment: Hyprland
- Monitor setup: Laptop monitor + external monitor connected via HDMI (the laptop monitor is disabled by a script when the external one is connected)
Additional context
I have a script that changes my theme from dark to light and the other way, and it happens to write to my hyprland config files. In these files, my laptop's integrated monitor is set to enabled, but I have another script that turns it off when an external monitor is connected. When the file is written to, the laptop's monitor is enabled and almost instantly disabled by my other script.
I suspect that when this happens, swww-daemon detects it and prepares it for image rendering, but then when it is disabled it is no longer present and swww-daemon crashes with the error code RustixIoErrno(Os { code: 9, kind: Uncategorized, message: "Bad file descriptor" })
Log when run in debug mode from latest git source:
0ms [DEBUG] Created socket in "/run/user/1000/wayland-1-swww-daemon..sock"
0ms [DEBUG] Finished setting up signal handlers
0ms [DEBUG] available shm format: Xrbg
0ms [DEBUG] available shm format: Xbgr
0ms [INFO] selected pixel format: Xbgr
0ms [DEBUG] New output: 60
0ms [DEBUG] Output 60 name: HDMI-A-1
0ms [DEBUG] Output 60 description: HP Inc. HP V24e 1CR12816B3 (HDMI-A-1)
error: unexpected argument '--namespace' found
tip: to pass '--namespace' as a value, use '-- --namespace'
Usage: swww img --outputs <OUTPUTS> --filter <FILTER> <IMAGE>
For more information, try '--help'.
12448ms [DEBUG] output Some("HDMI-A-1") - drawing: image: /home/aeldit/Dev/Rust/Reproduce/bg.jpg
12448ms [INFO] BumpPool with: 1 buffers. Size: 8100Kb
12481ms [INFO] BumpPool with: 2 buffers. Size: 16200Kb
12494ms [DEBUG] Output 9: Surface Enter
15548ms [INFO] BumpPool with: 3 buffers. Size: 24300Kb
15582ms [INFO] BumpPool with: 4 buffers. Size: 32400Kb
15615ms [INFO] BumpPool with: 5 buffers. Size: 40500Kb
15648ms [INFO] BumpPool with: 6 buffers. Size: 48600Kb
15681ms [INFO] BumpPool with: 7 buffers. Size: 56700Kb
15715ms [INFO] BumpPool with: 8 buffers. Size: 64800Kb
15748ms [INFO] BumpPool with: 9 buffers. Size: 72900Kb
15781ms [INFO] BumpPool with: 10 buffers. Size: 81000Kb
15815ms [INFO] BumpPool with: 11 buffers. Size: 89100Kb
15848ms [INFO] BumpPool with: 12 buffers. Size: 97200Kb
15881ms [INFO] BumpPool with: 13 buffers. Size: 105300Kb
15915ms [INFO] BumpPool with: 14 buffers. Size: 113400Kb
15931ms [DEBUG] New output: 106
15948ms [INFO] BumpPool with: 15 buffers. Size: 121500Kb
15982ms [INFO] BumpPool with: 16 buffers. Size: 129600Kb
16015ms [INFO] BumpPool with: 17 buffers. Size: 137700Kb
16048ms [INFO] BumpPool with: 18 buffers. Size: 145800Kb
16081ms [INFO] BumpPool with: 19 buffers. Size: 153900Kb
16115ms [INFO] BumpPool with: 20 buffers. Size: 162000Kb
16148ms [INFO] BumpPool with: 21 buffers. Size: 170100Kb
16182ms [INFO] BumpPool with: 22 buffers. Size: 178200Kb
16215ms [INFO] BumpPool with: 23 buffers. Size: 186300Kb
16248ms [INFO] BumpPool with: 24 buffers. Size: 194400Kb
16281ms [INFO] BumpPool with: 25 buffers. Size: 202500Kb
16296ms [DEBUG] Destroyed output ? - ?
16697ms [ERROR] We failed to find wayland buffer with id: 11. This should be impossible.
16697ms [ERROR] We failed to find wayland buffer with id: 18. This should be impossible.
16697ms [ERROR] We failed to find wayland buffer with id: 17. This should be impossible.
16697ms [ERROR] We failed to find wayland buffer with id: 20. This should be impossible.
16697ms [ERROR] We failed to find wayland buffer with id: 22. This should be impossible.
16697ms [ERROR] We failed to find wayland buffer with id: 24. This should be impossible.
16697ms [ERROR] We failed to find wayland buffer with id: 26. This should be impossible.
16697ms [ERROR] We failed to find wayland buffer with id: 28. This should be impossible.
16697ms [ERROR] We failed to find wayland buffer with id: 30. This should be impossible.
16697ms [ERROR] We failed to find wayland buffer with id: 32. This should be impossible.
16697ms [ERROR] We failed to find wayland buffer with id: 34. This should be impossible.
16697ms [ERROR] We failed to find wayland buffer with id: 36. This should be impossible.
16697ms [ERROR] We failed to find wayland buffer with id: 38. This should be impossible.
16697ms [ERROR] We failed to find wayland buffer with id: 40. This should be impossible.
16697ms [ERROR] We failed to find wayland buffer with id: 50. This should be impossible.
16697ms [ERROR] We failed to find wayland buffer with id: 52. This should be impossible.
16697ms [ERROR] We failed to find wayland buffer with id: 54. This should be impossible.
16697ms [ERROR] We failed to find wayland buffer with id: 56. This should be impossible.
16697ms [ERROR] We failed to find wayland buffer with id: 58. This should be impossible.
16697ms [ERROR] We failed to find wayland buffer with id: 60. This should be impossible.
16697ms [ERROR] We failed to find wayland buffer with id: 62. This should be impossible.
16697ms [ERROR] We failed to find wayland buffer with id: 64. This should be impossible.
16697ms [ERROR] We failed to find wayland buffer with id: 66. This should be impossible.
16697ms [ERROR] We failed to find wayland buffer with id: 68. This should be impossible.
16697ms [ERROR] We failed to find wayland buffer with id: 70. This should be impossible.
21358ms [DEBUG] New output: 107
21701ms [DEBUG] Destroyed output ? - ?
25193ms [DEBUG] New output: 108
25552ms [DEBUG] Destroyed output ? - ?
29940ms [DEBUG] New output: 109
30303ms [DEBUG] Destroyed output ? - ?
32255ms [DEBUG] New output: 110
32618ms [DEBUG] Destroyed output ? - ?
34248ms [DEBUG] New output: 111
34248ms [DEBUG] Destroyed output ? - ?
34248ms [DEBUG] Destroyed output HDMI-A-1 - HP Inc. HP V24e 1CR12816B3 (HDMI-A-1)
34248ms [INFO] Removed socket at "/run/user/1000/wayland-1-swww-daemon..sock"
Error: RustixIoErrno(Os { code: 9, kind: Uncategorized, message: "Bad file descriptor" })