brndnmtthws / conky

Light-weight system monitor for X, Wayland (sort of), and other things, too
https://conky.cc
GNU General Public License v3.0
7.27k stars 620 forks source link

cpu var with LUA = slow update interval on Ubuntu 20.10? #1031

Closed therealcodlord closed 1 year ago

therealcodlord commented 3 years ago

Issue

I don't really know if this is an issue with Conky or with Ubuntu but I am trying to debug/solve. I have 3 Ubuntu installations with Conky and previously they would update every second as expected. Since updating to Ubuntu 20.10 they all now exhibit the same behaviour - Conky updating only every 5 or 6 seconds.

I could not find any open or closed issues relating to slowdown or the "cpu" variable causing issues so I tried to do a bit of debugging. No errors in the conky log.

I simplified my conky config to show JUST the time with seconds and that works fine (Conky updates every second). So I slowly started adding things to the config until I found that if I have any cpu variable line in my config I get the slow Conky update every 5 or 6 seconds. So for example: ${hwmon 1 temp 1} and/or ${top cpu 1} works fine but add this: ${cpu cpu3} And I get the slow updates.

BUT if I remove the lua_load line in my config then all values (including the CPU values) show correctly and at the correct update_interval, so it seems to be some combination of LUA and the cpu variable.

SUMMARY: No lua_load (just text values including cpu variables) = works ok. lua_load but no cpu variables = works ok. lua_load with cpu variables = slow updates.

Information

OS: Ubuntu 20.10, Gnome 3.38.1 X11 5.8.0-25-generic #26-Ubuntu SMP Thu Oct 15 10:30:38 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

Conky: I am just using the supplied package version which is currently 1.11.6

$ conky -V
conky 1.11.6 compiled 2020-08-17 for Linux x86_64

Compiled in features:

System config file: /etc/conky/conky.conf
Package library path: /usr/lib/conky

 General:
  * math
  * hddtemp
  * portmon
  * IPv6
  * IRC
  * Curl
  * RSS
  * ICal
  * iconv
  * Weather (METAR)
  * wireless
  * support for IBM/Lenovo notebooks
  * nvidia
  * builtin default configuration
  * old configuration syntax
  * Imlib2
  * OSS mixer support
  * apcupsd
  * iostats
  * ncurses
  * Internationalization support
  * PulseAudio

 Lua bindings:
  * Cairo
  * Imlib2
  * RSVG
 X11:
  * Xdamage extension
  * Xinerama extension (virtual display)
  * Xshape extension (click through)
  * XDBE (double buffer extension)
  * Xft
  * ARGB visual
  * Own window

 Music detection:
  * Audacious
  * CMUS
  * MPD
  * MOC
  * XMMS2

 Default values:
  * Netdevice: eno1
  * Local configfile: $HOME/.conkyrc
  * Localedir: /usr/share/locale
  * Maximum netdevices: 256
  * Maximum text size: 16384
  * Size text buffer: 256

EXAMPLE CONFIG: Note: If I comment out any of the $cpu variable lines it updates every second as expected. With one or more $cpu variable lines I get the slow update every 5 or 6 seconds.

conky.config = {
    alignment               = 'top_right',
    background              = false,
    border_inner_margin         = 0,
    border_outer_margin         = 0,
    border_width            = 0,
    color0              = '772953', 
    color1              = 'EBE1E1',
    cpu_avg_samples             = 2,
    default_color           = 'gray',
    default_outline_color       = 'green',
    default_shade_color         = 'red',
    diskio_avg_samples          = 2,
    double_buffer           = true,
    draw_borders            = false,
    draw_graph_borders          = false,
    draw_outline            = false,
    draw_shades             = false,
    extra_newline           = false,
    font                = 'Play:normal:size=7',
    format_human_readable       = true,
    gap_x               = 30,
    gap_y               = 150,
    lua_load                = '/home/me/Documents/Files/scripts/conky/rings.lua',
    lua_draw_hook_pre           = 'conky_main',
    maximum_width           = 520,
    minimum_width           = 520,
    net_avg_samples             = 2,
    no_buffers              = true,
    out_to_console          = false,
    out_to_stderr           = false,
    extra_newline           = false,
    own_window              = true,
    own_window_argb_visual      = true,
    own_window_class            = 'Conky',
    own_window_type             = 'desktop',
    own_window_transparent      = true,
    own_window_argb_visual      = true,
    override_utf8_locale        = true,
    stippled_borders            = 0,
    temperature_unit            = 'celsius',
    text_buffer_size            = 2048,
    update_interval             = 1.0,
    uppercase               = false,
    use_spacer              = 'none',
    use_xft                 = true,
    show_graph_scale            = false,
    show_graph_range            = false,
    xftalpha                = 0.9,
};

