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

[Bug]: conky 1.21. does not start consistently #1939

Closed
zlice opened this issue May 28, 2024 · 7 comments · Fixed by #2032
Closed

[Bug]: conky 1.21. does not start consistently #1939

zlice opened this issue May 28, 2024 · 7 comments · Fixed by #2032
Labels
bug Bug report or bug fix PR

Comments

@zlice
Copy link
Contributor

zlice commented May 28, 2024

What happened?

Putting conky in my fluxbox(fork, shynebox) startup file has worked fine for years. But with 1.21 my distro update to the other day it is very finicky if it will start at all. Starting manually in a terminal will start conky with some delay and then run fine until reboot/re-login.

1.19.6 started every time, so I went back to that.

Version

1.21.1

Which OS/distro are you seeing the problem on?

Linux (other)

Conky config

conky.config = {
-- double_buffer = true,
-- ^prevents weird glitching, missing, double text
use_xft = true,
font = 'RobotoMono:size=10',
default_color = '000000',
maximum_width = 70,
minimum_width = 70,
background = true,
own_window = true,
own_window_colour = 'ff9C3B',
minimum_height = 200,
own_window_transparent = false,
-- xorg
own_window_type = 'override',
-- wayland
-- own_window_hints = 'undecorated,below',
-- own_window_type = 'normal',
alignment = 'tr',
gap_x = 0,
gap_y = 0,
draw_shades = false,
draw_outline = false,
draw_borders = false,
draw_graph_borders = false,
cpu_avg_samples = 3,
net_avg_samples = 2,
}

conky.text = [[
${hwmon k10temp temp 3}° ${hwmon amdgpu temp 2}°
mem ${memperc}%
${offset 10}${mem}
${voffset -5}${if_match ${cpu cpu0} < 100} ${endif}${if_match ${cpu cpu0} < 10}0${endif}${cpu cpu0}%${voffset 10}${offset -31}${cpugraph cpu0 20,70 d8d8d8 d8d8d8}
${voffset -5}${if_match ${cpu cpu1} < 100} ${endif}${if_match ${cpu cpu1} < 10}0${endif}${cpu cpu1}%${voffset 10}${offset -40} ${cpugraph cpu1 20,70 d8d8d8 d8d8d8}
${voffset -5}${if_match ${cpu cpu2} < 100} ${endif}${if_match ${cpu cpu2} < 10}0${endif}${cpu cpu2}%${voffset 10}${offset -40} ${cpugraph cpu2 20,70 d8d8d8 d8d8d8}
${voffset -5}${if_match ${cpu cpu3} < 100} ${endif}${if_match ${cpu cpu3} < 10}0${endif}${cpu cpu3}%${voffset 10}${offset -40} ${cpugraph cpu3 20,70 d8d8d8 d8d8d8}
${voffset -5}${if_match ${cpu cpu4} < 100} ${endif}${if_match ${cpu cpu4} < 10}0${endif}${cpu cpu4}%${voffset 10}${offset -40} ${cpugraph cpu4 20,70 d8d8d8 d8d8d8}
${voffset -5}${if_match ${cpu cpu5} < 100} ${endif}${if_match ${cpu cpu5} < 10}0${endif}${cpu cpu5}%${voffset 10}${offset -40} ${cpugraph cpu5 20,70 d8d8d8 d8d8d8}
${voffset 0}${offset 0}eth
${voffset -5}${downspeedgraph myt 20,70 d8d8d8 d8d8d8}
${voffset -10}${offset 0}${offset 0}${voffset 15}${downspeedf myt}k







]]

config notes: amdgpu is not currently in use. Not sure if that would affect things


### Stack trace

_No response_

### Relevant log output

_No response_
@zlice zlice added bug Bug report or bug fix PR triage Issue that hasn't been verified labels May 28, 2024
@Caellian
Copy link
Collaborator

Can you run conky with conky -DD and provide some logs?
ps -e shows it's not running?

@Caellian Caellian added need details Issue that's waiting for more details from reporter and removed triage Issue that hasn't been verified labels Jul 15, 2024
@zlice
Copy link
Contributor Author

zlice commented Jul 18, 2024

with debug it looks like it's failing on XrmSetDatabase(display, db);

the comment mentions copying from dunst, which has an updated comment about XrmSetDatabase docs being inaccurate ? https://github.com/dunst-project/dunst/blob/master/src/x11/x.c#L499

tried double checking prop.value and a couple things but it's still failing randomly when starting with wm.

sometimes XGetTextProperty fails and skips all the xrdb destroy/set logic. other times things work and the XrmSetDatabase runs fine? seen elsewhere about XGetTextProperty defaulting to ~/.Xdefaults if there's no xrdb, but not sure if that's related in any way

@zlice
Copy link
Contributor Author

zlice commented Jul 18, 2024

l - o - l

i think this works? not entirely sure if it's right, just going with the dunst logic

https://stackoverflow.com/questions/37908716/x11-xlibint-h-naming-conflict-issues-are-they-supposed-to-be-named-min-max

