Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Too many open files with Mariadb 10.4.13 on Macos Catalina

i’m run on Macos 10.15.5, with mariadb 10.4.13. Since i did “brew upgrade” I have this error : Out of resources when opening file './pluto/_connection.MYD' (Errcode: 24 "Too many open files")

I tried to modify this file /usr/local/etc/my.cnf to add this line open_files_limit = 60000 but it doesn’t work, open_files_limit variable still blocked on the value 256.

I tried this line : sudo ulimit -n 1024, but each time I restart the value returns to 256

Do you have any help to bring me to help me solve my problem?

like image 429
Vika Avatar asked Jun 22 '20 09:06

Vika


People also ask

How do I fix too many open files in Safari?

A simple fix for the "too many files open" limitation of Mac OS is to use the "ulimit - n" command. Curiously, the value of n appears to be critical to whether or not this command is accepted by MacOS. I've found that ulimit -n 10240 (the default is 256) works but n values higher do not.

How many open files mac?

The default max open file limits on recent mac os is 10240 .


2 Answers

Have you tried looking for other ways to modify the open files limit on MacOS Catalina? A quick search led me to here which suggests the following for modifying it for the system while it is running:

sudo launchctl limit maxfiles <soft limit> <hard limit>

This site and this superuser question suggests to modify /Library/LaunchDaemons/limit.maxfiles.plist to permanantly increase it.

<?xml version="1.0" encoding="UTF-8"?>  
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"  
        "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">  
  <dict>
    <key>Label</key>
    <string>limit.maxfiles</string>
    <key>ProgramArguments</key>
    <array>
      <string>launchctl</string>
      <string>limit</string>
      <string>maxfiles</string>
      <string><your soft limit here></string>
      <string><your hard limit here></string>
    </array>
    <key>RunAtLoad</key>
    <true/>
    <key>ServiceIPC</key>
    <false/>
  </dict>
</plist> 

Then, finish up by changing permissions and verifying the change.

sudo chown root:wheel /Library/LaunchDaemons/limit.maxfiles.plist
sudo launchctl load -w /Library/LaunchDaemons/limit.maxfiles.plist
launchctl limit maxfiles
like image 105
zac Avatar answered Oct 06 '22 22:10

zac


  • MacOS Catalina 10.15.x
  • Mariadb installed with homebrew

Importing database with mysql < foo.sql fails with: [ERROR] Error in accept: Too many open files

Agree with the posts above. This looks like a false negative. This is what worked for me:

brew services stop mariadb

And make sure you do not have any mysql processes running: ps aux | grep mysql.

mkdir /usr/local/var/run/mysqld

Edit Mariadb config file /usr/local/etc/my.cnf and tell it to use this directory.

[client-server]
socket = /usr/local/var/run/mysqld/mysql.sock

[mysqld_safe]
pid-file = /usr/local/var/run/mysqld/mysqld.pid

Strictly speaking you do you only need to define the pid file, though I personally like to store both pid and socket files inside the /usr/local/var/run - structure. I do the same for PHP (/usr/local/var/run/php) installed from Homebrew.

Start you database server and you are done.

brew services start mariadb
like image 31
steinmb Avatar answered Oct 06 '22 20:10

steinmb