conky.text = [[
${font Play:normal:size=7}${voffset 16}${color1}${goto 120}${freq_g cpu0} Ghz${alignr 330}${hwmon 1 temp 1} °C
#
#${font Play:normal:size=7}${voffset 0}${goto 120}${color1}CPU 1 ${alignr 330}${color1}${cpu cpu0}%
#${font Play:normal:size=7}${voffset 2}${goto 120}${color1}CPU 2${alignr 330}${color1}${cpu cpu1}%
#${font Play:normal:size=7}${voffset 2}${goto 120}${color1}CPU 3${alignr 330}${color1}${cpu cpu2}%
${font Play:normal:size=7}${voffset 2}${goto 120}${color1}CPU 4${alignr 330}${color1}${cpu cpu3}%
${goto 50}${voffset 16}${font Play:normal:size=7}${color1}${top name 1}${alignr 306}${top cpu 1}%
${goto 50}${font Play:normal:size=7}${color1}${top name 2}${alignr 306}${top cpu 2}%
${goto 50}${font Play:normal:size=7}${color1}${top name 3}${alignr 306}${top cpu 3}%
${font Michroma:size=10}${color0}${goto 80}${voffset 4}CPU

${time %I}:${time %M}:${time %S}

]];
analoginterface0 commented 3 years ago

same here.

I'm on Manjaro and my conky is behaving like this too. I've set update_interval to 0.01 but it seems like updating at 0.5 seconds.

RichardGladman commented 3 years ago

Confirmed with openSUSE. Update interval appears to be 2 - 4 seconds! My work-around is to turn off the seconds in the time display.

Additionally (and I'm not 100% sure it's related) if I don't have a ${cpu anycore} in the conkyec, then the cpu variables in lua always return 0.

therealcodlord commented 3 years ago

@analoginterface0 o.k. so it's not just me then! @RichardGladman I don't have seconds shown in the time display and still not found any workaround. Obviously since I logged this Ubuntu has gone through lots of patches etc which I kind of hoped might solve this issue given that it seemed to start with Ubuntu 20.10

MeniwaAobaYamaHototogisuHatsuGatsuo commented 3 years ago

I had same issue on ubuntu 20.10. Then I tried to divide my recipi to two, one has no lua_load but with cpu variables, another has lua_load without cpu variables. Then run two conky palallely, thoes work well.

gottfriedm commented 3 years ago

Could it be related to this issue of slow conky_parse() / lua_parse() functions that apparently got introduced with one of the 1.11.x updates?

Could you try if removing the conky_parse() calls from your lua scripts makes a difference?

MeniwaAobaYamaHototogisuHatsuGatsuo commented 3 years ago

gottfriedm I tried as you mentioned, then it works without any delay. Hmmm, but my recipes, conky without cpu variables and lua with conky_purse(), works well also, I can't understand what happnes.

ubuntu 20.10, conky 1.11.6-2

therealcodlord commented 3 years ago

I can confirm with my setup that it does seem what @gottfriedm said about the linked issue.

For me it seems to be conky_parse() calls which are now much slower than before. My script has several calls

So it does seem that as per the linked issue - before the update conky_parse() calls were very fast and now they are much much slower.

tflori commented 3 years ago

they are horrible slow and it is basically not usable anymore. I'm waiting for a solution since October 2020 now - not even a maintainer cared about the issue... the only solution I have is not to upgrade conky anymore. Unfortunately I can't upgrade ubuntu without upgrading conky... I'm wondering if there is no ubuntu maintainer that could revert the upgrade in the repositories.

gottfriedm commented 3 years ago

Unfortunately I can't upgrade ubuntu without upgrading conky

My "solution" is to check out the 1.10.8 version git tag and compile it myself, which thankfully is fairly easy.

But I agree, this problem should be addressed.

LinuxOnTheDesktop commented 2 years ago

My conky uses many lua scripts and several of those scripts use conky_parse. My conky contains various cpu objects too. Yet, I do not have the problem. My wider setup is (as helpfully displayed by my conky!):

image

(Ignore the '25.3s'. It is how long boot took.)

Perhaps then the problem is Ubuntu 20.10 itself, or some component (but not Conky?) therein. Or else perhaps what solves the problem is the newer version of Conky that I have - a version that, I think, I compiled myself from the code on github.

gottfriedm commented 2 years ago

My conky uses many lua scripts and several of those scripts use conky_parse. My conky contains various cpu objects too. Yet, I do not have the problem.

I can confirm that the issue seems to be gone with one of the newer conky releases.

Timing of conky_parse() with conky-1.10.8

time:   0.018849849700928
time:   0.019077062606812
time:   0.018664836883545
time:   0.018887042999268
time:   0.018595933914185

With conky-1.11.6 (as detailed here):

time:   0.30080986022949
time:   0.30092906951904
time:   0.30434203147888
time:   0.30092811584473
time:   0.30187606811523
time:   0.30196404457092
time:   0.30118894577026

With the newest version available from my package manager, conky-1.12.2:

time:   0.010081052780151
time:   0.010499954223633
time:   0.011132001876831
time:   0.010730981826782
time:   0.010843992233276
time:   0.011169910430908

It seems that the problem got fixed with the conky-1.12 release. If others can confirm as well, then we can close these issues.

analoginterface0 commented 2 years ago

I'm on Fedora Linux 35 KDE & Manjaro KDE with the latest conky-1.12 packages. I confirm this issue has been resolved in version 1.12.

RichardGladman commented 2 years ago

It's working on openSUSE with 1.12

gottfriedm commented 2 years ago

The issue seems to be solved, but i'm afraid i can't close it. I think only original reporter can.

@therealcodlord You might want to consider closing this issue.