Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"module/dwm" stopped with reason: [dwmipcpp] Client with window id XXXXX not found #26

Open
wongweilok opened this issue Mar 24, 2021 · 15 comments

Comments

@wongweilok
Copy link

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?

  • Did you also experience this bug in an earlier version of polybar (yes)?
  • If no, what was the last version where this worked correctly?

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:

  1. Open android-studio.
  2. Go to the menu and click on File --> New (Or any tab menu that have >= 2 level option), then move cursor away as figure below:
    screenshot-full-210324-113850
  3. Click on the editor or anywhere except the dropdown menus.
  4. Result:
    image

Polybar Log

Polybar outputs when the issue occur

notice: Parsing config file: /home/weilok/.config/polybar/config
notice: pulseaudio: using default sink alsa_output.pci-0000_00_09.2.analog-stereo
error: Disabling module "battery" (reason: No suitable way to get current capacity value)
notice: Loaded font "mono:pixelsize=9" (name=Inconsolata for Powerline, offset=1, file=/usr/share/fonts/Inconsolata for Powerline.otf)
notice: Loaded font "Inconsolata for Powerline:size=16" (name=Inconsolata for Powerline, offset=3, file=/usr/share/fonts/Inconsolata for Powerline.otf)
notice: Loaded font "Noto Color Emoji:scale=10:style=Regular" (name=Noto Color Emoji, offset=2, file=/usr/share/fonts/noto/NotoColorEmoji.ttf)
notice: Loaded font "Font Awesome 5 Free:style=Regular:pixelsize=8" (name=Font Awesome 5 Free, offset=1, file=/usr/share/fonts/TTF/fa-regular-400.ttf)
notice: Loaded font "Font Awesome 5 Free:style=Solid:pixelsize=8" (name=Font Awesome 5 Free, offset=1, file=/usr/share/fonts/TTF/fa-solid-900.ttf)
notice: Loaded font "Font Awesome 5 Brands:pixelsize=8" (name=Font Awesome 5 Brands, offset=1, file=/usr/share/fonts/TTF/fa-brands-400.ttf)
notice: Loaded font "Noto Sans CJK JP:size=8" (name=Noto Sans CJK JP, offset=1, file=/usr/share/fonts/noto-cjk/NotoSansCJK-Regular.ttc)
notice: Loaded font "Noto Sans CJK KR:size=8" (name=Noto Sans CJK KR, offset=1, file=/usr/share/fonts/noto-cjk/NotoSansCJK-Regular.ttc)
notice: Loaded font "Noto Sans CJK SC:size=8" (name=Noto Sans CJK SC, offset=1, file=/usr/share/fonts/noto-cjk/NotoSansCJK-Regular.ttc)
notice: Loaded font "Noto Sans CJK TC:size=8" (name=Noto Sans CJK TC, offset=1, file=/usr/share/fonts/noto-cjk/NotoSansCJK-Regular.ttc)
error: module/dwm: [dwmipcpp] Client with window id 18875311 not found
notice: Stopping 'module/dwm'...

*Note: The window id is vary.

Environment:

  • WM: dwm
  • Distro: Arch Linux
  • Output of polybar -vvv:
polybar 3.5.2-95-gbb94e184

Features: +alsa +curl +dwm +i3 +mpd +network(libnl) +pulseaudio +xkeyboard

X extensions: +randr (+monitors) +composite +xkb +xrm +xcursor

Build type: Release
Compiler: /usr/bin/c++
Compiler flags: -D_FORTIFY_SOURCE=2 -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -Wall -Wextra -Wpedantic -O3 -DNDEBUG
Linker flags: -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now
@wongweilok
Copy link
Author

Currently, android-studio is the only program I have issue with. I will try testing other different programs later.

@wongweilok
Copy link
Author

I have tested and reproduced the same issue with using R in the terminal. Inside R, I created a plot as figure below.

screenshot-full-210324-133220

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.

@wongweilok
Copy link
Author

2021-03-24_13-59-21.mp4

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.

@croyleje
Copy link

croyleje commented Apr 11, 2021

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.

@croyleje
Copy link

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.

@wongweilok
Copy link
Author

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.

@gwagner
Copy link

gwagner commented Jul 12, 2021

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

@mihirlad55
Copy link
Owner

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.

@mihirlad55
Copy link
Owner

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.

@gwagner
Copy link

gwagner commented Jul 22, 2021

@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.

@mihirlad55
Copy link
Owner

@DominickVale
Copy link

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")
DominickVale@b20fd0c

@aleister888
Copy link

aleister888 commented Dec 19, 2021

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.

@xorsirenz
Copy link

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.

@aakodadi aakodadi mentioned this issue Jun 4, 2022
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants