Mariadb - Too many open files

Hello everyone,

i’m run on Macos 10.15.5, 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.

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

This question doesn’t seem very specific to homebrew. Did you already try asking the MariaDB community?

I’ve run into this exact same issue as well. I’ve tried checking in the MariaDB community, on stack overflow, and other online sources. I’m not able to find a fix. It does seem odd that MariaDB, installed via Homebrew, doesn’t seem to pick up the open_files_limit variable value from the config.

Were you ever able to find a resolution?

I had the same issue and I was able to fix it by increasing the system-wide limits like described here:

1 Like

Hey @mirzac thanks for posting that, but I don’t really understand why you’d need to hack the entire system wide limits just to get a useable MariaDB install. That seems crazy and dangerous to me.

Why would Homebrew’s MariaDB install not pick-up or just honor the open_files_limit value set in the my.cnf file?

Because for that homebrew would need to tell the system those limits based on your mysql configuration. But homebrew only does package management, not system management.

1 Like

I guess I’m pretty new to understanding the relationship between the system configuration and the MySQL config. So the setting in the my.cnf can’t be set higher than the ulimit on the system? Only lower? Is that correct?

If that’s the case then my next question is why would it be limited to the soft limit (which on macOS Catalina is apparently incredibly low, 256?!!) and not the hard limit?

Yes, otherwise system limits would be quite pointless.

Because administrative flexibility.

  • Hard limits are controlled by root, but soft limits can be adjusted (downwards from the hard limit) by any user, so each process can set its own even-more-restricted limits for reasons. (Pedants will note that normal users can reduce hard limits of their own accord, but that’s tangential to the main point.)
  • Hard limits are universally Thou Shalt Not Pass, while some soft limits may allow some flexibility. For instance, Linux processes that cross CPU soft limits get signaled with SIGXCPU and can then self-throttle, but if they choose to press on to the hard limit, they get a SIGKILL between the eyes.
1 Like

Thank you for this great explaination

I ended up following the instructions that @mirzac provided. It resolved my issue. Thanks to everyone on this thread who provided their knowledge and help. I appreciate it.