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.17k stars 615 forks source link

no_update Segmentation Fault #117

Closed ghost closed 6 years ago

ghost commented 9 years ago

When using no_update Conky exits with a segmentation fault if Conky writes to X. When only writing to console everything works well.

It also works normal if there is no variable inside the no_update, eg: ${no_update Some text here}

Minimal example config

conky.config = {
    own_window = true,
    own_window_type = 'normal',
    out_to_x = false,   -- Toggle 
    out_to_console = true,
};

conky.text = [[
${no_update $time}
]];

Error when writing to X

conky -c [PATH]/conkyrc
conky: desktop window (1200024) is subwindow of root window (296)
conky: window type - normal
conky: drawing to created window (0x1c00001)
Segmentation fault (core dumped)
marcpayne commented 9 years ago

Try setting use_xft = true as a temporary workaround.

ghost commented 9 years ago

Confirmed, the temporary workaround fixes the problem. Thanks.

lasers commented 6 years ago

@brndnmtthws Can we close this?

EDIT: The behavior is same in latest version. Worked okay with use_xft = true. Is it bug?

brndnmtthws commented 6 years ago

A segfault is a bug, with or without a workaround. I haven't looked into this one yet, however.

lasers commented 6 years ago

SIGSEGV -- Internet said it is something about dereferencing a null pointer. I'd love it if you can write up a documentation on debugging conky. Do I use strace, gdb, etc? How to enable debug? Et cetera.

base="", iov_len=0}], 3) = 28
poll([{fd=4, events=POLLIN}], 1, -1)    = 1 ([{fd=4, revents=POLLIN}])
recvmsg(4, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="\1\0g\0023\3\0\0\0\0\0\0\6\0\377\377\366\377\0\0\0\0\0\0\2\0\6\0\6\0\v\0"..., iov_len=4096}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, 0) = 3308
recvmsg(4, {msg_namelen=0}, 0)          = -1 EAGAIN (Resource temporarily unavailable)
recvmsg(4, {msg_namelen=0}, 0)          = -1 EAGAIN (Resource temporarily unavailable)
--- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0x78} ---
+++ killed by SIGSEGV (core dumped) +++
[1]    5698 segmentation fault (core dumped)  strace conky -c /tmp/conky.txt
brndnmtthws commented 6 years ago

gdb is the right tool for figuring out exactly where it blew up. Depending on the situation, you can either get a stack trace with the core dump or just running it in gdb.

Example:

$ gdb /usr/bin/conky
(gdb) run
...
(gdb) bt full
...
lasers commented 6 years ago
Starting program: /usr/local/bin/conky -c /tmp/conky.txt
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".                                      
conky: desktop window (25a) is root window
conky: window type - normal
conky: drawing to created window (0x2600001)
conky: can't load font '6x10'
conky: can't load font '6x10'

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7014028 in XSetFont () from /usr/lib/libX11.so.6                                        
(gdb) bt full
#0  0x00007ffff7014028 in XSetFont () from /usr/lib/libX11.so.6                                    
No symbol table info available.
#1  0x00005555555790b7 in X11_create_window ()
    at /home/chris/src/conky/src/conky.cc:2646
No locals.
#2  initialisation(int, char**) () at /home/chris/src/conky/src/conky.cc:3039                      
        act = {__sigaction_handler = {sa_handler = 0x0, sa_sigaction = 0x0},                       
          sa_mask = {__val = {0 <repeats 16 times>}}, sa_flags = 0, sa_restorer = 0x0}             
        oact = {__sigaction_handler = {sa_handler = 0x0, sa_sigaction = 0x0},                      
          sa_mask = {__val = {0 <repeats 16 times>}}, sa_flags = 0, sa_restorer = 0x0}             
#3  0x000055555556a6ef in main () at /home/chris/src/conky/src/conky.cc:3158                       
        curl_global = <optimized out>
#4  0x00007ffff4e3e06b in __libc_start_main () from /usr/lib/libc.so.6                             
No symbol table info available.
#5  0x000055555556f36a in _start () at /home/chris/src/conky/src/conky.cc:3212                     
No symbol table info available.
(gdb)