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

Random Crashes with "double free or corruption (!prev)" and other error messages #923

Closed ohnonot closed 1 year ago

ohnonot commented 4 years ago

Issue

A conky with graphs disappears from the screen, as well as its process.

I have had this problem for a long time, and checked the issues here several times. At first it seemed to be sth like #855 or #866 - but for almost half a year Archlinux has been using the release that includes the supposed fix, yet one of my conkys (the one with cpu graphs) crashes - rarely, not every day, but it does happen evtl., reliably.

I'm not aware of conky using up too much memory before that.

Information

Archlinux with LTS kernel (currently 4.19.90-1-lts), conky --version: 1.11.5_pre compiled Thu 29 Aug 2019 (from [extra]) Intel desktop, Intel GPU HD Graphics 530

conky.config = {
--<conkyrc> 

    own_window = true,
    own_window_transparent = true,
    own_window_type = 'override',

    update_interval = 3,

    double_buffer = true,

    pad_percents = 0,
    short_units = true,

    border_width = 0,
    border_inner_margin = 0,
    border_outer_margin = 0,

    minimum_width = 235, minimum_height = 950,
    maximum_width = 235,

    alignment = 'middle_right',
    gap_x = 20,
    gap_y = -30,

    draw_outline = false,
    draw_shades = false,
    draw_borders = false,
    draw_graph_borders = false,

    default_color = '#f1f2f2',
    color1 = '#fdfdfd',-- clock, date, headers, graph text
    color2 = '#7eae55',-- graphs, fs_bars
-- colors for cpu temp - warn, max, crit
    color6 = '#FF6158',-- red
    color7 = '#28CA41',-- green
    color8 = '#FFBD30',-- yellow

    use_xft = true,
    font = 'ubuntu:size=9',

    format_human_readable = true,

    top_name_width = 15,

    default_bar_width = 0, 
    default_bar_height = 8,

};

conky.text = [[
$color1${font open sans:style=light:size=20}CPU$font$color\
${goto 80}${voffset -12}${top name 1}${alignr}${top cpu 1}%
${goto 80}${voffset -2}${top name 2}${alignr}${top cpu 2}%
${goto 80}${voffset -2}${top name 3}${alignr}${top cpu 3}%
${goto 80}${voffset -2}${top name 4}${alignr}${top cpu 4}%
${voffset 5}${goto 79}$color2${cpugraph cpu1 50 -l}\
$color2${goto 79}${cpugraph cpu2 50 -l}
$color${voffset -52}${goto 80}${execp ~/.config/conky/sys/cpu-conky-temp.sh temp2}
$color${voffset -2}${goto 80}${cpu cpu1}%$alignr${freq_g 1}GHz
${voffset -2}${goto 80}${cpu cpu2}%$alignr${freq_g 2}GHz
${goto 79}$color2${cpugraph cpu3 50 -l}\
$color2${goto 79}${cpugraph cpu4 50 -l}
$color${voffset -52}${goto 80}${execp ~/.config/conky/sys/cpu-conky-temp.sh temp3}
$color${voffset -2}${goto 80}${cpu cpu3}%${alignr}${freq_g 1}GHz
${voffset -2}${goto 80}${cpu cpu4}%${alignr}${freq_g 2}GHz
$color

$color1${font open sans:style=light:size=20}MEM$font$color\
${goto 80}${voffset -12}${top_mem name 1}${alignr}${top_mem mem 1}%
${goto 80}${voffset -2}${top_mem name 2}${alignr}${top_mem mem 2}%
${goto 80}${voffset -2}${top_mem name 3}${alignr}${top_mem mem 3}%
${goto 80}${voffset -2}${top_mem name 4}${alignr}${top_mem mem 4}%
${goto 80}${voffset 3}MEM:$alignr${mem}/${memmax} - ${memperc}%
${goto 80}${voffset -2}SWAP:${alignr}$swap/$swapmax - ${swapperc}%
$color

$color1${font open sans:style=light:size=20}I/O$font$color\
${goto 80}${voffset -12}${top_io name 1}$alignr${top_io io_perc 1}%
${goto 80}${voffset -2}${top_io name 2}$alignr${top_io io_perc 2}%
${goto 80}${voffset -2}${top_io name 3}$alignr${top_io io_perc 3}%
${goto 80}${voffset -2}${top_io name 4}$alignr${top_io io_perc 4}%
${goto 79}$color2${diskiograph_read /dev/sda 30 -l}
${goto 80}$color${voffset -25}Read: $diskio_read
${goto 79}$color2${diskiograph_write /dev/sda 30 -l}
${goto 80}$color${voffset -25}Write: $diskio_write
$color

$color1${font open sans:style=light:size=20}FS$font$color\
${goto 80}${voffset -12}root: $fs_used/$fs_size
${goto 80}${voffset -2}$color2${fs_bar /}$color
${goto 80}${voffset -2}data: ${fs_used /home/data}/${fs_size /home/data}
${goto 80}${voffset -2}$color2${fs_bar /home/data}$color
${goto 80}${voffset -2}data2: ${fs_used /home/data2}/${fs_size /home/data2}
${goto 80}${voffset -2}$color2${fs_bar /home/data2}$color
${goto 80}${voffset -2}server: ${fs_used /home/server}/${fs_size /home/server}
${goto 80}${voffset -2}$color2${fs_bar /home/server}$color
$color

$color1${font open sans:style=light:size=20}NET$font$color\
${goto 80}${voffset -12}Interface:${color}$alignr$gw_iface
${goto 80}${voffset -2}Internal IP:${color}$alignr$addrs
${goto 79}$color2${upspeedgraph eth0 30 -l}
${goto 80}${voffset -25}${color}Up: ${upspeed eth0}
${goto 79}$color2${downspeedgraph eth0 30 -l}
${goto 80}${voffset -25}${color}Down: ${downspeed eth0}
${voffset 14}${execpi 600 ~/.config/conky/sys/nameservers /etc/systemd/resolved.conf.d/dns.conf}

$color1${font open sans:style=light:size=20}SYS$font$color\
${voffset -12}${goto 80}Kernel:${alignr}$kernel
${goto 80}${voffset -2}Uptime:${alignr}$uptime_short]];

I have not tried with gdb - it said that this version of conky is compiled without it. I started the conky like this:

conky -DD -c /path/to/conkyrc >/tmp/conkyrc.log 2>&1 &

Today it finally crashed, and this was at the end of the log:

<snip>

