[jboss-jira] [JBoss JIRA] (DROOLS-1014) Drools OOM when loading session

Artur Kronenberg (JIRA) issues at jboss.org
Tue Dec 22 10:10:00 EST 2015


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

Artur Kronenberg edited comment on DROOLS-1014 at 12/22/15 10:09 AM:
---------------------------------------------------------------------

Hi Mario,

I checked and I have these arguments for my run configuration:

-Xms1024m -Xmx2048m

I would expect that 2 GB should be enough for my current setup. Just a bit more info:

I noted, that this also happens when I run fireAllRules(). It bombs out with this exception: http://pastebin.com/J7cP60fh

It prints this message to the console and then hangs until the exception occurs:

Hibernate: update SessionInfo set lastModificationDate=?, rulesByteArray=?, startDate=?, OPTLOCK=? where id=? and OPTLOCK=?

I will attempt to write something reproduceable, but I can post a snippet of what it looks like what I am doing:

persistence.xml: http://pastebin.com/64AVNKG0

My KieServiceFactory:  http://pastebin.com/9U7KhBah
This essentially sets up my kie environment so I can quickly create sessions if needed etc. It mainly lives there for guice reasons because dependency injection and PrivateModules needed this (I think the class should not be called a factory but yeah ..) 

My Sessionfacade, responsible for creating sessions. It does so by getOrCreate. I store the ID of the session I want in a different table. If a session by my name exist, I load it, if not I create it: 
http://pastebin.com/Sx6p6dcY

And finally a transaction helper I use to insert a lot of events/facts or do anything with session. Basically each time I do a insert/delete command on a session or entrypoint, I wrap the call into my TransactionHelper. I do wonder if I need to do the same for fireAllRules, but I believe drools internally handles the transactions for me with safe points:
http://pastebin.com/2HETaWQY

The SessionHolder object is an internal representation. It acts as a delegate that internally stores some stuff like what events have been submitted to what entrypoints, or delete etc or when the session has been created. It's purely for reporting and has no functionality other than delegating to the actual session. 

If I am using this incorrectly, I apologise. I couldn't find much more details on how to use the JPA stuff. If I run the same with less objects (for example 20 instead of 6k+ I have no issues loading and storing the session). 

I do wonder if I need the JTA stuff at all, but I believe it's mandatory to use JPA with drools. From the stacktraces though it does not appear to be a transaction issue. 

EDIT:

forgot, this is how I insert and execute the session rules: 
http://pastebin.com/Kz6kFhpC

I can not use fireUntilHalt because of the JPA aspect, so I do it manually every time anything changes with my session.


was (Author: pandaadb):
Hi Mario,

I checked and I have these arguments for my run configuration:

-Xms1024m -Xmx2048m

I would expect that 2 GB should be enough for my current setup. Just a bit more info:

I noted, that this also happens when I run fireAllRules(). It bombs out with this exception: http://pastebin.com/J7cP60fh

It prints this message to the console and then hangs until the exception occurs:

Hibernate: update SessionInfo set lastModificationDate=?, rulesByteArray=?, startDate=?, OPTLOCK=? where id=? and OPTLOCK=?

I will attempt to write something reproduceable, but I can post a snippet of what it looks like what I am doing:

persistence.xml: http://pastebin.com/64AVNKG0

My KieServiceFactory:  http://pastebin.com/9U7KhBah
This essentially sets up my kie environment so I can quickly create sessions if needed etc. It mainly lives there for guice reasons because dependency injection and PrivateModules needed this (I think the class should not be called a factory but yeah ..) 

My Sessionfacade, responsible for creating sessions. It does so by getOrCreate. I store the ID of the session I want in a different table. If a session by my name exist, I load it, if not I create it: 
http://pastebin.com/Sx6p6dcY

And finally a transaction helper I use to insert a lot of events/facts or do anything with session. Basically each time I do a insert/delete command on a session or entrypoint, I wrap the call into my TransactionHelper. I do wonder if I need to do the same for fireAllRules, but I believe drools internally handles the transactions for me with safe points:
http://pastebin.com/2HETaWQY

The SessionHolder object is an internal representation. It acts as a delegate that internally stores some stuff like what events have been submitted to what entrypoints, or delete etc or when the session has been created. It's purely for reporting and has no functionality other than delegating to the actual session. 

If I am using this incorrectly, I apologise. I couldn't find much more details on how to use the JPA stuff. If I run the same with less objects (for example 20 instead of 6k+ I have no issues loading and storing the session). 

I do wonder if I need the JTA stuff at all, but I believe it's mandatory to use JPA with drools. From the stacktraces though it does not appear to be a transaction issue. 


> Drools OOM when loading session
> -------------------------------
>
>                 Key: DROOLS-1014
>                 URL: https://issues.jboss.org/browse/DROOLS-1014
>             Project: Drools
>          Issue Type: Bug
>          Components: core engine
>    Affects Versions: 6.3.0.Final
>         Environment: Mac OS 10.10.5, Eclipse Mars Release, Java 1.8, Drools 6.3.0.Final
>            Reporter: Artur Kronenberg
>            Assignee: Mario Fusco
>            Priority: Critical
>
> I ran into an issue loading the session from my JPA.
> I am getting this stacktrace:
> http://pastebin.com/PMKpdBWM
> This is happening for this rule: 
> http://pastebin.com/HZmLmsEH
> And this module:
> http://pastebin.com/2Q6k73tC
> What I am doing is: 
> 1. Create a new session
> 2. Insert an ApplicationEvent 
> 3. fireAllRules
> 4. Reload -> OOM 
> The ApplicationEvent has a list of 6345 facts in there. I load them from a CSV file, and use drools to insert them into my knowledge base as facts. 
> When I restart my server and have the session reloaded, it ooms when trying to deserialize the session. 
> I am still looking for a workaround. I am not sure what is happening and could not find any more info at this point.
> I am using:
> JPA + Hibernate 4.2.21.Final
> org.codehaus.btm:btm:2.1.4 as a standalone JTA platform 
> Let me know if there's any other info needed.
> Thanks,
> Artur



--
This message was sent by Atlassian JIRA
(v6.4.11#64026)


More information about the jboss-jira mailing list