Regression #13316
closed``vmstat -m`` value for ``temp`` is accounted for incorrectly, resulting in underflows
100%
Description
It works on 22.01, running it on 22.05 produces the following output:
/usr/local/sbin/kmemusage.sh: arithmetic expression: variable conversion error: "DATA + TEXT"
Files
Updated by Jim Pingle over 2 years ago
- Assignee set to Jim Pingle
- Target version set to 2.7.0
- Plus Target Version set to 22.11
There is a line in vmstat -m
for temp
that is throwing off the output, it's gigantic
temp 18446744073709543701 18014398509480065K - 20798147 16,32,64,128,256,512,1024,2048,4096,8192,16384,32768,65536
Changing the DATA line in kmemusage.sh
to this seems to make it work but I'm not sure if it's the best fix.
DATA=`/usr/bin/vmstat -m | grep -v ' temp ' | /usr/bin/sed -Ee '1s/.*/0/;s/.* ([0-9]+)K.*/\1+/;$s/$/1024*p/' | /usr/bin/dc`
Updated by Jim Pingle over 2 years ago
Just after a reboot the value is sane and the script works, so there is something else going on there.
I'd say the script is fine but whatever is causing the high value of temp
in vmstat -m
is the problem.
Updated by Jim Pingle over 2 years ago
- File vmstat_m_temp.txt vmstat_m_temp.txt added
- Subject changed from ``kmemusage.sh`` fails to run to ``vmstat -m`` value for ``temp`` underflows when reduced below zero
- Assignee deleted (
Jim Pingle)
Looks like the value of that entry is unsigned and trying to go negative, which results in an underflow (hits 0 then goes very high). It took about an hour and a half to happen on a running system here. See the attached output which is a loop where it checks the value and sleeps for 30s between checks.
#!/bin/sh
while true; do
date >> /root/tmp/tempout.txt
uptime >> /root/tmp/tempout.txt
vmstat -m | egrep 'nvlist|temp' >> /root/tmp/tempout.txt
echo "---" >> /root/tmp/tempout.txt
sleep 30
done
Happens on both CE and Plus so it's not due to plus-specific changes.
Updated by Jim Pingle over 2 years ago
- Subject changed from ``vmstat -m`` value for ``temp`` underflows when reduced below zero to ``vmstat -m`` value for ``temp`` is accounted for incorrectly, resulting in underflows
- Status changed from New to Feedback
- Assignee set to Mateusz Guzik
- % Done changed from 0 to 100
Looks like this happens as the value for nvlist
increases. Apparently already fixed in FreeBSD: https://cgit.freebsd.org/src/commit?id=a37e0e6de6527a7eaddea8e28f5e4b3427fba1a4
Running a kernel with that commit applied the values are holding steady and not constantly changing as they are on an unpatched kernel. I'm still monitoring it, but it looks good with the patch so far.
Mateusz pushed that patch to devel-12 and plus-devel-12.
Updated by Christopher Cope about 2 years ago
Working as expected on
22.11-DEVELOPMENT (amd64) built on Wed Oct 05 06:04:21 UTC 2022 FreeBSD 14.0-CURRENT
Updated by Christopher Cope about 2 years ago
- Status changed from Feedback to Resolved
Updated by Jim Pingle about 2 years ago
- Plus Target Version changed from 22.11 to 23.01