kernel: negative sbsize for uid = 0

Dan Nelson dnelson at allantgroup.com
Wed Dec 14 19:46:35 UTC 2011


In the last episode (Dec 13), Doug Barton said:
> I'm running 8.2-RELEASE-p4 i386 on some web servers that are generally
> lightly-moderately loaded, but occasionally see some heavy spikes where
> load average goes way up.  When that is happening, but sometimes even when
> it's not, I get hundreds of this message spewing into the logs:
> 
> kernel: negative sbsize for uid = 0
> 
> I haven't found anything particularly useful by searching for that
> message, the one reference was to mbufs, but that seems not to be the
> problem.  Here is the output of 'netstat -m' during one of the load
> spikes:
[...]
> So is this message something to worry about? If so, how can I diagnose
> what's happening, and how do I fix it?

I've seen it ocassionally too.  The error message is printed in
/sys/kern/kern_resource.c when the ui_sbsize resource counter goes negative. 
There's probably insufficient locking somewhere in the functions that call
chgsbsize.  The increment/decrement is done atomically, but the data pointed
to by the "hiwat" argument is read then updated later without an explicit
lock, so if that value changes while the function is executing, it could
cause problems.  ui_sbsize is only used by the resource limiting code,
though, so unless you're enforcing an sbsize rlimit, it should be harmless.

-- 
	Dan Nelson
	dnelson at allantgroup.com


More information about the freebsd-stable mailing list