Gaurav | 1 Apr 2010 01:17
Picon

(Urgent) Runtime error: java.lang.RuntimePermission createClassLoader


Hi All,

I need urgent help in resolving this run time error. 
This is the first time we are deploying drools to websphere 6.1 and getting
following error.

Our organization does not allow us to do 'createClassLoader' in was.policy.
Can some one please help.

java.security.AccessControlException: Access denied
(java.lang.RuntimePermission createClassLoader)
	at
java.security.AccessController.checkPermission(AccessController.java:108)
	at java.lang.SecurityManager.checkPermission(SecurityManager.java:558)
	at
com.ibm.ws.security.core.SecurityManager.checkPermission(SecurityManager.java:212)
	at
java.lang.SecurityManager.checkCreateClassLoader(SecurityManager.java:620)
	at java.lang.ClassLoader.<init>(ClassLoader.java:136)
	at
org.drools.rule.CompositeClassLoader.<init>(CompositeClassLoader.java:16)
	at org.drools.compiler.PackageBuilder.<init>(PackageBuilder.java:249)
	at org.drools.compiler.PackageBuilder.<init>(PackageBuilder.java:142)
	at
org.drools.builder.impl.KnowledgeBuilderProviderImpl.newKnowledgeBuilder(KnowledgeBuilderProviderImpl.java:29)
	at
org.drools.builder.KnowledgeBuilderFactory.newKnowledgeBuilder(KnowledgeBuilderFactory.java:29)

Thanks,
(Continue reading)

miguel machado | 1 Apr 2010 01:24
Picon
Gravatar

Re: drools expert: memory issues

Hi there,

First of all, thank you for your detailed and quick response. Next...

2010/3/31 Edson Tirelli <ed.tirelli <at> gmail.com>

    Miguel,

    First we need to understand where is this memory spent. Drools externalizes the actual rule compilation to a java compiler (JDT or Janino) and I would not be surprised if compiling 2100 rules would consume more than 300Mb **during compilation**. I don't think that after compiling, the application will continue to use that amount of memory just because of rules, although if you have many facts being inserted into your session, it obviously will drive consumption up.

I usually load into memory 2~4 facts each time, very small objects. I then "fire all rules" and immediately retract and dispose.
 

    So, some questions:

1. Do you use one KnowledgeBuilder to compile all your rule files or do you use one KnowledgeBuilder per file?

Just one, declared as a static variable.
 
2. How much memory is your application using during this step, where you add resources to your knowledgeBuilder(s)?

Its taking about ±20 MB just before it reads the DRL file, it then takes 5~10s for loading rules into memory and immediately after that line its taking +300MB.. kinda stabilizes afterwards.
 
3. After compiling your knowledge packages, did you tried to force a GC to check how much memory it continues to use?

Just tested that, it barely makes a difference :-/ (less than 5MB saved)
 
4. Are you adding all rules to the same KnowledgeBase or using one kbase per set of rules? How much memory are you consuming in this step?

Most of the time, i've been testing with only one rule file with +2100 rules and for that i create a single knowledge base, from which i create the ksession. However, the whole system i'm developing has another component of event analysis so eventually i'll be testing two separate threads doing similar things but on different DRL files. I suppose i'll be using two kbase's, one for each file...

This is the step where memory usage increases dramatically:

 

5. Did you tried compiling it once, generating the kbase and serializing it to a file, and then, instead of recompiling everything, just deserialize the file into memory and using it? How much memory it consumes when you deserialize from a file?

Not sure what you mean there, is it this: http://downloads.jboss.com/drools/docs/5.0.1.26597.FINAL/drools-expert/html_single/index.html#d0e1070 ? if so, yes, i've tried it and noticed no difference at all, was i supposed to?
 

   Knowing the answer to the above questions will help to determine if you have a problem and how to work around it or fix it.

thanks for your help so far. Any help is very much appreciated.

_ miguel


--
"To understand what is recursion you must first understand recursion"
_______________________________________________
rules-users mailing list
rules-users <at> lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
Caine Lai | 1 Apr 2010 01:54
Picon

Status of Drools 5.1 M2?

I've been patiently awaiting the release of Drools 5.1 M2 so I can start using it in a new Spring based SAAS project we are launching.  The new features in 5.1 have me drooling (sorry, couldn't resist).

I've found the following information on a tentative release for 5.1 M2, but it was weeks ago:  http://n3.nabble.com/Drools-Roadmap-Planned-Release-5-1-release-date-td60252.html.

Does anyone have a status update on when we can expect a 5.1 M2 release?

Thanks,
Caine

_______________________________________________
rules-users mailing list
rules-users <at> lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
eljefe | 1 Apr 2010 04:03
Picon

Drools Flow Error Question


I have created a simple flow that goes Start -> Human Task -> End. Within the
code to run it I assigned the default WSHumanTaskHandler. However when I try
running the program I receive an error saying the Handler failed to connect.
Do you guys have any idea what could be causing the problem? 
--

-- 
View this message in context: http://n3.nabble.com/Drools-Flow-Error-Question-tp689838p689838.html
Sent from the Drools - User mailing list archive at Nabble.com.
_______________________________________________
rules-users mailing list
rules-users <at> lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

Salaboy | 1 Apr 2010 04:11
Picon
Gravatar

Re: Drools Flow Error Question

Did you start the task server?

- Ing. Mauricio Salatino -

On Mar 31, 2010, at 23:03, eljefe <edenael20 <at> gmail.com> wrote:

>
> I have created a simple flow that goes Start -> Human Task -> End.  
> Within the
> code to run it I assigned the default WSHumanTaskHandler. However  
> when I try
> running the program I receive an error saying the Handler failed to  
> connect.
> Do you guys have any idea what could be causing the problem?
> -- 
> View this message in context: http://n3.nabble.com/Drools-Flow-Error-Question-tp689838p689838.html
> Sent from the Drools - User mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users <at> lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
_______________________________________________
rules-users mailing list
rules-users <at> lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

tolitius | 1 Apr 2010 07:43
Picon

Re: Drools Flow Error Question


 <at> eljefe,

    If you look at the source code of WSHumanTaskHandler, the first thing it
tries to do is to connect to the Mina Server (via Mina Client):

	   public void executeWorkItem(WorkItem workItem, WorkItemManager manager)
{
>>>>		        connect();
		Task task = new Task();
                 // other stuff
           }

    here is the connect method (within WSHumanTaskHandler):

	public void connect() {

             client = new MinaTaskClient(
"org.drools.process.workitem.wsht.WSHumanTaskHandler",
                                                      new
TaskClientHandler(SystemEventListenerFactory.getSystemEventListener() ) );
		}
	}

"WSHumanTaskHandler" is tightly coupled with MinaServer to implement the
WS-HumanTask standard (that defines a lifecycle of the Human Task),
therefore, the only way to use out of the box "WSHumanTaskHandler", is to
start the MinaServer:

MinaTaskServer server = new MinaTaskServer(taskService);
    Thread thread = new Thread(server);
    thread.start();
    Thread.sleep(500);

You can read more about it in Drools Flow documentation, but it is a bit
high level, so also take a look at the practical approach:
http://www.packtpub.com/article/drools-jboss-rules-5.0-flow-part2

/Anatoly
--

-- 
View this message in context: http://n3.nabble.com/Drools-Flow-Error-Question-tp689838p690119.html
Sent from the Drools - User mailing list archive at Nabble.com.
_______________________________________________
rules-users mailing list
rules-users <at> lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

Wolfgang Laun | 1 Apr 2010 08:27
Picon

Re: drools expert: memory issues

2010/4/1 miguel machado <mls.machado <at> gmail.com>:
>
> 2010/3/31 Edson Tirelli <ed.tirelli <at> gmail.com>
>>
>> 1. Do you use one KnowledgeBuilder to compile all your rule files or do
>> you use one KnowledgeBuilder per file?
>
> Just one, declared as a static variable.

That wastes, whatever the KB takes, for the remaining duration of the program
execution. After you have taken the compiled packages from the KB and
checked for errors, the KB has done his duty the KB can go :-)

>>
>> 5. Did you tried compiling it once, generating the kbase and serializing
>> it to a file, and then, instead of recompiling everything, just deserialize
>> the file into memory and using it? How much memory it consumes when you
>> deserialize from a file?
>
> Not sure what you mean there, is it
> this: http://downloads.jboss.com/drools/docs/5.0.1.26597.FINAL/drools-expert/html_single/index.html#d0e1070 ?
> if so, yes, i've tried it and noticed no difference at all, was i supposed
> to?

For the application that just does the load part (reading the KPs from
an input stream), yes: that
should reduce memory usage.

It certainly does not, if your KB is static, and you compile and load
in the same program,
just serializing and deserializing in between.

-W

_______________________________________________
rules-users mailing list
rules-users <at> lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

Jevon Wright | 1 Apr 2010 09:52
Gravatar

Re: drools expert: memory issues

Hi Miguel,

I assume that you've used a memory analyzer to find out conclusively that the memory usage is by Drools, and not a memory leak?

One way to do this is to limit the virtual memory to a small amount, add -XX:+HeapDumpOnOutOfMemoryError to your environment, and then using Memory Analyzer to analyse the dump.

Cheers
Jevon

On Wed, Mar 31, 2010 at 2:44 AM, Miguel Machado <mls.machado <at> gmail.com> wrote:
hi all,

