From 976cba61331702e1a8e4781af478fa4676afd13d Mon Sep 17 00:00:00 2001 From: Slawek Kaplonski Date: Thu, 17 Jun 2021 15:40:20 +0200 Subject: [PATCH] Force to close http connection after notify about HA router status Neutron-keepalived-state-change-monitor process is using HTTP to notify L3 agent that state of the HA router was changed. It is done through unix socket. With HTTP 1.1 connection isn't closed properly and if router's state was changed more than once in short time, it could happen that wsgi worker on the L3 agent's side didn't process second request at all. That caused problem with transitioning router to master state after creation. Request to close connection should be explicitly defined in the header [1] and this patch adds "connection: close" header to the headers send in such request to do exactly that. [1] https://www.geeksforgeeks.org/http-headers-connection/ Closes-Bug: #1923633 Change-Id: Ic08ca5b167db4884efa07112cf9a6c3637e1b827 --- neutron/agent/l3/keepalived_state_change.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/neutron/agent/l3/keepalived_state_change.py b/neutron/agent/l3/keepalived_state_change.py index 1bbdfc52c89..eb0650b6cf5 100644 --- a/neutron/agent/l3/keepalived_state_change.py +++ b/neutron/agent/l3/keepalived_state_change.py @@ -150,7 +150,8 @@ class MonitorDaemon(daemon.Daemon): # the URL doesn't matter. 'http://127.0.0.1/', headers={'X-Neutron-Router-Id': self.router_id, - 'X-Neutron-State': state}, + 'X-Neutron-State': state, + 'Connection': 'close'}, connection_type=KeepalivedUnixDomainConnection) if resp.status != 200: