From e167ee6a470a81c81b99f1e11e75a6d4cede03ff Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Fri, 13 Jun 2014 09:37:58 -0400 Subject: [PATCH] Fix concurrent raw_command calls to Session If two contexts call raw_command concurrently, there was a scenario where the first to transmit has its result overwritten by the next to send and corrupts the results of the first command. One scenario where this was encountered was when a get health call was being serviced at the same moment SOL attempted to open a console, causing one of the get sensor readings to complain that 'SOL was already active'. Address it by storing away lastresponse in a more context specific place before deasserting 'incommand' and remove instances that deasserted it earlier. Change-Id: I504da3f54562a4b65b8f4e9e20c19aed9d21a09f --- pyghmi/ipmi/private/session.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pyghmi/ipmi/private/session.py b/pyghmi/ipmi/private/session.py index 8951d87d..fad354f4 100644 --- a/pyghmi/ipmi/private/session.py +++ b/pyghmi/ipmi/private/session.py @@ -572,7 +572,9 @@ class Session(object): #order of data on the network while retry and self.lastresponse is None: Session.wait_for_rsp(timeout=timeout) - return self.lastresponse + lastresponse = self.lastresponse + self.incommand = False + return lastresponse def _send_ipmi_net_payload(self, netfn, command, data, bridge_request=None, retry=True, delay_xmit=None): @@ -1326,7 +1328,6 @@ class Session(object): self.send_payload(payload=nextpayload, payload_type=nextpayloadtype, retry=retry) - self.incommand = False self.ipmicallback(response) def _timedout(self): @@ -1337,7 +1338,6 @@ class Session(object): if self.timeout > self.maxtimeout: response = {'error': 'timeout'} self.ipmicallback(response) - self.incommand = False self.nowait = False self._mark_broken() return