Drools 5.6.0.Final PKG vs DRL infinite loop

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

Drools 5.6.0.Final PKG vs DRL infinite loop

gboro54
We are using drools 5.6.0.Final and the same version of Guvnor. When we run the source file of a package from Guvnor everything works as expected. When we take the same rules and create a package we get stuck in an infinite loop of rules firing(I have a listener logging every time a rule is created/fired).  Why would there be a difference if the rules don't change between the source and the pkg?

We build the kbase as follows:


        KnowledgeBuilderConfiguration config = KnowledgeBuilderFactory
                .newKnowledgeBuilderConfiguration();
        config.setOption(PropertySpecificOption.ALWAYS);

        KnowledgeBuilder kbuilder = KnowledgeBuilderFactory
                .newKnowledgeBuilder(config);
        for (ResourcePair pair : pairs) {
/*            kbuilder.add(
                    ResourceFactory.newClassPathResource("rule-sets/2014/feb/"+pair.resourceName),
                    ResourceType.getResourceType(pair.resourceType));*/
           
            kbuilder.add(
                    ResourceFactory.newClassPathResource(pair.resourceName),
                    ResourceType.getResourceType(pair.resourceType));
        }

        KnowledgeBuilderErrors errors = kbuilder.getErrors();
        if (errors.size() > 0) {
            StringBuilder sb = new StringBuilder();
            for (KnowledgeBuilderError error : errors) {
                sb.append(error + "\n");
                System.out.println(sb);
            }
            throw new IllegalArgumentException("Could not parse knowledge. \n"
                    + sb);
        }

        this.knowledgeBase = KnowledgeBaseFactory.newKnowledgeBase();
        this.knowledgeBase
                .addKnowledgePackages(kbuilder.getKnowledgePackages());
Reply | Threaded
Open this post in threaded view
|

Re: Drools 5.6.0.Final PKG vs DRL infinite loop

gboro54
Also note we are using property reactive listener always. The rules do modify an object that a bunch of the rules use however the modified property is not being evaluated(i.e no rule is checking the property at the moment).
Reply | Threaded
Open this post in threaded view
|

Re: [rules-users] Drools 5.6.0.Final PKG vs DRL infinite loop

Davide Sottara
Interesting.. this may be a bug in the serialization process, and it may
affect 6.x too
Could you please check it with a package that contains a single rule
using a single
@propertyReactive class?

On 02/25/2014 09:25 PM, gboro54 wrote:

> Also note we are using property reactive listener always. The rules do modify
> an object that a bunch of the rules use however the modified property is not
> being evaluated(i.e no rule is checking the property at the moment).
>
>
>
> --
> View this message in context: http://drools.46999.n3.nabble.com/Drools-5-6-0-Final-PKG-vs-DRL-infinite-loop-tp4028318p4028320.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
Reply | Threaded
Open this post in threaded view
|

Re: [rules-users] Drools 5.6.0.Final PKG vs DRL infinite loop

gboro54
Will do. Should have a test in about 20 minutes

Davide Sottara wrote
Interesting.. this may be a bug in the serialization process, and it may
affect 6.x too
Could you please check it with a package that contains a single rule
using a single
@propertyReactive class?

On 02/25/2014 09:25 PM, gboro54 wrote:
> Also note we are using property reactive listener always. The rules do modify
> an object that a bunch of the rules use however the modified property is not
> being evaluated(i.e no rule is checking the property at the moment).
>
>
>
> --
> View this message in context: http://drools.46999.n3.nabble.com/Drools-5-6-0-Final-PKG-vs-DRL-infinite-loop-tp4028318p4028320.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
Reply | Threaded
Open this post in threaded view
|

Re: [rules-users] Drools 5.6.0.Final PKG vs DRL infinite loop

gboro54
In reply to this post by Davide Sottara
I created a single rule as follows:

package test
import com.Firm

rule 'test rule'
dialect 'mvel'
no-loop true
        when
            $firm:Firm( )
        then
            modify($firm){addToFirmAccumulation("va",1L,false,1)}
end

When I compiled and ran I didn't get the infinite looping like I did before.  The method addToFirmAccumulation is annotated with @Modifies({ "volumeAccumulations" }) as it's updating the map


Davide Sottara wrote
Interesting.. this may be a bug in the serialization process, and it may
affect 6.x too
Could you please check it with a package that contains a single rule
using a single
@propertyReactive class?

On 02/25/2014 09:25 PM, gboro54 wrote:
> Also note we are using property reactive listener always. The rules do modify
> an object that a bunch of the rules use however the modified property is not
> being evaluated(i.e no rule is checking the property at the moment).
>
>
>
> --
> View this message in context: http://drools.46999.n3.nabble.com/Drools-5-6-0-Final-PKG-vs-DRL-infinite-loop-tp4028318p4028320.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
Reply | Threaded
Open this post in threaded view
|