DEBUG(1) [/build/conky/src/conky-1.11.5/src/fonts.cc:149]: loading fonts
DEBUG(1) [/build/conky/src/conky-1.11.5/src/fonts.cc:94]: setting up fonts
DEBUG(1) [/build/conky/src/conky-1.11.5/src/core.cc:2031]: no templates to replace
DEBUG(1) [/build/conky/src/conky-1.11.5/src/fonts.cc:149]: loading fonts
DEBUG(1) [/build/conky/src/conky-1.11.5/src/conky.cc:739]: evaluated 'Core 0${alignr}49°C' to 'Core 049°C'
DEBUG(1) [/build/conky/src/conky-1.11.5/src/core.cc:2031]: no templates to replace
DEBUG(1) [/build/conky/src/conky-1.11.5/src/fonts.cc:149]: loading fonts
DEBUG(1) [/build/conky/src/conky-1.11.5/src/conky.cc:739]: evaluated 'Core 1${alignr}49°C' to 'Core 149°C'
DEBUG(1) [/build/conky/src/conky-1.11.5/src/core.cc:2031]: no templates to replace
DEBUG(1) [/build/conky/src/conky-1.11.5/src/fonts.cc:149]: loading fonts
DEBUG(1) [/build/conky/src/conky-1.11.5/src/conky.cc:739]: evaluated '${goto 80}Current nameserver:
${alignr}${color1}2a03:b0c0:1:d0::590:6001
${goto 80}List generated Dec 30:
${alignr}${color1}2a03:b0c0:1:d0::590:6001${color}${voffset -5}${font sans:size=8}
${alignr}(ENG,GB) 99.97%${voffset -1}${font}
${alignr}${color1}2a00:6d40:60:9f8d::1${color}${voffset -5}${font sans:size=8}
${alignr}(IT) 99.96%${voffset -1}${font}
${alignr}${color1}2a00:dcc0:dead:b242::42${color}${voffset -5}${font sans:size=8}
${alignr}(LOM,IT) 99.95%${voffset -1}${font}
${alignr}${color1}2a00:f826:8:2::195${color}${voffset -5}${font sans:size=8}
${alignr}(DE) 99.94%${voffset -1}${font}
${alignr}${color1}2a00:f826:8:1::254${color}${voffset -5}${font sans:size=8}
${alignr}(HE,DE) 99.92%${voffset -1}${font}' to 'Current nameserver:
2a03:b0c0:1:d0::590:6001
List generated Dec 30:
2a03:b0c0:1:d0::590:6001
(ENG,GB) 99.97%
2a00:6d40:60:9f8d::1
(IT) 99.96%
2a00:dcc0:dead:b242::42
(LOM,IT) 99.95%
2a00:f826:8:2::195
(DE) 99.94%
2a00:f826:8:1::254
(HE,DE) 99.92%'
DEBUG(1) [/build/conky/src/conky-1.11.5/src/fonts.cc:149]: loading fonts
DEBUG(1) [/build/conky/src/conky-1.11.5/src/fonts.cc:94]: setting up fonts
DEBUG(1) [/build/conky/src/conky-1.11.5/src/core.cc:2031]: no templates to replace
DEBUG(1) [/build/conky/src/conky-1.11.5/src/fonts.cc:149]: loading fonts
DEBUG(1) [/build/conky/src/conky-1.11.5/src/conky.cc:739]: evaluated 'Core 0${alignr}49°C' to 'Core 049°C'
DEBUG(1) [/build/conky/src/conky-1.11.5/src/core.cc:2031]: no templates to replace
DEBUG(1) [/build/conky/src/conky-1.11.5/src/fonts.cc:149]: loading fonts
DEBUG(1) [/build/conky/src/conky-1.11.5/src/conky.cc:739]: evaluated '${color6}Core 1${alignr}51°C' to 'Core 151°C'
DEBUG(0) [/build/conky/src/conky-1.11.5/src/specials.cc:560]: reallocing graph from 0 to 154
double free or corruption (!prev)
ohnonot commented 4 years ago

It just happened again, ending with a different error:

<snip>
DEBUG(1) [/build/conky/src/conky-1.11.5/src/fonts.cc:149]: loading fonts
DEBUG(1) [/build/conky/src/conky-1.11.5/src/fonts.cc:94]: setting up fonts
DEBUG(1) [/build/conky/src/conky-1.11.5/src/core.cc:2031]: no templates to replace
DEBUG(1) [/build/conky/src/conky-1.11.5/src/fonts.cc:149]: loading fonts
DEBUG(1) [/build/conky/src/conky-1.11.5/src/conky.cc:739]: evaluated 'Core 0${alignr}44°C' to 'Core 044°C'
DEBUG(1) [/build/conky/src/conky-1.11.5/src/core.cc:2031]: no templates to replace
DEBUG(1) [/build/conky/src/conky-1.11.5/src/fonts.cc:149]: loading fonts
DEBUG(1) [/build/conky/src/conky-1.11.5/src/conky.cc:739]: evaluated '${color6}Core 1${alignr}50°C' to 'Core 150°C'
DEBUG(0) [/build/conky/src/conky-1.11.5/src/specials.cc:560]: reallocing graph from 0 to 154
DEBUG(0) [/build/conky/src/conky-1.11.5/src/specials.cc:560]: reallocing graph from 0 to 154
DEBUG(0) [/build/conky/src/conky-1.11.5/src/specials.cc:560]: reallocing graph from 0 to 154
DEBUG(0) [/build/conky/src/conky-1.11.5/src/specials.cc:560]: reallocing graph from 0 to 154
DEBUG(1) [/build/conky/src/conky-1.11.5/src/core.cc:2031]: no templates to replace
DEBUG(1) [/build/conky/src/conky-1.11.5/src/fonts.cc:149]: loading fonts
DEBUG(1) [/build/conky/src/conky-1.11.5/src/conky.cc:739]: evaluated '${goto 80}Current nameserver:
${alignr}${color1}2a00:6d40:60:9f8d::1
${goto 80}List generated Dec 31:
${alignr}${color1}2a00:dcc0:dead:b242::42${color}${voffset -5}${font sans:size=8}
${alignr}(LOM,IT) 99.97%${voffset -1}${font}
${alignr}${color1}2a00:6d40:60:9f8d::1${color}${voffset -5}${font sans:size=8}
${alignr}(IT) 99.94%${voffset -1}${font}
${alignr}${color1}2a00:6d40:40:4bb0::1${color}${voffset -5}${font sans:size=8}
${alignr}(IT) 99.94%${voffset -1}${font}
${alignr}${color1}2a00:dcc0:eda:88:245:71:858e:a15${color}${voffset -5}${font sans:size=8}
${alignr}(LOM,IT) 99.93%${voffset -1}${font}
${alignr}${color1}51.15.98.97${color}${voffset -5}${font sans:size=8}
${alignr}(NH,NL) 99.92%${voffset -1}${font}' to 'Current nameserver:
2a00:6d40:60:9f8d::1
List generated Dec 31:
2a00:dcc0:dead:b242::42
(LOM,IT) 99.97%
2a00:6d40:60:9f8d::1
(IT) 99.94%
2a00:6d40:40:4bb0::1
(IT) 99.94%
2a00:dcc0:eda:88:245:71:858e:a15
(LOM,IT) 99.93%
51.15.98.97
(NH,NL) 99.92%'
DEBUG(1) [/build/conky/src/conky-1.11.5/src/fonts.cc:149]: loading fonts
DEBUG(1) [/build/conky/src/conky-1.11.5/src/fonts.cc:94]: setting up fonts
malloc_consolidate(): invalid chunk size
ohnonot commented 4 years ago

Again... so, I thought I can maybe reproduce this by stressing the CPU and/or memory. This command: stress --cpu 32 --timeout 111 made the conky crash almost immediately with yet another error:

<snip>
DEBUG(1) [/build/conky/src/conky-1.11.5/src/fonts.cc:149]: loading fonts
DEBUG(1) [/build/conky/src/conky-1.11.5/src/fonts.cc:94]: setting up fonts
DEBUG(1) [/build/conky/src/conky-1.11.5/src/core.cc:2031]: no templates to replace
DEBUG(1) [/build/conky/src/conky-1.11.5/src/fonts.cc:149]: loading fonts
DEBUG(1) [/build/conky/src/conky-1.11.5/src/conky.cc:739]: evaluated '${color6}Core 0${alignr}50°C' to 'Core 050°C'
DEBUG(0) [/build/conky/src/conky-1.11.5/src/specials.cc:560]: reallocing graph from 0 to 154
DEBUG(0) [/build/conky/src/conky-1.11.5/src/specials.cc:560]: reallocing graph from 0 to 154
DEBUG(1) [/build/conky/src/conky-1.11.5/src/core.cc:2031]: no templates to replace
DEBUG(1) [/build/conky/src/conky-1.11.5/src/fonts.cc:149]: loading fonts
DEBUG(1) [/build/conky/src/conky-1.11.5/src/conky.cc:739]: evaluated '${color6}Core 1${alignr}51°C' to 'Core 151°C'
DEBUG(0) [/build/conky/src/conky-1.11.5/src/specials.cc:560]: reallocing graph from 0 to 154
DEBUG(0) [/build/conky/src/conky-1.11.5/src/specials.cc:560]: reallocing graph from 0 to 154
DEBUG(0) [/build/conky/src/conky-1.11.5/src/specials.cc:560]: reallocing graph from 0 to 154
DEBUG(0) [/build/conky/src/conky-1.11.5/src/specials.cc:560]: reallocing graph from 0 to 154
DEBUG(1) [/build/conky/src/conky-1.11.5/src/core.cc:2031]: no templates to replace
malloc(): smallbin double linked list corrupted

