Bug #71960 | Mysql 5.6.16 on OSX throws connection errors with innodb_file_per_table option | ||
---|---|---|---|
Submitted: | 6 Mar 2014 23:57 | Modified: | 17 Apr 2015 0:18 |
Reporter: | Kris Iyer | Email Updates: | |
Status: | Verified | Impact on me: | |
Category: | MySQL Server: Options | Severity: | S1 (Critical) |
Version: | 5.6.16, 5.6.20 | OS: | MacOS (10.8) |
Assigned to: | CPU Architecture: | Any | |
Tags: | innodb_file_per_table, OSX 10.8, OSX 10.9, system error: 0, system error: 32 |
[6 Mar 2014 23:57]
Kris Iyer
[7 Mar 2014 22:38]
Kris Iyer
This was tested on machine specs ranging from 4GB, 8GB and 16 GB and 32 GB RAM. Things were a little better on the higher specs (16GB and above) but looked severe on anything 8GB and below. Further debugging and tracing has led to the mysql option "innodb_file_per_table" which is turned on by default on Mysql 5.6 to be causing this issue. Turning off this option has revealed positive results so far and no occurrence of system error: 32. It was also noticed that increasing open file limits (ulimit -n) on the higher spec machines helped with better results while running with "innodb_file_per_table" turned on.
[24 Mar 2014 22:48]
Robert Evans
Experiencing what appears to be the exact same bug on OS X 10.7 and 10.8 with similar outcomes (re: innodb_file_per_table = off). Thanks Kris for finding that little nugget. I've been trying different things and regularly restarting MySQL for days with no success, but that directive seems to help.
[7 Jun 2014 8:54]
Eduard Letifov
Am affected by an issue with similar symptoms. Have tried workarounds suggested elsewhere (increasing max open files limits) - no avail.
[16 Oct 2014 8:35]
MySQL Verification Team
Hello Kris Iyer, Thank you for the report. Thanks, Umesh
[15 Dec 2014 18:14]
Paul Keenan
I was affected by the same issue. I found that if I kept a MySQL root prompt open until I saw the error, I could perform a FLUSH TABLES command, and immediately I was able to log in again. The issue was resolved finally by increasing the open files limit per process from 256 files to 65536 files by following the guide at : http://docs.basho.com/riak/latest/ops/tuning/open-files-limit/#Mac-OS-X I think that client behaviour, as well as lower default resource limits in Mac OS X Yosemite is responsible for the increase in the number of times I was seeing this issue. Whenever I use a MySQL command-line client, it scans the current database to read the table and field names for auto-complete purposes. This access all of the tables in the default database and brings them into the open table cache. Microsoft Excel 2013 Power Query is even worse; despite asking you for a database name when you connect, it continues to scan every table in every database. This adds a huge number of entries to the open tables cache, breaking the server pretty quickly. It would be a huge step forward if you could arrange for the client to be sent the message "server ran out of file handles" or similar, instead of the distinctly unhelpful "Lost connection to MySQL server at 'reading authorization packet', system error: 0". You might also consider keeping a couple of file handles in reserve so that it's always possible to open a connection as root. Currently, when this limit is hit, it's not possible to connect as root which makes it very difficult to diagnose or fix the problem. It's not even possible to shut down the database with mysqladmin in this state, since that relies on a new connection. Cheers, Paul
[16 Dec 2014 6:24]
Chris Moffatt
Occurring with 5.6.22 as well as Percona 5.6.21-70 10.8 and 10.9
[6 Feb 2015 20:15]
James Kemmerer
I'm running Yosemite 10.10.2 / MySQL 5.6.22 We have the same symptoms as above. Strangely we can connect remotely but any connection via localhost, like our web server fails. Connecting using tools like navigate or Sequel pro fail from localhost and 127.0.0.1. Connecting using MySQL Workbench fails at localhost. This machine is brand new and is NOT under any load. So the high load, large query note on MySQLs page about this issue does not apply here. Also because it is from localhost, long query times / slow connection can also be ruled out. (http://dev.mysql.com/doc/refman/5.0/en/error-lost-connection.html) ATTEMPETED SOLUTIONS 1. connect_timeout = 10 (failed, problem persists) 2. upping file limits and process limits via plist (failed, problem persists) 3. As noted above if we issue "flush tables" from a remotely connected client then the web server can connect, MySQL Workbench can connect, local clients like navigate can connect. Item 3 is NOT a solution because the server will eventually fail again and "flush tables" must be reissued again. This could not be used as a production database.
[20 Feb 2015 22:16]
James Kemmerer
We installed 5.6.23 on the machine described in the post above and the same bug persists.
[27 Feb 2015 10:43]
Paul Keenan
I raised the OS X open files limit to 65536 and I think this delayed the problem, but didn't solve it. Even with the higher limit, in my case the server still starts refusing connections when there are just over 1000 tables in the open table cache. It could do this fairly repeatably. I reduced the table_open_cache value to 500 and that seems to have resolved it for me, albeit with a (possibly minor) performance hit.
[6 Mar 2015 18:35]
James Kemmerer
on our 5.6.23 mysql we tried the table_open_cache = 500 patch and that seems to be working so far for us as well. I have not done exhaustive testing yet, but frankly the database would go away frequently without any exhaustive activity so my guess is that this has fixed or at least worked around the bug.
[16 Apr 2015 21:29]
George Dombrowski
We upgraded our XServe 2009 to Yosemite 2 weeks ago and soon after discovered this MySQL Workbench connections problem. Mostly, we would get Error 32 lost connection while using external MySQL terminal clients, sometimes we would see an authentication Error 0. These errors would generally occur within a few minutes of initiating an external Workbench connection. Our Tomcat server would also cease to function and essentially it looked like a crash. At the time, I did not know that the 'flush tables' command might possibly fix the WEB server issue. We are using Yosemite 10.10.3, and I am very thankful to James Kemmerer for his note about setting the table_open_cache value to 500 as it does appear to fix the problem.
[16 Apr 2015 22:47]
Paul Keenan
Hi George, I'm glad your workaround is helping, although I think that James was just endorsing the fix I had originially mentioned. :) From reading the comments on this bug report, this appears to be a very real issue for many, possible all, Mac OSX users running MySQL servers. If this platform is to be considered a genuinely supported platform for MySQL, then the repeatable bug when the open table cache number gets to around 1000 should be investigated and addressed. I'd be delighted if a MySQL representative can give some reassurance that this is being taken seriously. It's a real issue affecting a lot of users. Regards, Paul
[17 Apr 2015 0:18]
Kris Iyer
Just wrapping up with #perconalive 2015. From talking to people it seems like a lot of folks are running into this and infact i find most of the developers in the community using a macbook. Likely just working around this bug. Mentioned this to a couple of folks who work closely with the bug database. Hopefully gets some attention soon.
[3 May 2015 23:15]
Bryce Boe
Reliably reproduces the issue described by Bug #71960
Attachment: mysql_issue.sh (application/octet-stream, text), 695 bytes.
[3 May 2015 23:40]
Bryce Boe
I've attached a file (http://bugs.mysql.com/file.php?id=22683&bug_id=71960) that reliably reproduces this issue by creating a large number of tables. None of the suggested work-arounds remove the problem save for disabling `innodb_file_per_table`, which is not ideal. I have verified I can increase my processes' available file descriptors, and I have attempted to limit the `table_open_cache` size. In any case where innodb_file_per_table is enabled, my mysql server becomes unresponsive usually between creating table #2200 and #2300. After which point mysql is completely unresponsive as it will not accept additional connections.
[28 Jul 2015 2:20]
C asd
I'm having the same issue. A workaround would help a ton. Thanks for your time.
[7 Aug 2015 17:58]
Mark Moran
Still persists at 5.6.25. Limiting the table_open_cache to 500 has held it off, but if I go above 500 the error returns.
[9 Nov 2015 17:58]
James Kemmerer
Several quick notes on this bug. Note 1 of 2 We installed 5.6.26 and the BUG IS STILL PRESENT. The bug fixes noted above added to my.cnf still serve as a work around: sql_mode=NO_ENGINE_SUBSTITUTION table_open_cache = 500
[9 Nov 2015 18:02]
James Kemmerer
Note 2 of 2 With great excitement and anticipation we installed 5.7.9 last week hoping to finally put this bug to rest. IT APPEARS THIS BUG PERSISTS IN 5.7 We have had results similar to those mentioned above for 5.6.x. Our new install of 5.7.9 seems to go down and refuse connections in a manner similar to 5.6. We are proceeding with applying and testing the fixes / work arounds used for 5.6. We'll let you know if either or both of these modifications to your my.cnf are necessary. sql_mode=NO_ENGINE_SUBSTITUTION table_open_cache = 500 Fingers crossed that these work, otherwise we'll have to develop an entirely new work around for this long lived and nasty bug.
[23 Dec 2015 19:20]
Richard Glaser
We are seeing on our JAMF Software Server (JSS) running OS X 10.10.5 “Yosemite” with Server application version 5.0.15, we have seen under heavy workload with MySQL version 14.14 distribution 5.6.24 is it throws connection errors “Lost connection to MySQL server at ‘sending authentication information’, system error: 32”. Primarily we noticed errors during scheduled JSS database backup using the JSS Database Utility. A workaround was modifying the "my.cnf" file. /usr/local/mysql/my.cnf And Under the |mysqld| section, add the following three variables: innodb_file_per_table = OFF table_definition_cache = 400 table_open_cache = 400 And restarted MySQL and it seems to temporarily resolved the issue. I have a blog post that gives details: https://apple.lib.utah.edu/?p=511
[7 Mar 2016 18:28]
Jeff Grisso
This bug is afflicting our environment as well. It has severely impacted performance of our JAMF Software Casper server that is running on OS X. We're able to raise the table_open_cache to 1000. Anything higher and mySQL will destabilize.
[2 May 2017 16:34]
K Crawford
mysqltuner advises against the workarounds we have to put in place due to this issue.