Re: Drools 5.6.0.Final PKG vs DRL infinite loop

gboro54
In reply to this post by gboro54
test-drools.zip

Here is a sample project which shows the issue. You can build the project as the fact model and upload the drl into guvnor
Reply | Threaded
Open this post in threaded view
|

Re: [rules-users] Drools 5.6.0.Final PKG vs DRL infinite loop

Davide Sottara
Thanks!
I'll get back to you tomorrow with the results

On 02/25/2014 11:53 PM, gboro54 wrote:

> test-drools.zip
> <http://drools.46999.n3.nabble.com/file/n4028329/test-drools.zip>  
>
> Here is a sample project which shows the issue. You can build the project as
> the fact model and upload the drl into guvnor
>
>
>
> --
> View this message in context: http://drools.46999.n3.nabble.com/Drools-5-6-0-Final-PKG-vs-DRL-infinite-loop-tp4028318p4028329.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
Reply | Threaded
Open this post in threaded view
|

Re: [rules-users] Drools 5.6.0.Final PKG vs DRL infinite loop

gboro54
Excellent! Thanks for the assistance

Davide Sottara wrote
Thanks!
I'll get back to you tomorrow with the results

On 02/25/2014 11:53 PM, gboro54 wrote:
> test-drools.zip
> <http://drools.46999.n3.nabble.com/file/n4028329/test-drools.zip> 
>
> Here is a sample project which shows the issue. You can build the project as
> the fact model and upload the drl into guvnor
>
>
>
> --
> View this message in context: http://drools.46999.n3.nabble.com/Drools-5-6-0-Final-PKG-vs-DRL-infinite-loop-tp4028318p4028329.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
Reply | Threaded
Open this post in threaded view
|

Re: [rules-users] Drools 5.6.0.Final PKG vs DRL infinite loop

Davide Sottara
In reply to this post by gboro54
I think I see the problem - though I haven't been able to test it with
guvnor.

Property Reactivity is resolved at compile time, when the package is built.

When you load the DRL, you set PropertyReactive.ALWAYS in the (local)
KnowledgeBuilder, so it will consider all classes as PR.

However, afaik there is no way to do the same in Guvnor, so its (remote)
builder will create the Packages as if the classes were NOT
PropertyReactive.

Could you try to annotate the model classes with @PropertyReactive before
you load the jar in guvnor?

Davide


On 02/25/2014 11:53 PM, gboro54 wrote:

> test-drools.zip
> <http://drools.46999.n3.nabble.com/file/n4028329/test-drools.zip>  
>
> Here is a sample project which shows the issue. You can build the project as
> the fact model and upload the drl into guvnor
>
>
>
> --
> View this message in context: http://drools.46999.n3.nabble.com/Drools-5-6-0-Final-PKG-vs-DRL-infinite-loop-tp4028318p4028329.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
Reply | Threaded
Open this post in threaded view
|

Re: [rules-users] Drools 5.6.0.Final PKG vs DRL infinite loop

gboro54
No luck adding ProperReactive to the classes(in the sample project).

Davide Sottara wrote
I think I see the problem - though I haven't been able to test it with
guvnor.

Property Reactivity is resolved at compile time, when the package is built.

When you load the DRL, you set PropertyReactive.ALWAYS in the (local)
KnowledgeBuilder, so it will consider all classes as PR.

However, afaik there is no way to do the same in Guvnor, so its (remote)
builder will create the Packages as if the classes were NOT
PropertyReactive.

Could you try to annotate the model classes with @PropertyReactive before
you load the jar in guvnor?

Davide


On 02/25/2014 11:53 PM, gboro54 wrote:
> test-drools.zip
> <http://drools.46999.n3.nabble.com/file/n4028329/test-drools.zip> 
>
> Here is a sample project which shows the issue. You can build the project as
> the fact model and upload the drl into guvnor
>
>
>
> --
> View this message in context: http://drools.46999.n3.nabble.com/Drools-5-6-0-Final-PKG-vs-DRL-infinite-loop-tp4028318p4028329.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
Reply | Threaded
Open this post in threaded view
|

Re: [rules-users] Drools 5.6.0.Final PKG vs DRL infinite loop

Davide Sottara
Ok, so I have to test it.
There could be two possible failure points:

1) The compiler should see the annotations and create the internal
data structures, tracking the fact that the classes are @PR
2) The data structures are declared in the package of the beans,
which is not (necessarily) the package where the rules are defined.
We have to ensure that ALL packages are downloaded from guvnor.

To check #2, it should be enough to ensure that the rules and the
classes live in the same package

I'll get back to you later
Davide


On 02/26/2014 03:59 PM, gboro54 wrote:

> No luck adding ProperReactive to the classes(in the sample project).
>
>
> Davide Sottara wrote
>> I think I see the problem - though I haven't been able to test it with
>> guvnor.
>>
>> Property Reactivity is resolved at compile time, when the package is
>> built.
>>
>> When you load the DRL, you set PropertyReactive.ALWAYS in the (local)
>> KnowledgeBuilder, so it will consider all classes as PR.
>>
>> However, afaik there is no way to do the same in Guvnor, so its (remote)
>> builder will create the Packages as if the classes were NOT
>> PropertyReactive.
>>
>> Could you try to annotate the model classes with @PropertyReactive before
>> you load the jar in guvnor?
>>
>> Davide
>>
>>
>> On 02/25/2014 11:53 PM, gboro54 wrote:
>>> test-drools.zip
>>> &lt;http://drools.46999.n3.nabble.com/file/n4028329/test-drools.zip&gt; 
>>>
>>> Here is a sample project which shows the issue. You can build the project
>>> as
>>> the fact model and upload the drl into guvnor
>>>
>>>
>>>
>>> --
>>> View this message in context:
>>> http://drools.46999.n3.nabble.com/Drools-5-6-0-Final-PKG-vs-DRL-infinite-loop-tp4028318p4028329.html
>>> Sent from the Drools: User forum mailing list archive at Nabble.com.
>>> _______________________________________________
>>> rules-users mailing list
>>>
>> rules-users@.jboss
>>> https://lists.jboss.org/mailman/listinfo/rules-users
>>>
>> _______________________________________________
>> rules-users mailing list
>> rules-users@.jboss
>> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
>
>
> --
> View this message in context: http://drools.46999.n3.nabble.com/Drools-5-6-0-Final-PKG-vs-DRL-infinite-loop-tp4028318p4028335.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
Reply | Threaded
Open this post in threaded view
|

Re: [rules-users] Drools 5.6.0.Final PKG vs DRL infinite loop

gboro54
For number 2 it is a fair to claim that the beans the rules do not live in the same package. Thanks again for the assistance

Davide Sottara wrote
Ok, so I have to test it.
There could be two possible failure points:

1) The compiler should see the annotations and create the internal
data structures, tracking the fact that the classes are @PR
2) The data structures are declared in the package of the beans,
which is not (necessarily) the package where the rules are defined.
We have to ensure that ALL packages are downloaded from guvnor.

To check #2, it should be enough to ensure that the rules and the
classes live in the same package

I'll get back to you later
Davide


On 02/26/2014 03:59 PM, gboro54 wrote:
> No luck adding ProperReactive to the classes(in the sample project).
>
>
> Davide Sottara wrote
>> I think I see the problem - though I haven't been able to test it with
>> guvnor.
>>
>> Property Reactivity is resolved at compile time, when the package is
>> built.
>>
>> When you load the DRL, you set PropertyReactive.ALWAYS in the (local)
>> KnowledgeBuilder, so it will consider all classes as PR.
>>
>> However, afaik there is no way to do the same in Guvnor, so its (remote)
>> builder will create the Packages as if the classes were NOT
>> PropertyReactive.
>>
>> Could you try to annotate the model classes with @PropertyReactive before
>> you load the jar in guvnor?
>>
>> Davide
>>
>>
>> On 02/25/2014 11:53 PM, gboro54 wrote:
>>> test-drools.zip
>>> <http://drools.46999.n3.nabble.com/file/n4028329/test-drools.zip> 
>>>
>>> Here is a sample project which shows the issue. You can build the project
>>> as
>>> the fact model and upload the drl into guvnor
>>>
>>>
>>>
>>> --
>>> View this message in context:
>>> http://drools.46999.n3.nabble.com/Drools-5-6-0-Final-PKG-vs-DRL-infinite-loop-tp4028318p4028329.html
>>> Sent from the Drools: User forum mailing list archive at Nabble.com.
>>> _______________________________________________
>>> rules-users mailing list
>>>
>> rules-users@.jboss
>>> https://lists.jboss.org/mailman/listinfo/rules-users
>>>
>> _______________________________________________
>> rules-users mailing list
>> rules-users@.jboss
>> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
>
>
> --
> View this message in context: http://drools.46999.n3.nabble.com/Drools-5-6-0-Final-PKG-vs-DRL-infinite-loop-tp4028318p4028335.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
Reply | Threaded
Open this post in threaded view
|

Re: [rules-users] Drools 5.6.0.Final PKG vs DRL infinite loop

davidmoros
In reply to this post by Davide Sottara
I have the same problem

In local all works fine, but when I upgrade the model and rules to Guvnor, generate the package PKG and download it from a java webservice, appears the infinite loops, it is as if the @PropertiReactive is lost

All classes in my model are annotated with @PropertyReactive

I have created the topic
http://drools.46999.n3.nabble.com/Annotation-PropertyReactive-not-works-td4030602.html