Solved Open files limit?

I'm using a home grown program using Harbour compiler, which is similar to the old Clipper dBase compiler. I'm getting an error (DBFNTX 1012 corruption detected <indexname>) which might be related to the number of files open. The system is multiuser (usually no more than 5 users) and opens 47 files (data tables and indexes). Is there a way to see if the FreeBSD system is running out of resources and potentially increase them? Thanks.
 
`ulimit -a`

Is the first line of open file limits. No way it is as low as 47. And it isn't corruption to hit the open file limit.
 
There's also kern.maxfiles and kern.maxfilesperproc, both are set dynamically based on kern.maxusers which in turn is calculated based on the amount of memory the machine has. But unless your system only has few KB of memory (which is extremely unlikely) all these values are quite high by default.
 
Hmm, well thanks all. Is there a way to see if resources are being used up?

When hitting the open file limit it is the application's responsibility to print errno, which will be "too many open files".

If the application fails to do that you can hack up the kernel to print it to the console, or you can use truss/ktrace.

Overall, however, the "corruption" warning doesn't smell like hitting the open file number limit. You need to look up in the source what triggers this message. The message is essentially useless since it is not specific enough.
 
I reduced the number of files being opened and the problem seems cured. I know this is off topic but has anyone ant ideas about tracking down what is being used up?
 
I reduced the number of files being opened and the problem seems cured. I know this is off topic but has anyone ant ideas about tracking down what is being used up?

You can use dtrace to print a message when a file is being updated, with a backtrace. Do you would know approximately what is doing all the open calls.

First order of business, though, is to sort out that error message to be specific, to print errno if it was a system call error.
 
Back
Top