The conky had already been up and running for a few hours when I tried this. But when I restarted the conky and tried the stress command again, nothing happens. Also variations thereof, e.g.: stress --cpu 32 --vm 32 --io 32 --hdd 32 --timeout 111.

An Archlinux forum search for "conky AND crash" does not provide any insight.

ohnonot commented 4 years ago

And one more time. It seems to happen when the system (CPU or MEM?) is under stress, but not necessarily. Yet another error message:

<snip>

DEBUG(1) [/build/conky/src/conky-1.11.5/src/fonts.cc:149]: loading fonts
DEBUG(1) [/build/conky/src/conky-1.11.5/src/fonts.cc:94]: setting up fonts
DEBUG(1) [/build/conky/src/conky-1.11.5/src/core.cc:2031]: no templates to replace
DEBUG(1) [/build/conky/src/conky-1.11.5/src/fonts.cc:149]: loading fonts
DEBUG(1) [/build/conky/src/conky-1.11.5/src/conky.cc:739]: evaluated 'Core 0${alignr}43°C' to 'Core 043°C'
DEBUG(1) [/build/conky/src/conky-1.11.5/src/core.cc:2031]: no templates to replace
DEBUG(1) [/build/conky/src/conky-1.11.5/src/fonts.cc:149]: loading fonts
DEBUG(1) [/build/conky/src/conky-1.11.5/src/conky.cc:739]: evaluated '${color6}Core 1${alignr}50°C' to 'Core 150°C'
DEBUG(0) [/build/conky/src/conky-1.11.5/src/specials.cc:560]: reallocing graph from 0 to 154
free(): double free detected in tcache 2

Should I compile conky with debug symbols so I can run it with gdb?

I have no other problems with my system whatsoever. Another conky that just displays lines from the journal never crashes.

lasers commented 4 years ago

Should I compile conky with debug symbols so I can run it with gdb?

Yeah, why not? Go for it, sport. :+1: We need more collaborators, testers, volunteers, etc.

ohnonot commented 4 years ago

OK, I compiled the latest release with "Debug" option. I was today able to recreate the problem under gdb as described in the New Issue blueprint:

$ gdb conky
$ run -c /path/to/conkyrc
...
reproduce crash by stressing the memory
...
free(): double free detected in tcache 2

Thread 1 "conky" received signal SIGABRT, Aborted.
0x00007ffff77b0f25 in raise () from /usr/lib/libc.so.6

(gdb) bt full
#0  0x00007ffff77b0f25 in raise () from /usr/lib/libc.so.6
No symbol table info available.
#1  0x00007ffff779a897 in abort () from /usr/lib/libc.so.6
No symbol table info available.
#2  0x00007ffff77f4258 in __libc_message () from /usr/lib/libc.so.6
No symbol table info available.
#3  0x00007ffff77fb77a in malloc_printerr () from /usr/lib/libc.so.6
No symbol table info available.
#4  0x00007ffff77fd59d in _int_free () from /usr/lib/libc.so.6
No symbol table info available.
#5  0x00007ffff77ff805 in _int_realloc () from /usr/lib/libc.so.6
No symbol table info available.
#6  0x00007ffff7800996 in realloc () from /usr/lib/libc.so.6
No symbol table info available.
#7  0x000055555559e2d9 in new_graph (obj=0x5555557c0780, buf=0x5555557c7a50 "\001", buf_max_size=15872, val=0) at /home/data/git/conky-1.11.5/conky-1.11.5/src/specials.cc:559
        graph = 0x7fffffffda20
        s = 0x555555822640
        g = 0x5555557bb060
        graph_id = 93
#8  0x000055555556e991 in generate_text_internal (p=0x5555557c7a50 "\001", p_max_size=15872, root=...) at /home/data/git/conky-1.11.5/conky-1.11.5/src/conky.cc:703
        obj = 0x5555557c0780
        a = 1
#9  0x000055555556ec37 in generate_text () at /home/data/git/conky-1.11.5/conky-1.11.5/src/conky.cc:762
        p = 0x5555557c7850 "\001\001CPU\001\001\001\001stress          \001  3.25%\n\001\001stress          \001  3.12%\n\001\001stress          \001  3.12%\n\001\001stress          \001  3.12%\n\001\001\001\001\001\001\001\n\001\001\001Core 0\001\064\070°C\n\001\001\001\061\060\060%\001\063.70GHz\n\001\001\061\060\060%\001\063.70GHz\n\001\001\001\001\001\001\n\001\001\001\001Core 1\001\065\061°C\n\001\001\001\061\060\060"...
        i = 21845
        j = 4294957856
        k = 32767
        mw = 4152802959
        tbs = 32767
        ui = 0
        time = 0
#10 0x000055555557238a in update_text () at /home/data/git/conky-1.11.5/conky-1.11.5/src/conky.cc:1811
No locals.
#11 0x0000555555572962 in main_loop () at /home/data/git/conky-1.11.5/conky-1.11.5/src/conky.cc:1912
        fdsr = {fds_bits = {0 <repeats 16 times>}}
        tv = {tv_sec = 0, tv_usec = 0}
        s = 0
        terminate = 0
        t = 1.6068912189998628
        inotify_config_wd = 1
        inotify_buff = '\000' <repeats 104 times>, "StVUUU", '\000' <repeats 34 times>, "\360\335\377\377\377\177\000\000\000\000\000\000\000\000\b@\300~yUUU\000\000\340\246cUUU\000\000\020\336\377\377\377\177\000\000\300~yUUU\000\000\300~yUUU\000\000\000\000\000\000"...
#12 0x0000555555565472 in main (argc=3, argv=0x7fffffffe138) at /home/data/git/conky-1.11.5/conky-1.11.5/src/main.cc:354
No locals.
(gdb) 

I hope we can get to the bottom of this.

lasers commented 4 years ago

@su8 (?)

adam-kulagowski commented 4 years ago

I'm hitting exactly the same issue (ubuntu 19.10 + XFCE4/MATE/Cinnamon) using latest conky (github source or github relese). More info:

adam-kulagowski commented 4 years ago

I did some wget / cmake / run iterations. And so far I believe that the bug was introduced between 1.11.3 and 1.11.4/5.

[Update]: Although the crash frequency is lower in 1.11.4 than in 1.11.5 but is not zero. So far moving down to 1.11.3 passed all stress tests.

@ohnonot - can You test 1.11.3 to see if You are seeing this bug?

ohnonot commented 4 years ago

Setting double_buffer = false makes conky overwrite its own text (without erasing it).

I will compile 1.11.3 with default values now, and use it for a few days. We will see.

ohnonot commented 4 years ago

1.11.3 has been running super stable on my desktop for +2 weeks now.

Haven't yet tested on my laptop, but since that one is running an almost identical setup, I am confident tha this helps.

With this information, is it possible to find the issue & fix it for newer versions?

ohnonot commented 4 years ago

The 1.11.3 release has been working reliably on 4 installs across 2 machines - all of them Archlinux.

The current release is still 1.11.5 and Arch is still on 1.11.5.

The current release appears to be stable with simpler config files; I realize the next step would be to hunt down the culprit in my larger config file (see first post). This could take ages due to the "randomness" of the issue. Maybe somebody already did part of that and has a hint where the problem might be?


I have now also built & installed conky with this PKGBUILD - that's a different download link and a different build method. It, too, seems perfectly stable.

github-actions[bot] commented 1 year ago

This issue is stale because it has been open 365 days with no activity. Remove stale label or comment, or this issue will be closed in 30 days.

github-actions[bot] commented 1 year ago

This issue was closed because it has been stalled for 30 days with no activity.