Drools 5.4 Jitting Error

classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|

Drools 5.4 Jitting Error

gboro54
I just updated to Drools 5.4 and I am not getting the following error on all my map accessors:


10:41:12,997 ERROR [stderr] (Thread-169) Exception in thread "Thread-169" java.lang.RuntimeException: Exception jitting: feeKeys[1] == null

10:41:12,998 ERROR [stderr] (Thread-169) at org.drools.rule.constraint.MvelConstraint.executeJitting(MvelConstraint.java:219)

10:41:12,999 ERROR [stderr] (Thread-169) at org.drools.rule.constraint.MvelConstraint.access$000(MvelConstraint.java:41)

10:41:13,000 ERROR [stderr] (Thread-169) at org.drools.rule.constraint.MvelConstraint$1.run(MvelConstraint.java:201)

10:41:13,000 ERROR [stderr] (Thread-169) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)

10:41:13,001 ERROR [stderr] (Thread-169) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)

10:41:13,002 ERROR [stderr] (Thread-169) at java.lang.Thread.run(Thread.java:662)

10:41:13,002 ERROR [stderr] (Thread-169) Caused by: java.lang.VerifyError: (class: ConditionEvaluator51817e9f4a7542c5b295be7d674f854c, method: evaluate signature: (Ljava/lang/Object;Lorg/drools/common/InternalWorkingMemory;Lorg/drools/reteoo/LeftTuple;)Z) Expecting to find object/array on stack

10:41:13,004 ERROR [stderr] (Thread-169) at java.lang.Class.getDeclaredConstructors0(Native Method)

10:41:13,004 ERROR [stderr] (Thread-169) at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)

10:41:13,005 ERROR [stderr] (Thread-169) at java.lang.Class.getConstructor0(Class.java:2699)

10:41:13,005 ERROR [stderr] (Thread-169) at java.lang.Class.getConstructor(Class.java:1657)

10:41:13,006 ERROR [stderr] (Thread-169) at org.drools.rule.builder.dialect.asm.ClassGenerator.newInstance(ClassGenerator.java:173)

10:41:13,006 ERROR [stderr] (Thread-169) at org.drools.rule.constraint.ASMConditionEvaluatorJitter.jitEvaluator(ASMConditionEvaluatorJitter.java:53)

10:41:13,007 ERROR [stderr] (Thread-169) at org.drools.rule.constraint.MvelConstraint.executeJitting(MvelConstraint.java:217)

10:41:13,008 ERROR [stderr] (Thread-169) ... 5 more



Could anyone indicate how to fix this?
Reply | Threaded
Open this post in threaded view
|

Re: Drools 5.4 Jitting Error

gboro54

rule "Rule1 trade"
        no-loop true
        when
                $tsc:TradeSideContext(trade!=null,primarySide!=null,contraSide!=null)
                $trade:Trade($tradeDate:tradeDate, tradeSource == "O") from $tsc.trade
                $ps:TradeSide(capacity.capacityCode == CapacityCode.CUSTOMER) from $tsc.primarySide
                $cs:TradeSide(capacity.capacityCode == CapacityCode.CUSTOMER) from $tsc.contraSide
                $ft:FeeType(feeKeys[0] == DefaultFeeTypeComponent.RULE_1_SCH, feeKeys[1] == null) from $tsc.baseFee

        then

                $ft.appendKeyValue(DefaultFeeTypeComponent.RULE_1_ELG);
                events.select(new GenericBillingEvent(BillingEventType.BASE_FEE_EVENT)).fire($tsc);retract($tsc);
end
Reply | Threaded
Open this post in threaded view
|

Re: Drools 5.4 Jitting Error

gboro54
It looks like the rule executes(based on my unit test the proper element is placed in the list) and it always seems to happen on the my last execution. In addition I have noticed that the evaluations seem to be handled on other threads. Is this correct behavior?


