Re: mysql - kern.maxfiles limit exceeded by uid 500 please see tuning(7)



none wrote:

Hi, I have a freebsd 4.10 server (x86) and I run a
shell script as a cron job every 15 minutes. This
scripts enter some data in the mysql database.

The server works fine for a few days, but after
5 days it crashes.

What crashes? The MySQL process? For whatever app is crashing see if there
is an error log with any info. I know MySQL keeps one. What version of
MySQL, ie, new and untested 5.x or old and venerable 4.1.x? How was it
compiled? Using WITH_LINUXTHREADS and/or BUILD_OPTIMIZED?

I only get this error and cannot
do anything else (except rebooting)
kern.maxfiles limit exceeded by uid 500 please see tuning(7)

This UID 500 seems a little strange. IIRC when I've seen this in the past is
when I've copied files like the /var/db/mysql/* onto a system that didn't
yet (oops) have a mysql user and group. Create the correct user/group and
then chown -R so everything is once again owned by mysql:mysql. Here's what
the line in vipw looks like for the mysql user as created by a standard
ports compile and install:

mysql:*:88:88::0:0:MySQL Daemon:/var/db/mysql:/usr/sbin/nologin

/etc/group entry is: mysql:*:88:

uid 500 is mysql, so I would like to know why
mysql is causing this error? why does it need
to open that much files? my current kern.maxfiles
is 1064, shouldn't this be enough?

This number also seems a little low. On the MySQL box here at home I use for
testing it only has 128MB RAM and I have maxusers 256 in the kernel config.
The values on this box are: kern.maxfiles: 5268 and kern.maxfilesperproc:
4741. On my desktop/KDE box with 512MB RAM it looks like: kern.maxfiles:
8008 and kern.maxfilesperproc: 7207.


What should I do this fix that?

add sysctl kern.maxfiles=4256 to /etc/rc.local?
or should I recompile the kernel with a new maxfiles
value?

I thought these went into /boot/loader.conf? Look
at /boot/defaults/loader.conf "Kernel tunables" for details. Might try
bumping kern.maxfiles up to 16384 or 65536 for testing. I suspect what this
will do is just extend the time it runs before you have to reboot because
it is not attacking the cause of the problem.

Is there a way to configure mysql to open
less files?

Can my shell script be the culprit? It does something like
this:
[snip]

I really don't know. But using "divide and conquer" mode you need to drive a
wedge between "is it a MySQL problem" or is it the shell script? You
probably need more information on what's going on. See man fstat and
periodically look at what files are being manipulated by which processes.
Try do it both between script runs and during. Look for /tmp filling up.
Look for processes that open a file but never close it. Is it running
mysqladmin every cron without terminating it? Can you temporarily do
without the shell script in the cron job long enough to see if it is the
script or not? Could it be cron itself opening files and never closing
them? I think you can see where I'm headed here. :-)

-Jason


.



Relevant Pages

  • Re: [PHP] hiding passwd in cmdlines that appear in the process list
    ... > Or, perhaps, write a shell script that reads the password and provides ... > it to MySQL somehow without invoking another exec of some kind. ... but there is a security issue - one that I thought I ...
    (php.general)
  • RE: [PHP] hiding passwd in cmdlines that appear in the process list
    ... Would it be possible, Jochem, to just make a shell script that does the call to mysql and have PHP exec() the shell script? ... // run the mysql command via the cmdline ...
    (php.general)
  • Re: [PHP] hiding passwd in cmdlines that appear in the process list
    ... Or, perhaps, write a shell script that reads the password and provides ... You also could look into other MySQL authentication mechanisms such as ... // run the mysql command via the cmdline ... but there is a security issue - one that I thought I ...
    (php.general)
  • mysql - kern.maxfiles limit exceeded by uid 500 please see tuning(7)
    ... shell script as a cron job every 15 minutes. ... scripts enter some data in the mysql database. ... The server works fine for a few days, ... echo "CREATE TABLE Average (Time DATETIME, AverageBar TINYTEXT, ...
    (comp.unix.bsd.freebsd.misc)
  • Re: Cron job from nowhere
    ... if its every 15 minutes, look in /etc/cron.d for a file named or similar to bugzilla, then either remove it, or disable it. ... It says in that email that the perl mysql module may not be installed correctly. ... My system has a cron job running from somewhere that trys to execute every 15 minutes and fails. ... Perhaps the DBD::mysql perl module hasn't been fully installed, ...
    (Fedora)