Bug #32222 max_connect_errors does not understand 0 as "unlimited"
Submitted: 9 Nov 2007 11:39 Modified: 9 Nov 2009 21:52
Reporter: Kristian Koehntopp Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: General Severity:S4 (Feature request)
Version:5.0.46 OS:Any
Assigned to: CPU Architecture:Any

[9 Nov 2007 11:39] Kristian Koehntopp
Description:
The configuration variable max_connect_errors does not understand 0 as "unlimited" or disable.

The recommended "high value" is not explained and complicated.

How to repeat:
See source, sql/sql_parse.cc:861:

 861       if (connect_errors > max_connect_errors)
 862         return(ER_HOST_IS_BLOCKED);

Suggested fix:
linux:/export/source/mysql-5.0.46 # !?diff
diff -u sql/sql_parse.cc.orig sql/sql_parse.cc
--- sql/sql_parse.cc.orig       2007-11-09 12:35:38.547240889 +0100
+++ sql/sql_parse.cc    2007-11-09 12:36:21.513926139 +0100
@@ -858,7 +858,7 @@
                                           HOSTNAME_LENGTH)]= 0;
         thd->main_security_ctx.host_or_ip= thd->main_security_ctx.host;
       }
-      if (connect_errors > max_connect_errors)
+      if (max_connect_errors != 0 && connect_errors > max_connect_errors)
         return(ER_HOST_IS_BLOCKED);
     }
     DBUG_PRINT("info",("Host: %s  ip: %s",
[11 Nov 2007 6:28] Valeriy Kravchuk
Thank you for a reasonable feature request and patch contributed.
[9 Nov 2009 21:52] James Day
Closing as a duplicate of bug #7695 which is a feature request. We have one private opinion expressed that zero is a valid choice meaning no failures allowed, so isn't suitable for use as meaning unlimited.

The current limits on the high value setting allow 13 failures per second for ten years on a 32 bit server and five billion failures per second on a 64 bit server.

I'm making a request to the documentation team to clarify the meaning of large value.