diff --git a/lib/core/option.py b/lib/core/option.py index 08a561550..0c870515a 100644 --- a/lib/core/option.py +++ b/lib/core/option.py @@ -101,6 +101,7 @@ from lib.core.settings import INJECT_HERE_MARK from lib.core.settings import IS_WIN from lib.core.settings import LOCALHOST from lib.core.settings import MAXDB_ALIASES +from lib.core.settings import MAX_CONNECT_RETRIES from lib.core.settings import MAX_NUMBER_OF_THREADS from lib.core.settings import MSSQL_ALIASES from lib.core.settings import MYSQL_ALIASES @@ -1431,6 +1432,9 @@ def _cleanupOptions(): else: kb.adjustTimeDelay = ADJUST_TIME_DELAY.DISABLE + if conf.retries: + conf.retries = min(conf.retries, MAX_CONNECT_RETRIES) + if conf.code: conf.code = int(conf.code) diff --git a/lib/core/settings.py b/lib/core/settings.py index c30a78d99..b48ff383a 100644 --- a/lib/core/settings.py +++ b/lib/core/settings.py @@ -490,6 +490,9 @@ GENERIC_DOC_ROOT_DIRECTORY_NAMES = ("htdocs", "wwwroot", "www") # Maximum length of a help part containing switch/option name(s) MAX_HELP_OPTION_LENGTH = 18 +# Maximum number of connection retries (to prevent problems with recursion) +MAX_CONNECT_RETRIES = 100 + # Strings for detecting formatting errors FORMAT_EXCEPTION_STRINGS = ("Type mismatch", "Error converting", "Failed to convert", "System.FormatException", "java.lang.NumberFormatException")