diff --git a/releasenotes/notes/disable-conn-pooling-3456782afe56ac94.yaml b/releasenotes/notes/disable-conn-pooling-3456782afe56ac94.yaml new file mode 100644 index 00000000..9dadcfd3 --- /dev/null +++ b/releasenotes/notes/disable-conn-pooling-3456782afe56ac94.yaml @@ -0,0 +1,8 @@ +--- +fixes: + - | + Disable HTTP connection pooling by asking HTTP server to close our + connection right upon use. The rationale is that some BMC observed in + the wild seem to close persistent connections abruptly upon eventual + re-use failing completely unrelated operation. So in ``sushy`` we + just try not to maintain persistent connections with BMC at all. diff --git a/sushy/connector.py b/sushy/connector.py index d507f682..31508f9e 100644 --- a/sushy/connector.py +++ b/sushy/connector.py @@ -31,6 +31,13 @@ class Connector(object): self._verify = verify self._session = requests.Session() self._session.verify = self._verify + + # NOTE(etingof): field studies reveal that some BMCs choke at + # long-running persistent HTTP connections (or TCP connections). + # By default, we ask HTTP server to shut down HTTP connection we've + # just used. + self._session.headers['Connection'] = 'close' + if username or password: LOG.warning('Passing username and password to Connector is ' 'deprecated. Authentication is passed through '