I'm quite new to the drools rule engine and i've been using it for a project where i need to filter events and execute actions accordingly.

I'm currently running a DRL file and creating a stateful session from it, and then running 2/3 facts every time. Every X seconds I collect the available facts and call fireAllRules() + dispose(), always within the same session. The DRL file has circa 2160 rules declared (an external program is producing them), and i'm using the "no-loop", "lock-on-active", "activation-group" and "agenda-group" options on almost every one.

My main problem is that the software is consuming too much memory when it loads the rules to the knowledge base variable, it reaches +300Mb which is just not affordable in this project. Is there any way i can work around this? I've tried setting some configuration properties but to no avail. What techniques may i try in order to reduce memory load on drools startup? What would be the best approach for dealing with so many rules?

Anything would help, thanks in advance,

_ miguel


_______________________________________________
rules-users mailing list
rules-users <at> lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

_______________________________________________
rules-users mailing list
rules-users <at> lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
miguel machado | 1 Apr 2010 12:31
Picon
Gravatar

Re: drools expert: memory issues

Hi there,

Actually that's a very good suggestion, i hadn't thought about that. Is there any heap inspector tool you'd recommend? 

In what comes to Wolfgang ideas, it makes sense what he said, but the truth is making the knowledge builder a static variable actually made memory usage lower (just a bit). I know it strikes as a surprise because one of the good practices in java is to reduce the variable/object scope as much as possible :-/ I'll try to investigate this further.

About the kbase serializing, i'll give it another try.

thanks for all support so far guys.
_ miguel



2010/4/1 Jevon Wright <jevon <at> jevon.org>
Hi Miguel,

I assume that you've used a memory analyzer to find out conclusively that the memory usage is by Drools, and not a memory leak?

One way to do this is to limit the virtual memory to a small amount, add -XX:+HeapDumpOnOutOfMemoryError to your environment, and then using Memory Analyzer to analyse the dump.

Cheers
Jevon

On Wed, Mar 31, 2010 at 2:44 AM, Miguel Machado <mls.machado <at> gmail.com> wrote:
hi all,

I'm quite new to the drools rule engine and i've been using it for a project where i need to filter events and execute actions accordingly.

I'm currently running a DRL file and creating a stateful session from it, and then running 2/3 facts every time. Every X seconds I collect the available facts and call fireAllRules() + dispose(), always within the same session. The DRL file has circa 2160 rules declared (an external program is producing them), and i'm using the "no-loop", "lock-on-active", "activation-group" and "agenda-group" options on almost every one.

My main problem is that the software is consuming too much memory when it loads the rules to the knowledge base variable, it reaches +300Mb which is just not affordable in this project. Is there any way i can work around this? I've tried setting some configuration properties but to no avail. What techniques may i try in order to reduce memory load on drools startup? What would be the best approach for dealing with so many rules?

Anything would help, thanks in advance,

_ miguel


_______________________________________________
rules-users mailing list
rules-users <at> lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


_______________________________________________
rules-users mailing list
rules-users <at> lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users




--
"To understand what is recursion you must first understand recursion"
_______________________________________________
rules-users mailing list
rules-users <at> lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
miguel machado | 1 Apr 2010 13:57
Picon
Gravatar

Re: How to do Exception Handling???

Hi,

I'm not sure this will help you out, but in what comes to the system i'm currently developing (using drools expert), i've got this method "runRuleEngine" that collects facts and fire rules on them and i am able to catch any sort of error within the drools execution by surrounding that with try {} catch (Exception e) {}. 

The important part is that it took me a while to figure that out cuz eclipse didn't force me handle that, as if the called method didn't have "throws" (it usually shows a compilation error otherwise, right?).

Just a thought.
_ miguel



On Wed, Mar 31, 2010 at 9:44 PM, nanic23 <nanic23 <at> hotmail.com> wrote:

I have a ruleflow that handles exceptions when they are raised by a "Fault"
node but I am not being able to accomplish the same if an exception is
thrown by a workItem or an action node instead.

I have a workItem node with a work item handler that throws a
RuntimeException. My exception handler in the composite node is not catching
this exception.

So, question
1) how can I handle runtime exceptions thrown by my workItemHandlers?
2) how can I get a hold of the exception to log the stack trace?

Any ideas or tips are very appreciated.

Nick.
--
View this message in context: http://n3.nabble.com/How-to-do-Exception-Handling-tp689387p689387.html
Sent from the Drools - User mailing list archive at Nabble.com.
_______________________________________________
rules-users mailing list
rules-users <at> lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users



--
"To understand what is recursion you must first understand recursion"
_______________________________________________
rules-users mailing list
rules-users <at> lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

Gmane