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

top mem shows 'inf' or '-nan' #1036

Closed msjr65 closed 5 months ago

msjr65 commented 3 years ago

Issue

top mem shows 'inf' or '-nan' when $mem is not included anywhere in the conky.text

Information

Linux 5.9.11-arch2-1 x86_64 GNU/Linux Conky v1.11.6

conky.config = {
    alignment = 'top_right',
    background = true, 
    border_width = 1,
    cpu_avg_samples = 2,
    default_color = 'orange',
    default_outline_color = 'white',
    default_shade_color = 'white',
    double_buffer = true,
    draw_borders = false,
    draw_graph_borders = true,
    draw_outline = false,
    draw_shades = true,
    draw_blended = true,
    extra_newline = false,
    font = 'Sans Regular:size=10',
    gap_x = 25,
    gap_y = 370,
    minimum_height = 5,
    minimum_width = 270,
    maximum_width = 270,
    net_avg_samples = 2,
    no_buffers = true,
    out_to_console = false,
    out_to_ncurses = false,
    out_to_stderr = false,
    out_to_x = true,
    own_window = true,
    own_window_type = 'normal',
    own_window_transparent = false,
    own_window_hints = 'undecorated,sticky,below,skip_taskbar,skip_pager',
    own_window_argb_visual = true, 
    own_window_argb_value = 0,
    show_graph_range = false,
    show_graph_scale = false,
    stippled_borders = 0,
    update_interval = 1.0,
    uppercase = false,
    use_spacer = 'none',
    use_xft = true, 
    top_cpu_separate = true,
    top_name_width = 10
}

conky.text = [[
${color grey}Info:$color ${scroll 32 $sysname $nodename $kernel $machine}
${color grey}$hr
${color grey}Uptime:$color $alignr$uptime
${color grey}CPU Usage:$color ${alignr -5}${cpu cpu0} % 
${color grey}CPU Tdie Temp:$color $alignr${execi 1 sensors | grep "Tdie" | cut -d "+" -f2 | cut -c1-7}
${color grey}CPU Fan:$color ${alignr -5}${execi 1 sensors nct6793-isa-0290 | grep "fan2" | cut -d ":" -f2 | cut -c19-26} 
${color grey}NVME1 Temp:$color $alignr${execi 1 sensors nvme-pci-0100 | grep "Composite" | cut -d "+" -f2 | cut -c1-7}
${color grey}NVME2 Temp:$color $alignr${execi 1 sensors nvme-pci-0200 | grep "Composite" | cut -d "+" -f2 | cut -c1-7}
${color grey}RAM Usage:$color $alignr${execi 1 awk </proc/meminfo -F': *' '
{ v[$1] = $2+0 }
END{ printf "%4.2f\n", ((v["MemTotal"]-v["MemFree"]-(v["Cached"]-v["Shmem"]+v["Buffers"]+v["SReclaimable"]))/1024/1024)
}'} GiB - ${execi 1 awk </proc/meminfo -F': *' '
{ v[$1] = $2+0 }
END{ printf "%4.2f\n", ((v["MemTotal"]-v["MemFree"]-(v["Cached"]-v["Shmem"]+v["Buffers"]+v["SReclaimable"]))/v["MemTotal"])*100
}'}%
${color grey}Disk IO:$color $alignr$diskio_read R - $diskio_write W
${color grey}${hr 1}
${color grey}Core Frequency (MHz):$color ${voffset 10}
$alignr${freq 1}    $alignr${freq 2}    $alignr${freq 3}    $alignr${freq 4}    
$alignr${freq 5}    $alignr${freq 6}    $alignr${freq 7}    $alignr${freq 8}    
${color grey}$hr
${color grey}Net Up:$color ${upspeed enp3s0} ${color grey}- Down:$color ${downspeed enp3s0}
${color grey}$hr
${color grey}Proc. Name          ${goto 140}CPU%${goto 215}MEM% ${voffset 5}
$color${goto 5}${top name 1}   ${goto 135}${top cpu 1}   ${goto 215}${top mem 1}
$color${goto 5}${top name 2}   ${goto 135}${top cpu 2}   ${goto 215}${top mem 2}
$color${goto 5}${top name 3}   ${goto 135}${top cpu 3}   ${goto 215}${top mem 3}
$color${goto 5}${top name 4}   ${goto 135}${top cpu 4}   ${goto 215}${top mem 4}
$color${goto 5}${top name 5}   ${goto 135}${top cpu 5}   ${goto 215}${top mem 5}
${color grey}$hr
]]
ben2talk commented 3 years ago

I am also struggling to work this out... ${top mem 1} reads inf ${top_mem mem 1} reads inf

flash872 commented 3 years ago

Confirming I have the same issue. Mostly reads inf, but also occasionally -nan. I have not changed my conky config between the time it was last working and when this issue appeared.

ben2talk commented 3 years ago

Ok, I just spent some time with MELD. I copied the default https://github.com/brndnmtthws/conky/blob/master/data/conky.conf Using a launcher to have two conkies open and then slowly adjusted the text in both to be more similar.

The strange thing is it still seems to make no sense. Just edit line by line until your 'inf' turns into a number...

I now have this section:


conky.text = [[

${color grey}Swap Usage:$color $swap/$swapmax - $swapperc% ${swapbar 4}
${color grey}Processes:$color $processes  ${color grey}Running:$color $running_processes
\
# Storage
\

I have NO SWAP, yet if I delete the 'Swap Usage' line, it reverts to 'inf'. The same applies to the next line. If I hash out the Swap Usage line (in code, with autosave) conky reloads and works. If I kill it and load it again, it comes up with 'inf'.

Update: I gave up. I have no swap, yet even removing $swap/$swapmax brings back the inf so I'll just leave it in.

flash872 commented 3 years ago

I'm sure this is well-known and obvious, but in lua, NaN is "nan" or "-nan", and infinities are "inf" or "-inf", both matching the reported errors. Perhaps this is caused by something in a library or in a variable call that is dividing by zero? I don't know where or how to look for anything that may be helpful.

rmartin16 commented 3 years ago

fyi. #960 documents a potential workaround. add $mem or $swap somewhere and you'll stop seeing inf and nan with top mem.

edit (although, i see now that's exactly what the first sentence of the issue says....i'll leave this comment for the link issue 960 if nothing else)

pescepalla commented 3 years ago

I'm not sure if related but Conky's ${top mem} and ${top mem_res} now show nothing at all.

I might not be Conky's fault as it started happening today all of a sudden and the last Conky update on Arch Linux was on 2021-04-26.

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.

msjr65 commented 1 year ago

bump

brndnmtthws commented 1 year ago

Is this still happening with 1.15.0? It seems to have been updated in the arch repos: https://archlinux.org/packages/extra/x86_64/conky/

kees-closed commented 1 year ago

I noticed that the issue is "solved" when using the memgraph. So something about memory stats are not collected, unless the memgraph is included as well?

In my case:

${color1}${font Font Awesome 5 Free:style=Solid:pixelsize=13}${font}${goto 30}RAM${alignr}${mem} (${memperc}%) used / ${memmax}
${color2}${memgraph 50,299 ${gradientcolor1} ${gradientcolor2} -t}

I see something similar was mentioned by @rmartin16

stele95 commented 1 year ago

I had the same issue, but I saw this PR that fixes this. It's merged and after installing conky-git from AUR I can confirm that this issue is fixed, so it will be included in the next release

Caellian commented 5 months ago

Duplicate of #960. Closing as fixed. Leave a comment if you believe this issue should be reopened.