--- a/src/x11.cc
+++ b/src/x11.cc
@@ -33,6 +33,9 @@
 #include "x11.h"
 
 #include <X11/X.h>
+#include <X11/Xlibint.h>
+#undef min
+#undef max
 #include <sys/types.h>
 
 #include "common.h"
@@ -314,6 +317,8 @@
       XrmDestroyDatabase(db);
     }
 
+    // https://github.com/dunst-project/dunst/blob/master/src/x11/x.c#L499
+    display->db = NULL; // should be new or deleted
     db = XrmGetStringDatabase((const char *)prop.value);
     XrmSetDatabase(display, db);
   }

@zlice
Copy link
Contributor Author

zlice commented Aug 7, 2024

this has been solid for me for a bit now. should i make a PR or is the patch with the hacky 'undef's enough?

@MisterCcobD
Copy link

Still does not start for me

:~$ conky -DD
DEBUG(0) [./src/conky.cc:2603]: reading contents from config file '/etc/conky/conky.conf'
conky: Unknown setting 'default_outline_color'
conky: Unknown setting 'gap_x'
conky: Unknown setting 'border_width'
conky: Unknown setting 'show_graph_scale'
conky: Unknown setting 'use_xft'
conky: Unknown setting 'own_window'
conky: Unknown setting 'draw_outline'
conky: Unknown setting 'draw_shades'
conky: Unknown setting 'out_to_x'
conky: Unknown setting 'minimum_width'
conky: Unknown setting 'draw_borders'
conky: Unknown setting 'alignment'
conky: Unknown setting 'default_shade_color'
conky: Unknown setting 'minimum_height'
conky: Unknown setting 'default_color'
conky: Unknown setting 'stippled_borders'
conky: Unknown setting 'show_graph_range'
conky: Unknown setting 'own_window_type'
conky: Unknown setting 'gap_y'
conky: Unknown setting 'double_buffer'
conky: Unknown setting 'draw_graph_borders'
conky: Unknown setting 'own_window_class'
conky: Unknown setting 'font'
DEBUG(1) [./src/core.cc:2059]: no templates to replace
DEBUG(1) [./src/core.cc:2059]: no templates to replace
conky: unknown variable '$hr'
DEBUG(1) [./src/core.cc:689]: Adding $cpu for CPU 0
DEBUG(1) [./src/core.cc:703]: Adding $cpubar for CPU 0
conky: unknown variable '$hr'
conky: unknown variable '$hr'


@Caellian Caellian removed the need details Issue that's waiting for more details from reporter label Sep 11, 2024
@Caellian
Copy link
Collaborator

Caellian commented Sep 11, 2024

@zlice undefs are perfectly fine if definitions leaked from X11 headers cause issues with conky code (like it would be the case for min and max). But it looks like it's enough to only add:

display->db = nullptr;

I'm guessing min and max are defined in <X11/Xlibint.h> which you don't seem to use in changed code.

In any case, a PR would be very welcomed. Thank you for the effort debugging this.

@zlice
Copy link
Contributor Author

zlice commented Sep 11, 2024

When I don't have the header I get an incomplete type error. Maybe that's a void-linux/compiler thing?

I'll make a PR in the morning. Thanks

/usr/bin/g++ -D_LARGEFILE64_SOURCE -D_POSIX_C_SOURCE=200809L -I/builddir/conky-1.21.4/3rdparty/toluapp/include -I/builddir/conky-1.21.4/build -I/usr/include/freetype2 -I/usr/include/lua5.3 -I/usr/include/libxml2 -I/builddir/conky-1.21.4/3rdparty/Vc -I/builddir/conky-1.21.4/build/src -I/builddir/conky-1.21.4/build/data -DNDEBUG -fstack-clash-protection -D_FORTIFY_SOURCE=2 -mtune=generic -O2    -ffile-prefix-map=/builddir/conky-1.21.4/build=. -std=c++17 -Werror -MD -MT src/CMakeFiles/conky_core.dir/x11.cc.o -MF src/CMakeFiles/conky_core.dir/x11.cc.o.d -o src/CMakeFiles/conky_core.dir/x11.cc.o -c /builddir/conky-1.21.4/src/x11.cc
/builddir/conky-1.21.4/src/x11.cc: In function 'void update_x11_resource_db(bool)':
/builddir/conky-1.21.4/src/x11.cc:317:12: error: invalid use of incomplete type 'Display'
  317 |     display->db = NULL; // should be new or deleted
      |            ^~
In file included from /builddir/conky-1.21.4/src/x11.h:37,
                 from /builddir/conky-1.21.4/src/x11.cc:33:
/usr/include/X11/Xlib.h:251:8: note: forward declaration of 'Display'
  251 | struct _XDisplay;               /* Forward declare before use for C++ */
      |        ^~~~~~~~~

zlice added a commit to zlice/conky that referenced this issue Sep 11, 2024
https://github.com/dunst-project/dunst/blob/master/src/x11/x.c#L499
looks to be the source of some code which now sets display to NULL
for some type of race condition in X11. Xlibint.h allows for building
on Void Linux but needs min/max undefined. closes brndnmtthws#1939
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug report or bug fix PR
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants