Open Caellian opened 2 weeks ago
@belrus65 Can you send me your latest lua script as a comment attachment (might need to add .txt
extension)?
I was debugging mouse events a lot in Openbox past few weeks and they seemed fine, so it might be a weird interaction with cairo.
I also have a few questions:
xwininfo -root -tree
while running conky?lua-scripts.zip xwininfo-results-conky-1.19.8.txt xwininfo-results-conky-1.20.2.txt
Here are the files. I have a pure openbox gentoo system with 3 monitors running several conky panels on each monitor (I've included a screenshot of my desktop to make it easier to explain). The problem starts as soon as I load up to 4 lua scripts (clock & memory bar on center monitor, and cpu usage dials on the other monitors). If I move the mouse or interact with the desktop (bring up menu with key bindings) the conky processes seem to stall for some time (the more I move the mouse to longer the stall exists). None of these problems existed in the previous (1.19.8)
@belrus65
Can I see your conkyrc files as well please? (For invesitgation, and I like your layout :) )
You are running multiple instances of conky, right? Like through seperate conkyrc files?
Do you need all my conkyrc, or only the ones running the lua scripts? Yes, there are exactly 28 different panels all executed from a bash script.
All of them :) and the script executing them
@belrus65 Right, as a workaround, you can try building conky with BUILD_XINPUT
and/or BUILD_MOUSE_EVENTS
disabled. One of those is likely causing issues.
ok @lineage-of-roots, i'll package it altogether as soon as I get back home.
@belrus65 Thanks in advance
Related to #1852.
Here is my entire conky @lineage-of-roots.
@Caellian, I'm in the middle of a deployment for a client, I will try to build conky with BUILD_XINPUT and/or BUILD_MOUSE_EVENTS disabled over the weekend.
@Caellian, I'm in the middle of a deployment for a client, I will try to build conky with BUILD_XINPUT and/or BUILD_MOUSE_EVENTS disabled over the weekend.
That's fine, try it out when you have time. Thanks for sharing the files, it will be helpful for debugging.
@belrus65
Thanks for the files. Much appreciated.
I ran them, they don't stall for me though.
I would, however, also say just to build conky without Xinput.
Thanks @lineage-of-roots, I will disable all unneeded flags this weekend and rebuild.
Strange though, did that much of the code change from previous version? Never had any issues with lag before, and nothing changed on my system in ways of xorg or openbox (newer kernel, but it's the gentoo binary). In any case, it still will be good to streamline the conky package to my minimal requirements. Thanks again for the feedback.
@belrus65 You're welcome
Yes, the code has changed.
And it can tend to behave differently across different Kernels/Distros.
Previously when I was testing Conky, on my Arch desktop, I could get a delay in the Fluxbox menu appearing after I right clicked on the desktop. The Fluxbox menu did not delay on my Laptop, which is running Debian (MX-Linux Wildflower) Even though the cpu usage would jump high on both.
So the only conclusion was that different builds/configs are dealing with Xinput differently.
(This is ofcourse if Conky is built with Xinput support enabled)
Just want to point out a few things though:
main
/1.20.3?).
own_window_type = "override"
) which aren't allowed to track cursor movement.BUILD_MOUSE_EVENTS
as well (instead; both are required for mouse tracking).It would be nice if you could run conky (built with -DCMAKE_BUILD_TYPE=RelWithDebInfo
) with valgrind when you have time (valgrind --tool=callgrind --dump-instr=yes --simulate-cache=yes --collect-jumps=yes conky
) and send the callgrind.out
file as that would tell us what part of code is causing this slowdown.
Assuming it's up to kernel setup I'm marking this as wontfix, but send the callgrind file and I'll see whether I can improve performance on your system (or possibly for others) somehow so you don't have to rebuild your kernel or disable default functionality in order to use newer versions :face_with_spiral_eyes: .
@lineage-of-roots, I created a custom local ebuild repository for conky, and set -DBUILD_XINPUT=no & -DBUILD_MOUSE_EVENTS=no in the ebuild file, and re-emerged the 1.20.2 package on my system. All is working fine now, no more lag.
conky --version conky 1.20.2 compiled for Linux x86_64
Compiled in features:
System config file: /etc/conky/conky.conf Package library path: /usr/lib64/conky
General:
Internationalization support
Lua bindings:
RSVG
X11:
Own window
Default values:
@Caellian, I am not sure how to modify the ebuild file to include your suggestion:
"It would be nice if you could run conky (built with -DCMAKE_BUILD_TYPE=RelWithDebInfo) with valgrind when you have time (valgrind --tool=callgrind --dump-instr=yes --simulate-cache=yes --collect-jumps=yes conky) and send the callgrind.out file as that would tell us what part of code is causing this slowdown."
@Caellian, I am not sure how to modify the ebuild file to include your suggestion.
Build without ebuild/portage, it's 2/3 commands but here's a step-by-step guide in the terminal:
git
, cmake
and valgrind
installed (I think you might just need to install valgrind)git clone https://github.com/brndnmtthws/conky.git conky-debugging
cd conky-debugging
cmake -S . -B build -DCMAKE_BUILD_TYPE=RelWithDebInfo --fresh
cmake --build build
valgrind --tool=callgrind --dump-instr=yes --simulate-cache=yes --collect-jumps=yes build/src/conky -c \
mv callgrind.out.* ~/callgrind.out.txt
cd .. && rm -r conky-debugging
callgrind.out.txt
file from home directory.valgrind
if you want to.@belrus65
Glad it worked out.
I shall cherish your conky configs.
Thanks again :)
@belrus65
I just noticed you left your api key for the weather in your files.
Just wanted to inform you of that.
I won't be using it. But your files are visible here.
@lineage-of-roots, thanks for the heads up! Was in the process of working on a deployment for a client & hurried to upload files for you and didn't pay much attention. I deleted the package for now...will replace them later tonight after I had time to review them.
@belrus65 No need to review and replace them. Given that lineage-of-roots wasn't able to recreate the bug with your scripts, they're not that useful for debugging the issue.
@Caellian, here is the valgrind result
Sorry to bother, you did everything right, but you stopped conky a bit too soon. It didn't get to the main event loop yet. Leave it on a minute or two longer. Thank you for doing this btw.
@Caellian I reran valgrind but this time a selected a conkyrc that calls a lua script and I keep getting (llua_do_call: function execution failed: attempt to call nil value) line after line printed in the terminal. I cannot Ctrl-C, stuck in endless loop, need to reboot to stop process.
You can run pkill -KILL conky
, no need to reboot. If your system is frozen, you can Ctrl+Alt+F4 into another tty, login, and then kill conky from there.
@belrus65 No problem.
There's still a little issue with the libcairo.so
and libcairo_xlib.so
with the built executable of conky.
Even if CMAKE_SKIP_INSTALL_RPATH
is checked to true, the cairo stuff still wouldn't work with the built executable.
Current solution I have been doing is to manually copy libcairo.so and libcairo_xlib.so
files from the build/lua
directory,
into /usr/local/lib/conky
directory. That's when the cairo stuff starts working with built from source executable which is not installed
(Don't want to go through all the cmake stuff currently)
Your usual conky setup is, for the sake of humor, doing a DDOS attack on your Xserver lol Because of all the XInput stuff
Propagation is still happening without the flags, in the same way. Conky doesn't propagate events that it doesn't catch. His desktop doesn't freeze, conky does, so I think this isn't a good analogy.
how they deal with the very high number of XInput requests
There's no XInput requests. We tell XInput we want to listen for cursor movement, XInput constructs event once and sends a copy to each client (and conky) that's listening for it when they poll events. Conky doesn't propagate events that aren't over its window, so this shouldn't affect performance when cursor isn't over conky.
_XReply
is definitely going to wait in the affected code because there's no other code that's interacting with X11 after window is constructed (besides resizing if content size changes).
Here is the valgrind output. I had to manually copy the libcairo.so & libcairo_xlib.so to /usr/local/lib/conky folder (which I needed to create manually also). Hope this helps you, as for myself, the lag is gone since I disabled XINPUT & MOUSE_EVENTS in my custom build script.
Propagation is still happening without the flags, in the same way. Conky doesn't propagate events that it doesn't catch. His >desktop doesn't freeze, conky does, so I think this isn't a good analogy.
I did mean that in the humorous sense. And not related to any event propagation. I knew his conky was freezing and not his desktop.
You can see Xorg jump up in cpu usage when you move the mouse around anywhere, on any window. With many conky instances running, Xorg gets working overtime. His script launches over 50 separate conky instances, If I counted correctly.
To simulate the effect, I launched many xeyes. A similar jump in Xorg's cpu usage can be observed then.
how they deal with the very high number of XInput requests
I shouldn't have said "requests". That sounds like an actual request
I meant all the Xinput related code running.
My hypothesis was/is that something is going wrong with conky (Similar to fluxbox menu delay) because of all the separate but simultaneous Xquerypointers running. It's possible that Xquerypointer is not the problem, and it just results in high cpu usage as usual.
From my previous testing on Debian, I knew the problem doesn't necessarily manifest across different Distros, Kernels etc etc.
It still didn't reach main.
But the issue is likely specific to your system, or maybe it's some combination of circumstances I can't seem to recreate because I'm not experiencing any issues even with 100 running instances. The code in question does take about 50% of main_loop
for a simple configuration (handle_event<1>
), and quarter of that is waiting for replies from Xorg:
The only function that asks for optimization is query_x11_top_parent
, which is likely the cause of slowdown on your system (namely, use of XQueryTree
), but I don't see a way around it that would work everywhere - query_x11_top_parent
was required to make event window matching work on Openbox.
Anyway, here's a breakdown of relative costs of different parts of mouse event handling if someone will need it in the future:
I might look at this a bit more at some point, but I don't see any obvious ways to improve it.
What happened?
conky: 'openbox' x11 session running 'openbox' destop