Bug #48120 proxy doesn't increase the hard limit when max-open-files is used
Submitted: 16 Oct 2009 16:06 Modified: 9 Jan 2015 10:35
Reporter: Matthew Lord Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Proxy Severity:S3 (Non-critical)
Version:2.0.x, 2.1.x OS:Any (doesn't affect windows )
Assigned to: Jan Kneschke CPU Architecture:Any
Tags: open files, rlimit

[16 Oct 2009 16:06] Matthew Lord
Description:
I would like to see us increase the soft _and_ hard limit for open files when
max-open-files is specified (this is what mysqld_safe does with it's unlimit -n X system call).

This would help to completely eliminate the common problem of running out of 
available FDs and encountering the "all backends are down" errors.

Increasing the hard limit shouldn't be a problem since we're running as root 
when we make the setrlimit call.  This will avoid the need to mess with anything
else, such as /etc/security/limits.conf on linux, in order to increase the
open files limit beyond the default soft limit (which was 4,000 on my linux
machine).

How to repeat:
N/A

Suggested fix:
--- chassis.c   2009-10-14 17:44:12.000000000 -0400
+++ chassis-mlord.c     2009-10-16 12:05:10.000000000 -0400
@@ -1091,9 +1091,12 @@
                                  G_STRLOC, g_strerror(errno), errno);
        } else {
                rlim_t soft_limit = max_files_rlimit.rlim_cur;
+               rlim_t hard_limit = max_files_rlimit.rlim_max;
+
                g_debug("%s: current RLIMIT_NOFILE = %llu (hard: %llu)", G_STRLOC, max_files_rlimit.rlim_cur, max_files_rlimit.rlim_max);
 
                max_files_rlimit.rlim_cur = max_files_number;
+               max_files_rlimit.rlim_max  = max_files_number;
 
                g_debug("%s: trying to set new RLIMIT_NOFILE = %llu (hard: %llu)", G_STRLOC, max_files_rlimit.rlim_cur, max_files_rlimit.rlim_max);
                if (-1 == setrlimit(RLIMIT_NOFILE, &max_files_rlimit)) {
[24 Mar 2010 15:26] Enterprise Tools JIRA Robot
Jan Kneschke writes: 
revno: 1027
committer: jan@mysql.com
branch nick: trunk
timestamp: Wed 2010-03-24 16:24:51 +0100
message:
  try to raise the hard-limit to at least the soft-limit (fixes #48120) and made the log-messages 'unlimited' aware
[30 Nov 2010 13:56] Enterprise Tools JIRA Robot
Mark Leith writes: 
This has been available for some time in various builds now. 

Please test against latest 2.2/2.3.