Open wongweilok opened 3 years ago
Currently, android-studio is the only program I have issue with. I will try testing other different programs later.
I have tested and reproduced the same issue with using R in the terminal. Inside R, I created a plot as figure below.
Executing quit command on the plot itself work as expected. However, executing quit command on the terminal (which was the parent client of the plot) cause the "module/dwm" to stopped working.
The same thing happened when opening an image using sxiv (Simple X Image Viewer) through a terminal, quit command on the terminal instead of the sxiv program will cause the issue as well.
This is another approach to reproduce the issue. I found this one by accident when I was trying to find specific settings in the android studio. Based on this, I suspect that IPC can't handle too much event changes of window client opening and closing in extremely short amount of time.
I have also experienced this issue or similar issue but it occurs when I open the 'Nextcloud Desktop Client' used to connect with a remote Nextcloud server. Only thing in the polybar logs is "polybar|error: module/dwm: [dwmipcpp] Client with window id 12582936 not found". I would be happy to help diagnose or supply logs if there is anything I can do to help please feel free to ask.
Interesting observation: If you log out and quit the xsession and then restart with xinit the bar will restart but the desktop section on the left displaying tags does not reappear.
If you use "polybar-msg cmd restart" the desktop section shows back up even with out logging out and back in.
Or I can kill the Nextcloud application and restart polybar.
While doing some more digging into this situation I have learned that applications that cause this issue only seem to do so if I launch them from dmenu but if I launch these applications from the terminal just simply running the command the error does not seem to occur.
Update: With the recent release of Android Studio version 4.2, the dropdown menu no longer spawn as seperate window. Thus, the issue won't occur anymore when using Android Studio (4.2 and above). However, this issue can still be reproduce with other approaches stated in above comments. Especially the one that @croyleje stated.
I am getting the same issue when opening OBS into the systray
==> dwm.log <==
[fd 6] Error: Client with window id 16777222 not found
Error handling IPC event on fd 6
==> polybar.logs <==
polybar|error: module/dwm: [dwmipcpp] Client with window id 16777222 not found
polybar|notice: Stopping 'module/dwm'...
To fix, i am just restarting polybar
Sorry, I haven't had time to work on this, but if anyone wants to try a fix, I think this should be fixable by checking first if a window with the specified ID exists before fetching its title. The only problem I see with this solution is if the window is closed within the short period of time between checking if the window exists and fetching its title, the module will crash with this exact error. Another solution is to implement a WindowNotFound exception or similar in dwmipcpp and catching this exception in the polybar-dwm-module and just printing a warning rather than throwing an error. The latter solution may be the most robust.
On second thought, the above solutions may be more of a workaround than a direct solution. This could be masking a bug deeper in the code. It may be good to further investigate the root cause of the window Id's being received not belonging to an existing window.
@mihirlad55 r u able to provide some links to suspect spots of the code? I would be happy to do some looking but am unfamiliar with either the module or the patch code to know where to start looking.
https://github.com/mihirlad55/polybar-dwm-module/blob/master/src/modules/dwm.cpp#L523-L527 and https://github.com/mihirlad55/dwm-ipc/blob/master/ipc.c#L1065-L1073 may also be useful if you want to dig deeper to find the root of the problem
The problem can also be reproduced by closing all the clients in a tag quickly. I tried looking at the source to spot the actual deeper bug but unfortunately, i don't have enough experience with either c/c++ or this project... The only thing i got out of it is that by the time that dwm replies to the module the window is already destroyed... As a workaround, i intercepted the ResultFailureError and just logged it instead of throwing an error. (For anyone that wants a quick "fix") https://github.com/DominickVale/polybar-dwm-module/commit/b20fd0c90295410001ab6397f3761951396980c1
There's an easy workaround for this: In your polybar config delete "label-title" (under [module/dwm]), so the module doesn't read the window title at all, then use [module/title] as a replacement.
I was having the exact same issue with using the countdown timer with flameshot. Can confirm adding the [module/title] to the polybar config fixes the issue for me as well.
Describe the issue
"module/dwm" couldn't process and stopped due to some window id missing. This behaviour happens for android-studio dropdown menus as the menus spawn as "seperate window". These "seperate window" cannot be close with normal quit execution, it can only be close/remove by moving cursor away and thus causing this issue.
Expected behavior: module/dwm should be able to process the event changes and work as usual.
Actual behavior: module/dwm stopped working due to missing window id.
Was it working before?
To Reproduce
Issue might not related to config, but just in case: https://github.com/wongweilok/dotfiles/blob/master/.config/polybar/config_dwm
Step to reproduce:
Polybar Log
Polybar outputs when the issue occur
*Note: The window id is vary.
Environment:
polybar -vvv
: