lua-sysctl hang on `vfs.cache.nchstats'
Closed this issue · 5 comments
kaworu commented
The following script hang and is killed (hacked version of misc/test-all.lua)
require('sysctl')
function show()
local sctl, stype = sysctl.get(key)
if (type(sctl) == 'table') then
local k,v
print("{")
for k,v in pairs(sctl) do
print(" " .. k .. "=" .. v)
end
print("}\t" .. stype)
else
print(sctl .. "\t" .. stype)
end
end
key = 'vfs.cache.nchstats'
print(key)
ok, err = pcall(show);
if (not ok) then
print("*** FAILED ***")
print(err);
end
print("------")
kaworu commented
% uname -a
FreeBSD Freesbee 9.1-RELEASE FreeBSD 9.1-RELEASE #0 r243825: Tue Dec 4 09:23:10 UTC 2012 root@farrell.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC amd64
% time lua-5.1 testcase.lua
vfs.cache.nchstats
zsh: killed lua-5.1 testcase.lua
lua-5.1 testcase.lua 15.75s user 5.59s system 66% cpu 32.080 total
% dmesg
[...]
swap_pager: out of swap space
swap_pager_getswapspace(16): failed
pid 2218 (lua), uid 1001, was killed: out of swap space
peikk0 commented
% time lua-5.1 test.lua
vfs.cache.nchstats
*** FAILED ***
table overflow
------
lua-5.1 test.lua 40.80s user 4.16s system 49% cpu 1:30.17 total
It wasn't killed, but it eated ~3GiB of memory.
peikk0 commented
% lua-5.1 test.lua
vfs.cache.nchstats
*** FAILED ***
test.lua:4: unknown CTLTYPE: fmt=LU ctltype=5
------
kaworu commented
Yes it is expected, for some unknown reason vfs.cache.nchstats is declared as CTLTYPE_OPAQUE
although fmt
suggest CTLTYPE_ULONG
(which seems to work).
Maybe this should be reported to FreeBSD, there are more inconsistencies between formats and types, but changing them may break userland.