From e4827408f317c2423f430733ffbbe8a9ca23e5ac Mon Sep 17 00:00:00 2001 From: Jarrod Johnon Date: Mon, 15 Sep 2014 10:03:08 -0400 Subject: [PATCH] Avoid recursing between keepalive and raw_command On June 10 2014 one condition was addressed that caused infinite recursion. Then it was an invalid timer that could fire in the midst of a command. The case where this could validly occur was overlooked. Address this by deferring invocation of keepalives until after command exits. If incommand indicated activity advances timeout in non custom keepalive case, then the keepalive timer will actually be correctly advanced. Change-Id: Iebe0241c1f928c4187f167f3ffa407f8c6f7fa84 --- 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 a20bbfc3..f8a4f444 100644 --- a/pyghmi/ipmi/private/session.py +++ b/pyghmi/ipmi/private/session.py @@ -944,7 +944,9 @@ class Session(object): sessionstodel = [] sessionstokeepalive = [] for session, parms in cls.keepalive_sessions.iteritems(): - if parms['timeout'] < curtime: + # if the session is busy inside a command, defer invoking keepalive + # until incommand is no longer the case + if parms['timeout'] < curtime and not session.incommand: cls.keepalive_sessions[session]['timeout'] = \ _monotonic_time() + 25 + (random.random() * 4.9) sessionstokeepalive.append(session)