Advertisement:

Author Topic: "SMF Database Error!" after upgrading to MacOS High Sierra [solved]  (Read 3093 times)

Offline boardhead

  • Semi-Newbie
  • *
  • Posts: 23
After upgrading my MacOS system from Yosemite (10.10.5) to High Sierra (10.13.3), I was getting occasional bursts of "SMF Database Error!" emails with this message:

This is a notice email to let you know that SMF could not connect to the database, contact your host if this continues.

Along with the new operating system, MySQL was also updated from 5.6.21 to 5.7.21, so I don't know which upgrade caused the problem, but I'm guessing MySQL.

Checking the MySQL log file (/usr/local/mysql/data/mysqld.local.err) I saw lots of messages like this:

[Warning] File Descriptor 1027 exceeded FD_SETSIZE=1024

It turns out there is a hard limit of 1024 on the maximum number of file descriptors for High Sierra.  The solution was to edit /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist and add this line to the mysqld options:

Code: [Select]
<string>--table-open-cache=400</string>
Then restart MySQL by clicking "Stop MySQL Server" then "Start MySQL Server" in the MySQL System Preferences.

The default setting for table-open-cache was 2000, which was greater than the MacOS limit.  Decreasing this to 400 has fixed my database error problems without any noticeable averse effects.

- Phil

Online CoreISP

  • Server Admin
  • Server Team
  • SMF Super Hero
  • *
  • Posts: 17,551
  • Gender: Male
  • CoreISP.net
    • liroyvh on LinkedIn
    • @liroyvh on Twitter
    • CoreISP Corporation :: WebHosting, Dedicated Servers, and more!
Re: "SMF Database Error!" after upgrading to MacOS High Sierra [solved]
« Reply #1 on: February 06, 2018, 12:16:14 PM »
Thanks for sharing the solution :) Some people might find that useful!
- CoreISP.net Corporation -
  WebHosting, Colocation, Domain Registration & Network Services
- DedicatedBox.us Servers -
  Low priced Servers in a high-quality Network, the place for all your (advanced) server needs.
  We specialize in hosting big boards. Contact us!

((U + C + I)x(10 − S)) / 20xAx1 / (1 − sin(F / 10))
President/CEO of Simple Machines - Server Manager
Please do not PM for support - anything else is usually OK.

Offline boardhead

  • Semi-Newbie
  • *
  • Posts: 23
Re: "SMF Database Error!" after upgrading to MacOS High Sierra [solved]
« Reply #2 on: February 06, 2018, 01:48:35 PM »
Here are a few commands that might find useful in diagnosing this problem:

1. Show your current table_open_cache setting:

Code: [Select]
mysqladmin -u mysql -p variables | grep -w table_open_cache
(and enter your mysql password)

2. Count the number of currently open tables:

Code: [Select]
sudo lsof -p <pid> | grep MYD | wc -l
(and enter your user password.  <pid> is the process ID number for mysqld)

3. Show your current mysqld version:

Code: [Select]
mysqld --version
- Phil

Offline joshuapinter

  • Newbie
  • *
  • Posts: 1
Re: "SMF Database Error!" after upgrading to MacOS High Sierra [solved]
« Reply #3 on: October 12, 2018, 12:21:35 AM »
Hey Phil,

I created an account on here just to let you know that you saved the day by pointing out that the value of `table_open_cache` should be _less_ than the default of 2000, instead of more.

I've spent days tracking down this bug and your tip was the answer. Settled on a value of 900, which works great.

Thank you so much for posting this! :)

Joshua