gboro54 wrote
rule "Rule1 trade"
        no-loop true
        when
                $tsc:TradeSideContext(trade!=null,primarySide!=null,contraSide!=null)
                $trade:Trade($tradeDate:tradeDate, tradeSource == "O") from $tsc.trade
                $ps:TradeSide(capacity.capacityCode == CapacityCode.CUSTOMER) from $tsc.primarySide
                $cs:TradeSide(capacity.capacityCode == CapacityCode.CUSTOMER) from $tsc.contraSide
                $ft:FeeType(feeKeys[0] == DefaultFeeTypeComponent.RULE_1_SCH, feeKeys[1] == null) from $tsc.baseFee

        then

                $ft.appendKeyValue(DefaultFeeTypeComponent.RULE_1_ELG);
                events.select(new GenericBillingEvent(BillingEventType.BASE_FEE_EVENT)).fire($tsc);retract($tsc);
end
Reply | Threaded
Open this post in threaded view
|

Re: Drools 5.4 Jitting Error

Mario Fusco
In Drools 5.4 we added an optimization that JITs constraints (i.e. compile them in bytecode) after they have been evaluated for a given amount of times (currently 20). Moreover it is not true that constraints' evaluations is made in threads different from the main one. Instead it is that jitting process mentioned above that is performed in a different threads, so until the optimized version of the constraint isn't ready, the main thread isn't blocked but can continue to use the non-jitted one. The error you are experiencing is generated during the optimization process and that is why you see it happens in different thread.

I will try to reproduce the issue you found just now.
Thank you for reporting this.

Mario
Reply | Threaded
Open this post in threaded view
|

Re: Drools 5.4 Jitting Error

gboro54
Mario,

  That is what i expected(just wanted to verify). Let me know if any additional information is needed...

Mario Fusco wrote
In Drools 5.4 we added an optimization that JITs constraints (i.e. compile them in bytecode) after they have been evaluated for a given amount of times (currently 20). Moreover it is not true that constraints' evaluations is made in threads different from the main one. Instead it is that jitting process mentioned above that is performed in a different threads, so until the optimized version of the constraint isn't ready, the main thread isn't blocked but can continue to use the non-jitted one. The error you are experiencing is generated during the optimization process and that is why you see it happens in different thread.

I will try to reproduce the issue you found just now.
Thank you for reporting this.

Mario
Reply | Threaded
Open this post in threaded view
|

Re: Drools 5.4 Jitting Error

Mario Fusco
Ok, I've been able to reproduce your issue. I'll fix it asap and keep you updated on how I am progressing.
The only (ugly) workaround I could find at the moment is to replace feeKeys[1] with feeKeys[new Integer(1)].
Let me know if it works for you.

Mario


Reply | Threaded
Open this post in threaded view
|

Re: Drools 5.4 Jitting Error

gboro54
Thanks Mario! That seems to have resolved the issue. I look forward to your fix.

Mario Fusco wrote
Ok, I've been able to reproduce your issue. I'll fix it asap and keep you updated on how I am progressing.
The only (ugly) workaround I could find at the moment is to replace feeKeys[1] with feeKeys[new Integer(1)].
Let me know if it works for you.

Mario
Reply | Threaded
Open this post in threaded view
|

Re: Drools 5.4 Jitting Error

Mario Fusco
I have reported this issue here: https://issues.jboss.org/browse/JBRULES-3511
I have also already fixed it and pushed the fix on the master branch.

Working on the fix I also found another workaround: even replacing feeKeys[1] with feeKeys[1+0] should work. I don't know if this is better or worse than the former one I suggested, since it is a bit more concise but probably also less readable.

Thanks again for reporting this,
Mario
Reply | Threaded
Open this post in threaded view
|

Re: [rules-users] Drools 5.4 Jitting Error

Caillard, Quentin
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: [rules-users] Drools 5.4 Jitting Error

gboro54
You are correct from what I have seen... 

