You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kie.apache.org by "geertvb (via GitHub)" <gi...@apache.org> on 2025/05/12 13:31:49 UTC
[I] Rule fires again after restoring session and calling fireAllRules [incubator-kie-drools]
geertvb opened a new issue, #6339:
URL: https://github.com/apache/incubator-kie-drools/issues/6339
A rule that was fired as a result of a fact update, fires again after restoring the session and calling fireAllRules.
I created a project in github that reproduces the behavior. See https://github.com/geertvb/drools-restore-session-issue
The project is a simple maven spring boot drools project that executes 4 steps.
Step 1 creates a session, inserts a person as a fact and fires all rules.
Step 2 restores the session, inserts an integer and fires all rules. The inserted integer fires rules that updates the person age.
Step 3 restores the session and fires all rules. As nothing got inserted, no rules should fire but it does fire a rule.
Step 4 restores the session again ad fire all rules. This time, no rules are fired.
The application executes fireAllRules right after restoring the session in every step to check if unnecessary rules get fired. For step 3 that is the case. See the error statement _ERROR e.europa.ec.cc.drools.SessionFactory No rules should have been fired after init, but 1 rule(s) did fire_ in the output of the application below
The application also executes fireAllRules before ending a step and executing the next step to be sure no further rules trigger. Step 2 clearly indicates that "Fired 0 rule(s) before closing"
```
15:15:02.197 INFO eu.europa.ec.cc.drools.App ----- step1 - Insert person -----
15:15:02.216 INFO e.europa.ec.cc.drools.SessionFactory Session id: 0, fact count: 0
15:15:02.216 INFO eu.europa.ec.cc.drools.App Inserting Person(id=666, name=John Doe, age=32)
15:15:02.220 INFO eu.europa.ec.cc.drools.App Person handle: [fact 0:1:718130408:-1363838918:1:DEFAULT:NON_TRAIT:eu.europa.ec.cc.drools.Person:Person(id=666, name=John Doe, age=32)]
15:15:02.233 INFO eu.europa.ec.cc.rules Person: Person(id=666, name=John Doe, age=32)
15:15:02.233 INFO eu.europa.ec.cc.drools.App Fired 1 rule(s) after insert Person(id=666, name=John Doe, age=32)
15:15:02.233 INFO eu.europa.ec.cc.drools.App Fired 0 rule(s) before closing
15:15:02.239 INFO o.d.r.h.H2MVStoreStorageManager Using H2MVStoreStorageManager
15:15:02.240 INFO eu.europa.ec.cc.drools.App ----- step2 - Update age -----
15:15:02.243 INFO e.europa.ec.cc.drools.SessionFactory Session id: 1, fact count: 1
15:15:02.243 INFO eu.europa.ec.cc.drools.App Inserting 32
15:15:02.244 INFO eu.europa.ec.cc.drools.App Integer handle: [fact 0:2:1589745212:32:2:DEFAULT:NON_TRAIT:java.lang.Integer:32]
15:15:02.245 INFO eu.europa.ec.cc.rules Age: 32
15:15:02.247 INFO eu.europa.ec.cc.rules Person: Person(id=666, name=John Doe, age=33)
15:15:02.247 INFO eu.europa.ec.cc.drools.App Fired 2 rule(s) after insert 32
15:15:02.247 INFO eu.europa.ec.cc.drools.App Fired 0 rule(s) before closing
15:15:02.251 INFO o.d.r.h.H2MVStoreStorageManager Using H2MVStoreStorageManager
15:15:02.252 INFO eu.europa.ec.cc.drools.App ----- step3 - Just load Session -----
15:15:02.253 INFO e.europa.ec.cc.drools.SessionFactory Session id: 2, fact count: 1
15:15:02.254 INFO eu.europa.ec.cc.rules Person: Person(id=666, name=John Doe, age=33)
15:15:02.254 ERROR e.europa.ec.cc.drools.SessionFactory No rules should have been fired after init, but 1 rule(s) did fire
15:15:02.254 INFO eu.europa.ec.cc.drools.App Fired 0 rule(s) before closing
15:15:02.257 INFO o.d.r.h.H2MVStoreStorageManager Using H2MVStoreStorageManager
15:15:02.259 INFO eu.europa.ec.cc.drools.App ----- step4 - Just load Session -----
15:15:02.260 INFO e.europa.ec.cc.drools.SessionFactory Session id: 3, fact count: 1
15:15:02.260 INFO eu.europa.ec.cc.drools.App Fired 0 rule(s) before closing
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org
Re: [I] Rule fires again after restoring session and calling fireAllRules [incubator-kie-drools]
Posted by "tkobayas (via GitHub)" <gi...@apache.org>.
tkobayas commented on issue #6339:
URL: https://github.com/apache/incubator-kie-drools/issues/6339#issuecomment-2875148384
@yesamer , thank you for helping on this issue and @geertvb thank you for the reproducer. I'm looking into the issue and will get back to you.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org
Re: [I] Rule fires again after restoring session and calling fireAllRules [incubator-kie-drools]
Posted by "geertvb (via GitHub)" <gi...@apache.org>.
geertvb commented on issue #6339:
URL: https://github.com/apache/incubator-kie-drools/issues/6339#issuecomment-2873684929
Hi @yesamer,
I'll tackle your suggestions 1 by 1.
1. "Lombok usage is strongly discouraged"
I've completely removed lombok from the project. See commit with message "Try without Lombok"
The result is still exactly the same as before.
```
20:54:30.195 ERROR e.europa.ec.cc.drools.SessionFactory No rules should have been fired after init, but 1 rule(s) did fire
```
Next I will try with version 10 (Tried it before but there were other issues)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org
Re: [I] Rule fires again after restoring session and calling fireAllRules [incubator-kie-drools]
Posted by "yesamer (via GitHub)" <gi...@apache.org>.
yesamer closed issue #6339: Rule fires again after restoring session and calling fireAllRules
URL: https://github.com/apache/incubator-kie-drools/issues/6339
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org
Re: [I] Rule fires again after restoring session and calling fireAllRules [incubator-kie-drools]
Posted by "yesamer (via GitHub)" <gi...@apache.org>.
yesamer commented on issue #6339:
URL: https://github.com/apache/incubator-kie-drools/issues/6339#issuecomment-2873141648
Hi @geertvb, please consider the following suggestions:
- Lombok usage is strongly discouraged;
- Please update the version to Apache KIE 10.0.0. Version 9.44 is no longer maintained;
- Please refer to https://github.com/apache/incubator-kie-kogito-examples, a repository that contains useful examples to use Apache KIE.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org
Re: [I] Rule fires again after restoring session and calling fireAllRules [incubator-kie-drools]
Posted by "geertvb (via GitHub)" <gi...@apache.org>.
geertvb commented on issue #6339:
URL: https://github.com/apache/incubator-kie-drools/issues/6339#issuecomment-2873799484
2. "Please update the version to Apache KIE 10.0.0. Version 9.44 is no longer maintained"
An issue that I encountered with version 10.0.0 previously and that is still there is that `StorageManagerFactory.get()` without a parameter throws the following exception:
```
Caused by: java.lang.NullPointerException: Cannot invoke "String.equals(Object)" because "tag" is null
at org.kie.api.internal.utils.KieServiceLoader.load(KieServiceLoader.java:53)
at org.kie.api.internal.utils.KieServiceLoader.lookup(KieServiceLoader.java:44)
at org.kie.api.internal.utils.KieService.loadWithTag(KieService.java:47)
at org.drools.reliability.core.StorageManagerFactory$Holder.createInstance(StorageManagerFactory.java:50)
at org.drools.reliability.core.StorageManagerFactory$Holder.<clinit>(StorageManagerFactory.java:44)
... 2 more
```
I managed to work around that by explicitly using `StorageManagerFactory.get("h2mvstore")` and adding the following 2 statements before doing that.
```
SimpleReliableObjectStoreFactory.get("h2mvstore");
ReliableGlobalResolverFactory.get("h2mvstore");
```
This was not required in previous version. 9.44 detected that I only had h2mvstore dependency and used it.
There were other issues with our application and version 10.0.0 but this is the only one that manifested with the project that reproduces the session restore issue.
After working around the NPE the application still shows the exact same problem
```
21:45:56.110 ERROR e.europa.ec.cc.drools.SessionFactory No rules should have been fired after init, but 1 rule(s) did fire
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org
Re: [I] Rule fires again after restoring session and calling fireAllRules [incubator-kie-drools]
Posted by "geertvb (via GitHub)" <gi...@apache.org>.
geertvb commented on issue #6339:
URL: https://github.com/apache/incubator-kie-drools/issues/6339#issuecomment-2873878981
3. "Please refer to https://github.com/apache/incubator-kie-kogito-examples, a repository that contains useful examples to use Apache KIE"
I'm fully aware of the repository incubator-kie-kogito-examples and I just checked again but it does not contain any example using drools reliability for session persistence as far as I was able to see.
If you are referring to the use of spring-boot, I only used spring core because I like inversion of control and didn't want to have a heavy full blown spring boot application. In fact, originally I had a version without spring (manually coded the IoC) but that was more code an could distract the reader from the real problem.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org
Re: [I] Rule fires again after restoring session and calling fireAllRules [incubator-kie-drools]
Posted by "geertvb (via GitHub)" <gi...@apache.org>.
geertvb commented on issue #6339:
URL: https://github.com/apache/incubator-kie-drools/issues/6339#issuecomment-2876311281
@tkobayas , thank you for addressing the issue so quickly.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org