[jboss-jira] [JBoss JIRA] (DROOLS-498) Memory leak in stateful session after retracting facts

Massinissa BOUZIAD (JIRA) issues at jboss.org
Tue Sep 9 06:11:00 EDT 2014


    [ https://issues.jboss.org/browse/DROOLS-498?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13000220#comment-13000220 ] 

Massinissa BOUZIAD commented on DROOLS-498:
-------------------------------------------

Hi,

When I try to delete a fact through its facthandle and then call to fireAllRules, the rules still continue to match on the deleted fact.
I'm using StateFullSession.
My code looks like that : 

{code:java}
                        KieSession ksession = newSession();
			FactHandle baksetFactHandle = ksession.insert(basket);
			
			// Control the activation flow by group
			Agenda agenda = ksession.getAgenda();
			agenda.getAgendaGroup("apply-result").setFocus();
			agenda.getAgendaGroup("basket").setFocus();
			agenda.getAgendaGroup("apply-result").setFocus();
			agenda.getAgendaGroup("lines").setFocus();

			long startTime = System.currentTimeMillis();
			ksession.fireAllRules();

			if (LOGGER.isDebugEnabled()) {
				long duration = System.currentTimeMillis() - startTime;
				LOGGER.debug("Drools basket evaluation in : {} milliseconds", duration);
			}
			
			//Remove basket from session before returning the session to the pool
			ksession.delete(baksetFactHandle);
			List<Advantage> advantages = (List<Advantage>)ksession.getGlobal("advantages");	
{code}

This code is called on a per customer basis and state full session are reused.
But between two subsequent call, I get the same result as the previous call doesn't actually delete the customer basket from the session.

Need help !







> Memory leak in stateful session after retracting facts
> ------------------------------------------------------
>
>                 Key: DROOLS-498
>                 URL: https://issues.jboss.org/browse/DROOLS-498
>             Project: Drools
>          Issue Type: Bug
>    Affects Versions: 6.0.1.Final
>            Reporter: Vitaly Lomov
>            Assignee: Mario Fusco
>            Priority: Critical
>             Fix For: 6.1.0.Final
>
>         Attachments: gcRoot.png, memory-leak2.zip, screenshot1.png
>
>
> After adding many simple facts into the stateful session and then removing them, the factHandles for the removed facts are still referenced by the session. Eventually getting "java.lang.OutOfMemoryError: GC overhead limit exceeded" with the stack trace (sometimes) similar to DROOLS-411.
> Someone on StackOverflow suggested iterating through whatever factHandles remain after deletion and delete those, but I get no factHandles (correct, since I removed all facts).
> See screenshot for objects in memory _after_ deleting all facts.



--
This message was sent by Atlassian JIRA
(v6.3.1#6329)


More information about the jboss-jira mailing list