BZ-1044529 Memory leak from getStatefulKnowledgeSessions (cherry picked from commit 9645cf09ee90db62b9c181ae79c8a0d65efac856)