Subject: Re: sysctl & process limitations
To: Randy Arabie <rrarabie@arabie.org>
From: Manuel Bouyer <bouyer@antioche.lip6.fr>
List: netbsd-help
Date: 02/05/2002 16:59:12
On Tue, Feb 05, 2002 at 08:53:08AM -0700, Randy Arabie wrote:
> On Tue, 5 Feb 2002, Manuel Bouyer wrote:
> 
> > On Tue, Feb 05, 2002 at 08:34:34AM -0700, Randy Arabie wrote:
> > > You mention that, mysqld AND mysql.  You will note above that when I checked mysqld with fstat,
> > > there were only 64 files open.  That, coincidentally, is the default proc.curproc.rlimit.descriptors.soft 
> > > setting.
> > > 
> > > Does mysqld fork they mysql process, which may not be inheriting the limits set for mysqld?
> > > 
> > > Can I add a line in /etc/sysctl.conf to allow all processes to have a greater default soft limit for 
> > > descriptors?
> > 
> > The sysctl stuff should be enouth. Did you check that the values have really
> > been raised ?
> 
> Yes.  After I changed with the sysctl -w command I confirmed with sysctl -a proc.[pid].rlimit, they all
> looked good.
> 
> > The 'safe_mysqld' script I use has an option to raise the limit:
> > /usr/pkg/bin/safe_mysqld --open-files-limit=256
> 
> So, from my 'safe_mysqld' script, I could edit the following block:
> 
> <SNIP>
>       # QQ The --open-files should be removed
>       --open-files=*) open_files=`echo "$arg" | sed -e "s;--[^=]*=;;"` ;;
>       --open-files-limit=*) open_files=`echo "$arg" | sed -e "s;--[^=]*=;;"` ;;
>       --core-file-size=*) core_file_size=`echo "$arg" | sed -e "s;--[^=]*=;;"` ;;
>       --timezone=*) TZ=`echo "$arg" | sed -e "s;--[^=]*=;;"` ; export TZ; ;;
>       --mysqld=*)   MYSQLD=`echo "$arg" | sed -e "s;--[^=]*=;;"` ;;
>       --mysqld-version=*)
>         tmp=`echo "$arg" | sed -e "s;--[^=]*=;;"`
>         if test -n "$tmp"
> </SNIP>
> 
> Where I see '--open-files-limit=*' above, I could change the '*' to '256'?

Yes, I think so.

>  
> > Anyway the error code doesn't match a per-process limit but a system limit.
> > This is why I would use ktrace to check what the error really is.
> 
> My original trace last week confirmed that the error was error: 23.  I was tracing 
> mysqld.

Hum, and 23 is really Too many open files in system. What system call got the
23 error code ?
Did you count in the ktrace output how many files it had opened ?
Just watching the file descriptor numbers should be enouth.

--
Manuel Bouyer, LIP6, Universite Paris VI.           Manuel.Bouyer@lip6.fr
--