r-c-f/waynergy

Waynergy leaks fds for /dev/shm/wlroots-*

Closed this issue · 3 comments

Since I updated to 0.0.12 Waynergy has been crashing once every 18-24 hours like clockwork. I started monitoring the behavior today and have found its open fds grow unbounded, with most of the fds being handles for files in /dev/shm following a naming scheme of wlroots-*. I believe these are wayland input mapping files?

Over time through normal usage of Waynergy these handles eventually hit the open file handle limit and crash the program.

I'm hoping to get more info from a debug trace, but just starting Waynergy it looks like something is wrong. From a fresh launch:

❯ lsof -p 553141  | grep wlroots
waynergy 553141 trysdyn    6r   REG               0,24    63970 14074119 /dev/shm/wlroots-odIbAb (deleted)
waynergy 553141 trysdyn    8r   REG               0,24    63970 17551674 /dev/shm/wlroots-OgIAMD (deleted)
waynergy 553141 trysdyn    9r   REG               0,24    63970 17551675 /dev/shm/wlroots-HeFHdD (deleted)
waynergy 553141 trysdyn   10r   REG               0,24    63970 17551675 /dev/shm/wlroots-HeFHdD (deleted)
waynergy 553141 trysdyn   11r   REG               0,24    63970 17551675 /dev/shm/wlroots-HeFHdD (deleted)
waynergy 553141 trysdyn   12r   REG               0,24    63970 17551675 /dev/shm/wlroots-HeFHdD (deleted)
waynergy 553141 trysdyn   13r   REG               0,24    63970 17551675 /dev/shm/wlroots-HeFHdD (deleted)
waynergy 553141 trysdyn   14r   REG               0,24    63970 17551675 /dev/shm/wlroots-HeFHdD (deleted)

I've found the problem is exacerbated by hardware changes. If I use my hard KVM to swap targets (sparking a hardware change as far wlroots is concerned) or if a display sleeps/wakes, about 40 of these handles open and the debug log fills with about as many instances of...

570.555683375: [DEBUG] Property wl_keyboard_map not found in INI
570.555715339: [DEBUG] Could not read current keymap from fd

Setting wl_keyboard_map to false to attempt to prevent the attempt to read keymap does fix the issue.

My C is just a bit too rusty to suss this out myself, alas. Apologies.

This is on Sway 1.7, Waynergy 0.0.12, Windows server is Barrier 1.6.

r-c-f commented

With hardware I can reproduce, and #48 resolves it for me; does it work for you?

I'd originally said #48 didn't fix the problem. I was mistaken. #48 does fix the problem. I'm terribly sorry if you saw my first message and were confused; I had a small incident in my $PATH :(

This looks to be working fine now, thank you very much for the quick look.

r-c-f commented

No problem; there are a few other potential leaks addressed as well, so thank you for reporting this.