From 7ee86b3e8500df682c5a3ecc0234d4730344d9e7 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Tue, 29 Mar 2016 15:26:42 -0400 Subject: [PATCH] Remove event related memory leak It was possible for a session to accumulate a plurality of events per raw_command issued. Alter the behavior of session to set and discard *all* pending events on exit. This means that if there are multiple commands waiting, then things will be a tad more work than is strictly necessary, but it's the simplest way to eliminate the leak, the amount of senseless work is pretty small even in some pretty tortuous cases, and it only has any impact when many commands are being hit against same target concurrently without coordination, which is rare. Change-Id: I3f023cee6fc7bb537c1a508d3113f2ff238828de --- pyghmi/ipmi/private/session.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyghmi/ipmi/private/session.py b/pyghmi/ipmi/private/session.py index f1c9684c..2185a8ed 100644 --- a/pyghmi/ipmi/private/session.py +++ b/pyghmi/ipmi/private/session.py @@ -680,7 +680,7 @@ class Session(object): self.incommand = False if retry and lastresponse is None: raise exc.IpmiException('Session no longer connected') - if self.evq: + while self.evq: self.evq.popleft().set() return lastresponse