From 2c8076dd28c1e51e7d340d3ee5f9056b40396c0c Mon Sep 17 00:00:00 2001 From: Lewis Denny Date: Mon, 31 Jul 2023 16:38:22 +1000 Subject: [PATCH] Add max limit to agent_down_time The agent_down_time ends up being passed to an eventlet green-thread; under the hood, this uses a CPython C-types interface with a limitation of (2^32 / 2 - 1) INT_MAX (as defined in C) where int is usually 32 bits I have set the max value to (2^32 / 2 - 1)/1000 as agent_down_time configured in seconds, this ends up being 2147483. This patch is required as passing a larger number causes this error: OverflowError: timeout is too large If a user currently has a value larger than (2^32 / 2 - 1)/1000 set, Neutron Server will fail to start and will print out a very helpful error message. Conflicts: neutron/conf/agent/database/agents_db.py Closes-Bug: #2028724 Change-Id: Ib5b943344cddbd468c00768461ba1ee00a2b4c58 (cherry picked from commit 6fef1e65250dbda057206e1c2ee64f59b21d490f) --- neutron/conf/agent/database/agents_db.py | 5 +++++ .../notes/agent_down_time_max-af3b62763aaa2fe5.yaml | 6 ++++++ 2 files changed, 11 insertions(+) create mode 100644 releasenotes/notes/agent_down_time_max-af3b62763aaa2fe5.yaml diff --git a/neutron/conf/agent/database/agents_db.py b/neutron/conf/agent/database/agents_db.py index aad0582bf5a..90569e104d2 100644 --- a/neutron/conf/agent/database/agents_db.py +++ b/neutron/conf/agent/database/agents_db.py @@ -16,7 +16,12 @@ from neutron._i18n import _ from neutron.common import _constants AGENT_OPTS = [ + # The agent_down_time value can only be a max of INT_MAX (as defined in C), + # where int is usually 32 bits. The agent_down_time will be passed to + # eventlet in milliseconds and any number higher will produce an OverFlow + # error. More details here: https://bugs.launchpad.net/neutron/+bug/2028724 cfg.IntOpt('agent_down_time', default=75, + max=((2**32 / 2 - 1) // 1000), help=_("Seconds to regard the agent is down; should be at " "least twice report_interval, to be sure the " "agent is down for good.")), diff --git a/releasenotes/notes/agent_down_time_max-af3b62763aaa2fe5.yaml b/releasenotes/notes/agent_down_time_max-af3b62763aaa2fe5.yaml new file mode 100644 index 00000000000..ec221e2e05a --- /dev/null +++ b/releasenotes/notes/agent_down_time_max-af3b62763aaa2fe5.yaml @@ -0,0 +1,6 @@ +--- +fixes: + - | + The config option ``agent_down_time`` is now limited to a maximum value of + `2147483`, as neutron-server will fail to start if it is configured higher. + See bug `2028724 `_ for more information.