Summary.Net Archives
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Summary-Talk] Log file permission



On 10/24/03 3:49 PM John Readwin (appsupport@netextras.com) wrote:

>OK here are the results
>sysctl kern.maxvnodes
>max number of vnodes came up as 10032
>
>pstat -T
>
>gave me 10028 vnodes
>
>How do I resolve this?

You are running out of vnodes, an internal system resource used to do 
just about everything. The results you quoted show that you have 10028 in 
current use and an absolute limit of 10032. At any given moment you are 
sure to be hitting the limit, as any program doing almost anything is 
going to use a couple of vnodes. Running out of vnodes can cause all 
kinds of problems. In particular it can cause the problem which you 
described.

A vnode is a block of memory in the kernel used to keep track of files on 
disk, and other several things, while they are in "active" use. When a 
program opens a file, the system requires a vnode for the file and one 
for the directory the file is in. Other things the kernel does also 
require vnodes. For example doing a DNS lookup takes a vnode. Whenever 
the operation is completed, the vnode is freed for reuse.

When a program tries to open a file, and there are no vnodes available, 
the open will fail, even if everything else about the operation is fine. 
This will cause Summary to fail when trying to open a log file, or 
writing a backup, or any of several other things. A few things other than 
opening files also require vnodes, such as DNS lookups. As virtual memory 
usage increases the system will use vnodes to keep track of the virtual 
memory. Many other steps can also require vnodes

Certain system programs perform operations that must succeed in order for 
the system to continue functioning. When one of their internal operations 
fails, because there are no vnodes available, very bad things might 
happen. Although everything is supposed to check for that kind of thing, 
and try again, not everyone is that careful. Also there are a very few 
kernel operations that must have a vnode right now, and can not wait for 
one to be freed. If one of those happens and there isn't a vnode 
available, you will get a kernel panic.

The solution is to tell the system to allocate space for more vnodes. The 
command:

sudo sysctl -w kern.maxvnodes=20000

will raise the limit to 20000 till the next reboot. This must be run by 
an admin user and will prompt for a password. You should watch the output 
of:

pstat -T

to make sure that that is really enough. You want there to be a few 
thousand free when running all of the apps you are every planning to run. 
If not, raise the 20000 to something higher. Once you know how many are 
enough, you can make the change permanent by editing 
/System/Library/StartupItems/SystemTuning/SystemTuning which sets the 
upper limit when the machine is rebooted. Look for the line, perhaps 
twenty lines before the end, that says:

    addvnodes=512

and change the 512 to something higher, say 1024. You have to be root to 
edit that file. Then reboot and check that the limit went up enough with:

sysctl kern.maxvnodes

which tells you the upper bound on the number of vnodes.

Keep in mind that any edits of that file might be erased after any Apple 
system software upgrade.

There is an article with a different approach to raising the vnode limit 
at <http://www.macosxhints.com/article.php?story=20020722084339470>. I 
think my solution is simpler, but you might like theirs.

The "real" solution is to complain to Apple that their default system 
configuration is running out of vnodes. Perhaps someday they will do 
something about it. In the mean time we are stuck with these rather 
complex workarounds.

Good Luck
Jason

-----------------
Jason@Summary.Net
-----------------
Dr. Seuss books . . . can be read and enjoyed on several levels. For
example, 'One Fish Two Fish, Red Fish Blue Fish' can be deconstructed
as a searing indictment of the narrow-minded binary counting system.
  -- Peter van der Linden, Expert C Programming, Deep C Secrets


-----------------
Jason@Summary.Net
-----------------
Dr. Seuss books . . . can be read and enjoyed on several levels. For
example, 'One Fish Two Fish, Red Fish Blue Fish' can be deconstructed
as a searing indictment of the narrow-minded binary counting system.
  -- Peter van der Linden, Expert C Programming, Deep C Secrets


-------------
Go to <http://summary.net/list.html> to update subscription info.