On Thu, Sep 6, 2012 at 4:41 AM, Caillard, Quentin [via Drools] <[hidden email]> wrote:
Sorry, it is a quite old thread. But i am experiencing some jitting error with the 5.4.0.Final. If I well understand, the jitting error doesn't stop or modify the execution of my rules. Am I right? Can i use this version anyway?

Thanks for your response.

Regards

2012/5/17 Mario Fusco <[hidden email]>
I have reported this issue here: https://issues.jboss.org/browse/JBRULES-3511
I have also already fixed it and pushed the fix on the master branch.

Working on the fix I also found another workaround: even replacing
feeKeys[1] with feeKeys[1+0] should work. I don't know if this is better or
worse than the former one I suggested, since it is a bit more concise but
probably also less readable.

Thanks again for reporting this,
Mario

--
View this message in context: http://drools.46999.n3.nabble.com/Drools-5-4-Jitting-Error-tp3999176p3999537.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
_______________________________________________
rules-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/rules-users



--




_______________________________________________
rules-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/rules-users



If you reply to this email, your message will be added to the discussion below:
http://drools.46999.n3.nabble.com/Drools-5-4-Jitting-Error-tp3999176p4019621.html
To unsubscribe from Drools 5.4 Jitting Error, click here.
NAML

Reply | Threaded
Open this post in threaded view
|

Re: [rules-users] Drools 5.4 Jitting Error

jgeuns
FYI, I came across a similar problem calling a method declared on a Java helper class, when the method takes a Number and the value passed in is declared as long or int. Problem does not occur when value is declared as double.

Simplified version of my example:
class JavaHelper {
        public boolean helperMethod(Number value) {
                return true;
        }
}

............

declare BusinessObject
        LongAttribute : long
        DoubleAttribute : double
end

............

rule "TestRule"
    when
    $helper: JavaHelper ()
        $object: BusinessObject (
                $helper.helperMethod(LongAttribute)
        )
    then
                // ....
end

This gives the exception shown below. Exception goes away when replacing LongAttribute with DoubleAttribute.

One workaround is to create multiple versions of helperMethod:
  public boolean helperMethod(long value) {..}
  public boolean helperMethod(double value) {..}

=============
Exception in thread "Thread-5" java.lang.RuntimeException: Exception jitting: $helper.helperMethod(LongAttribute)
        at org.drools.rule.constraint.MvelConstraint.executeJitting(MvelConstraint.java:219)
        at org.drools.rule.constraint.MvelConstraint.access$000(MvelConstraint.java:41)
        at org.drools.rule.constraint.MvelConstraint$1.run(MvelConstraint.java:201)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
        at java.lang.Thread.run(Thread.java:680)
Caused by: java.lang.VerifyError: (class: ConditionEvaluatorc78edf31751242d095abbdec5e344aa4, method: evaluate signature: (Ljava/lang/Object;Lorg/drools/common/InternalWorkingMemory;Lorg/drools/reteoo/LeftTuple;)Z) Expecting to find long on stack
        at java.lang.Class.getDeclaredConstructors0(Native Method)
        at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
        at java.lang.Class.getConstructor0(Class.java:2699)
        at java.lang.Class.getConstructor(Class.java:1657)
        at org.drools.rule.builder.dialect.asm.ClassGenerator.newInstance(ClassGenerator.java:173)
        at org.drools.rule.constraint.ASMConditionEvaluatorJitter.jitEvaluator(ASMConditionEvaluatorJitter.java:53)
        at org.drools.rule.constraint.MvelConstraint.executeJitting(MvelConstraint.java:217)
        ... 5 more
       
Reply | Threaded
Open this post in threaded view
|

Re: Drools 5.4 Jitting Error

kc7bfi
In reply to this post by Mario Fusco
Has this error been fixed and, if so, in what version of DRools? David
Reply | Threaded
Open this post in threaded view
|

Re: [rules-users] Drools 5.4 Jitting Error

Caillard, Quentin
CONTENTS DELETED
The author has deleted this message.