[JBoss JIRA] Created: (JBRULES-2381) NPE during usage after serialize/deserialize
by Justin Waugh (JIRA)
NPE during usage after serialize/deserialize
--------------------------------------------
Key: JBRULES-2381
URL: https://jira.jboss.org/jira/browse/JBRULES-2381
Project: Drools
Issue Type: Bug
Security Level: Public (Everyone can see)
Components: drools-core
Affects Versions: 5.0.1.FINAL
Environment: Windows XP / Server 2003, JDK 1.6
Reporter: Justin Waugh
Assignee: Mark Proctor
Attachments: test.zip
In our application we are often removing and adding new rules. We also have a requirement to serialize state so that we can continue across restarts. We've seen a few problems related to the state of the knowledgebase after serializing/deserializing related to removing rules. Both are NPE's, and from debugging into Drools, both seem to be a case of a deserialized transient value not being wired up correctly. In one case the reader field of ClassFieldReader is not wired, so the InternalReadAccessor is null, and in the other the expression field of EvalCondition is left null. I have not been able to reproduce in a simple test case the first problem, though it is easily reproduceable in our live system, but I was able to reproduce the second, and I've attached a test case to demonstrate it. Both only happen with the combination of removing rules and serialization/deserialization. If the rules are never removed, the problems do not exhibit themselves. Here are the 2 stack traces:
java.lang.NullPointerException
at org.drools.base.ClassFieldReader.getValueType(ClassFieldReader.java:96)
at org.drools.reteoo.CompositeObjectSinkAdapter.addObjectSink(CompositeObjectSinkAdapter.java:98)
at org.drools.reteoo.ObjectSource.addObjectSink(ObjectSource.java:143)
at org.drools.reteoo.AlphaNode.attach(AlphaNode.java:116)
at org.drools.reteoo.AlphaNode.attach(AlphaNode.java:120)
at org.drools.reteoo.builder.BuildUtils.attachNode(BuildUtils.java:160)
at org.drools.reteoo.builder.PatternBuilder.attachAlphaNodes(PatternBuilder.java:295)
at org.drools.reteoo.builder.PatternBuilder.attachPattern(PatternBuilder.java:117)
at org.drools.reteoo.builder.PatternBuilder.build(PatternBuilder.java:70)
at org.drools.reteoo.builder.GroupElementBuilder$AndBuilder.build(GroupElementBuilder.java:126)
at org.drools.reteoo.builder.GroupElementBuilder.build(GroupElementBuilder.java:73)
at org.drools.reteoo.builder.ReteooRuleBuilder.addSubRule(ReteooRuleBuilder.java:153)
at org.drools.reteoo.builder.ReteooRuleBuilder.addRule(ReteooRuleBuilder.java:126)
at org.drools.reteoo.ReteooBuilder.addRule(ReteooBuilder.java:118)
at org.drools.reteoo.ReteooRuleBase.addRule(ReteooRuleBase.java:362)
at org.drools.common.AbstractRuleBase.addRule(AbstractRuleBase.java:618)
at org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:662)
at org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:290)
at org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:488)
at org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:25)
java.lang.NullPointerException
at org.drools.rule.EvalCondition.createContext(EvalCondition.java:110)
at org.drools.reteoo.EvalConditionNode.createMemory(EvalConditionNode.java:231)
at org.drools.common.ConcurrentNodeMemories.createNodeMemory(ConcurrentNodeMemories.java:96)
at org.drools.common.ConcurrentNodeMemories.getNodeMemory(ConcurrentNodeMemories.java:75)
at org.drools.common.AbstractWorkingMemory.getNodeMemory(AbstractWorkingMemory.java:1534)
at org.drools.reteoo.EvalConditionNode.doRemove(EvalConditionNode.java:263)
at org.drools.common.BaseNode.remove(BaseNode.java:95)
at org.drools.reteoo.RuleTerminalNode.doRemove(RuleTerminalNode.java:360)
at org.drools.common.BaseNode.remove(BaseNode.java:95)
at org.drools.reteoo.ReteooBuilder.removeRule(ReteooBuilder.java:248)
at org.drools.reteoo.ReteooRuleBase.removeRule(ReteooRuleBase.java:366)
at org.drools.common.AbstractRuleBase.removeRule(AbstractRuleBase.java:712)
at org.drools.common.AbstractRuleBase.removePackage(AbstractRuleBase.java:640)
at org.drools.impl.KnowledgeBaseImpl.removeKnowledgePackage(KnowledgeBaseImpl.java:166)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years
[JBoss JIRA] Created: (JBRULES-2358) ClassNotFoundException when using "mvel" as a dialect
by stephane Brossier (JIRA)
ClassNotFoundException when using "mvel" as a dialect
-----------------------------------------------------
Key: JBRULES-2358
URL: https://jira.jboss.org/jira/browse/JBRULES-2358
Project: Drools
Issue Type: Bug
Security Level: Public (Everyone can see)
Affects Versions: 5.0.1.FINAL
Environment: OS: Macos X and Linux
JVM 1.6.0_15 from sun
Reporter: stephane Brossier
Assignee: Mark Proctor
I get a ClassNotFoundexception when using a very simple rule and test. The test dowloads a binary package from guvnor, containing one trivial rule. Then it creates a StatefulKnowledgeSession and insert 500 facts. The drl file uploaded on guvnor is:
--------------------------
package mytest.debug.rules
declare PerUserCount
num : long
profile : String
end
rule "Event"
dialect "java"
when
e: PerUserCount()
then
System.out.println("Possible spammer [p=" + e.getProfile() + "] : count = " + e.getNum());
end
----------------------------
When calling fireAll, i get an exception. Note that:
1) The exception does not show up right away-- it only comes after some of those facts got processed
2) If i change the dialect from default 'mvel" to "java" it works fine:
Exception in thread "main" java.lang.NoClassDefFoundError: mytest/debug/rules/PerUserCount
at ASMAccessorImpl_7377369041259611028980.getValue(Unknown Source)
at org.mvel2.optimizers.dynamic.DynamicGetAccessor.getValue(DynamicGetAccessor.java:66)
at org.mvel2.ast.ASTNode.getReducedValueAccelerated(ASTNode.java:99)
at org.mvel2.ast.BinaryOperation.getReducedValueAccelerated(BinaryOperation.java:102)
at org.mvel2.ast.BinaryOperation.getReducedValueAccelerated(BinaryOperation.java:102)
at org.mvel2.ast.BinaryOperation.getReducedValueAccelerated(BinaryOperation.java:102)
at org.mvel2.compiler.ExecutableAccessor.getValue(ExecutableAccessor.java:41)
at ASMAccessorImpl_7157329411259611028970.getValue(Unknown Source)
at org.mvel2.optimizers.dynamic.DynamicGetAccessor.getValue(DynamicGetAccessor.java:66)
at org.mvel2.ast.ASTNode.getReducedValueAccelerated(ASTNode.java:99)
at org.mvel2.MVELRuntime.execute(MVELRuntime.java:85)
at org.mvel2.compiler.CompiledExpression.getValue(CompiledExpression.java:107)
at org.mvel2.MVEL.executeExpression(MVEL.java:978)
at org.drools.base.mvel.MVELConsequence.evaluate(MVELConsequence.java:87)
at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:934)
at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:885)
at org.drools.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1086)
at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:660)
at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:627)
at org.drools.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:183)
at com.drools.debug.Test.runIteration(Test.java:132)
at com.drools.debug.Test.startTest(Test.java:73)
at com.drools.debug.Test.main(Test.java:196)
Caused by: java.lang.ClassNotFoundException: mytest.debug.rules.PerUserCount
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:319)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:330)
at java.lang.ClassLoader.loadClass(ClassLoader.java:254)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:402)
... 23 more
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years
[JBoss JIRA] Created: (JBRULES-2423) "from" does not work correctly with events in STREAM mode
by Davide Sottara (JIRA)
"from" does not work correctly with events in STREAM mode
---------------------------------------------------------
Key: JBRULES-2423
URL: https://jira.jboss.org/jira/browse/JBRULES-2423
Project: Drools
Issue Type: Bug
Security Level: Public (Everyone can see)
Components: drools-core (fusion)
Affects Versions: 5.0.0.M1
Environment: Drools Fusion 5.0+ with engine in STREAM mode
Reporter: Davide Sottara
Assignee: Mark Proctor
Priority: Critical
In the simple test case below, Message is an instantaneous event (i.e. duration = 0) with a list of destinations.
--------------------------------------------------------------------------------------------------------------------------------------
declare Message
@role( event )
@timestamp(start)
@duration(duration)
end
rule "Hello World"
when
m : Message( status == Message.HELLO, $myMessage : message, $destinations : dest)
$s : String() from $destinations
then
System.out.println( "Dear " + $s + " : >>> " + $myMessage );
end
--------------------------------------------------------------------------------------------------------------------------------------
if the engine is configured to work in STREAM mode, the output is
Dear NULL :>>> Hello World
...
since the Strings extracted from the Collection "dest" have already been retracted by
the time the rule is fired, following the retraction of the Message event.
The problem does not show in CLOUD mode.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years