Disable HTTP connection pooling
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.
Story: 2006336
Task: 36084
Change-Id: I721c6284b938d5a47dbe0b298467c15ca4bd1517
(cherry picked from commit 84e085f9a2
)
This commit is contained in:
parent
f598e2935b
commit
efadfc7620
|
@ -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.
|
|
@ -31,6 +31,13 @@ class Connector(object):
|
||||||
self._verify = verify
|
self._verify = verify
|
||||||
self._session = requests.Session()
|
self._session = requests.Session()
|
||||||
self._session.verify = self._verify
|
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:
|
if username or password:
|
||||||
LOG.warning('Passing username and password to Connector is '
|
LOG.warning('Passing username and password to Connector is '
|
||||||
'deprecated. Authentication is passed through '
|
'deprecated. Authentication is passed through '
|
||||||
|
|
Loading…
Reference in New Issue