From f6386e42fa2a03ad16fe79b9cc588cfb413f2818 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Wed, 28 Oct 2015 10:35:33 -0400 Subject: [PATCH] Fix raw_command hang when externally 'broken' or 'logged out' When something requests logout in the middle of a command request, bail out with 'session no longer connected' rather than infinite loop waiting for lastresponse which should never come. Change-Id: I9a8592a72b687f90bc044bbe48fd87d79b35d780 --- pyghmi/ipmi/private/session.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pyghmi/ipmi/private/session.py b/pyghmi/ipmi/private/session.py index 22193469..c2ae8723 100644 --- a/pyghmi/ipmi/private/session.py +++ b/pyghmi/ipmi/private/session.py @@ -626,10 +626,12 @@ class Session(object): #of only the constructor needing a callback. From then on, #synchronous usage of the class acts in a greenthread style governed by #order of data on the network - while retry and self.lastresponse is None: + while retry and self.lastresponse is None and self.logged: Session.wait_for_rsp(timeout=timeout) lastresponse = self.lastresponse self.incommand = False + if lastresponse is None: + raise exc.IpmiException('Session no longer connected') return lastresponse def _send_ipmi_net_payload(self, netfn=None, command=None, data=[], code=0,