Re: [PR] [Fix #3979] Fix InMemoryJobService handling in StaticWorkflowApplication [incubator-kie-kogito-runtimes]

2025-07-10 Thread via GitHub


fjtirado merged PR #3980:
URL: https://github.com/apache/incubator-kie-kogito-runtimes/pull/3980


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



Re: [PR] [Fix #3979] Fix InMemoryJobService handling in StaticWorkflowApplication [incubator-kie-kogito-runtimes]

2025-07-09 Thread via GitHub


kie-ci3 commented on PR #3980:
URL: 
https://github.com/apache/incubator-kie-kogito-runtimes/pull/3980#issuecomment-3052869371

   
   **PR job** `#10` was: **UNSTABLE**
   Possible explanation: This should be test failures
   
   
   
   Reproducer
   
   
   
   build-chain build full_downstream  -f 
'https://raw.githubusercontent.com/${AUTHOR:apache}/incubator-kie-kogito-pipelines/${BRANCH:main}/.ci/buildchain-config-pr-cdb.yaml'
 -o 'bc' -p apache/incubator-kie-kogito-runtimes -u 
https://github.com/apache/incubator-kie-kogito-runtimes/pull/3980 
--skipParallelCheckout
   
   NOTE: To install the build-chain tool, please refer to 
https://github.com/kiegroup/github-action-build-chain#local-execution
   
   
   
   
   Please look here: 
https://ci-builds.apache.org/job/KIE/job/kogito/job/main/job/pullrequest_jobs/job/kogito-runtimes-pr/job/PR-3980/10/display/redirect
   
   **Test results:**
   - PASSED: 3610
   - FAILED: 1
   
   Those are the test failures: 
   
   https://ci-builds.apache.org/job/KIE/job/kogito/job/main/job/pullrequest_jobs/job/kogito-runtimes-pr/job/PR-3980/10/testReport/org.kie.kogito.codegen.rules/PublishEventBusinessRuleIT/testBusinessRuleProcessStartToEndAbortOfUoW/";>org.kie.kogito.codegen.rules.PublishEventBusinessRuleIT.testBusinessRuleProcessStartToEndAbortOfUoW
   Expecting empty but was: [ProcessInstanceStateDataEvent 
{specVersion=1.0, id='47d11325-2c01-45f9-832c-f0d4071b1f09', 
source=http://myhost/TimerProcess, type='ProcessInstanceStateDataEvent', 
time=2025-07-09T07:24:22.376969210-04:00, subject='null', 
dataContentType='application/json', dataSchema=null, 
data=ProcessInstanceStateEventBody [eventDate=Wed Jul 09 07:24:22 EDT 2025, 
eventUser=null, eventType=1, processId=defaultPackage.TimerProcess, 
processVersion=1.0, processType=BPMN, 
processInstanceId=a570e97c-0401-49a7-a990-8f2f177b31bb, businessKey=null, 
processName=TimerProcess, parentInstanceId=null, rootProcessId=null, 
rootProcessInstanceId=null, state=1, roles=null, cloudEventId=null 
,cloudEventSource=null], 
kogitoProcessInstanceId='a570e97c-0401-49a7-a990-8f2f177b31bb', 
kogitoRootProcessInstanceId='null', 
kogitoProcessId='defaultPackage.TimerProcess', kogitoRootProcessId='null', 
kogitoAddons='test', kogitoIdentity='null', 
extensionAttributes={kogitoproctype=BPMN, kogitoproci
 nstanceid=a570e97c-0401-49a7-a990-8f2f177b31bb, kogitoprocist=1, 
kogitoprocversion=1.0, kogitoprocid=defaultPackage.TimerProcess, 
kogitoaddons=test}},ProcessInstanceNodeDataEvent {specVersion=1.0, 
id='6848b29e-571a-4511-a979-5b94f2855c5c', source=http://myhost/TimerProcess, 
type='ProcessInstanceNodeDataEvent', time=2025-07-09T07:24:22.369003805-04:00, 
subject='null', dataContentType='application/json', dataSchema=null, 
data=ProcessInstanceNodeEventBody [eventDate=Wed Jul 09 07:24:22 EDT 2025, 
eventUser=null, eventType=1, processId=defaultPackage.TimerProcess, 
processVersion=1.0, processInstanceId=a570e97c-0401-49a7-a990-8f2f177b31bb, 
connectionNodeInstanceId=null, 
nodeDefinitionId=_F9AC8B12-8E75-49B5-B799-292F66270627, nodeName=start, 
nodeType=StartNode, nodeInstanceId=3e1f6fab-4c27-4afe-99c8-0392d8faad48, 
data={}], kogitoProcessInstanceId='a570e97c-0401-49a7-a990-8f2f177b31bb', 
kogitoRootProcessInstanceId='null', 
kogitoProcessId='defaultPackage.TimerProcess', kogitoRootPro
 cessId='null', kogitoAddons='test', kogitoIdentity='null', 
extensionAttributes={kogitoproctype=BPMN, 
kogitoprocinstanceid=a570e97c-0401-49a7-a990-8f2f177b31bb, kogitoprocist=1, 
kogitoprocversion=1.0, kogitoprocid=defaultPackage.TimerProcess, 
kogitoaddons=test}},ProcessInstanceNodeDataEvent {specVersion=1.0, 
id='c12612af-e63f-400c-902f-34e05879f5a9', source=http://myhost/TimerProcess, 
type='ProcessInstanceNodeDataEvent', time=2025-07-09T07:24:22.369784445-04:00, 
subject='null', dataContentType='application/json', dataSchema=null, 
data=ProcessInstanceNodeEventBody [eventDate=Wed Jul 09 07:24:22 EDT 2025, 
eventUser=null, eventType=1, processId=defaultPackage.TimerProcess, 
processVersion=1.0, processInstanceId=a570e97c-0401-49a7-a990-8f2f177b31bb, 
connectionNodeInstanceId=SequenceFlow_2, 
nodeDefinitionId=_E76AD186-6FA6-4378-B45B-C8F73E2C497C, nodeName=timer fired, 
nodeType=ActionNode, nodeInstanceId=7e7495ed-5bbf-4ad0-95a9-1d34873c9a8e, 
data={}], kogitoProcessInstanceId='a570e9
 7c-0401-49a7-a990-8f2f177b31bb', kogitoRootProcessInstanceId='null', 
kogitoProcessId='defaultPackage.TimerProcess', kogitoRootProcessId='null', 
kogitoAddons='test', kogitoIdentity='null', 
extensionAttributes={kogitoproctype=BPMN, 
kogitoprocinstanceid=a570e97c-0401-49a7-a990-8f2f177b31bb, kogitoprocist=1, 
kogitoprocversion=1.0, kogitoprocid=defaultPackage.TimerProcess, 
kogitoaddons=test}},ProcessInstanceNodeDataEvent {specVersion=1.0, 
id='28ecbe70-bc29-4f43-9f96-f76dda6c1e4f', source=http://myhost/TimerProcess, 
type='ProcessInstanceNodeDataEvent', time=2025-07-09T07:24:22.370630035-04:00, 
subject='null', dataContentType='application/j

Re: [PR] [Fix #3979] Fix InMemoryJobService handling in StaticWorkflowApplication [incubator-kie-kogito-runtimes]

2025-07-09 Thread via GitHub


kie-ci3 commented on PR #3980:
URL: 
https://github.com/apache/incubator-kie-kogito-runtimes/pull/3980#issuecomment-3052143565

   
   **PR job** `#9` was: **UNSTABLE**
   Possible explanation: This should be test failures
   
   
   
   Reproducer
   
   
   
   build-chain build full_downstream  -f 
'https://raw.githubusercontent.com/${AUTHOR:apache}/incubator-kie-kogito-pipelines/${BRANCH:main}/.ci/buildchain-config-pr-cdb.yaml'
 -o 'bc' -p apache/incubator-kie-kogito-runtimes -u 
https://github.com/apache/incubator-kie-kogito-runtimes/pull/3980 
--skipParallelCheckout
   
   NOTE: To install the build-chain tool, please refer to 
https://github.com/kiegroup/github-action-build-chain#local-execution
   
   
   
   
   Please look here: 
https://ci-builds.apache.org/job/KIE/job/kogito/job/main/job/pullrequest_jobs/job/kogito-runtimes-pr/job/PR-3980/9/display/redirect
   
   **Test results:**
   - PASSED: 2807
   - FAILED: 2
   
   Those are the test failures: 
   
   https://ci-builds.apache.org/job/KIE/job/kogito/job/main/job/pullrequest_jobs/job/kogito-runtimes-pr/job/PR-3980/9/testReport/org.kie.kogito.codegen.rules/PublishEventBusinessRuleIT/testBusinessRuleProcessStartToEndWithVariableTracked/";>org.kie.kogito.codegen.rules.PublishEventBusinessRuleIT.testBusinessRuleProcessStartToEndWithVariableTracked
   Expected size: 10 but was: 21 in:[ProcessInstanceStateDataEvent 
{specVersion=1.0, id='bda05655-45b2-4773-b600-7bbfcd4fe756', 
source=http://myhost/TimerProcess, type='ProcessInstanceStateDataEvent', 
time=2025-07-09T05:59:47.954384642-04:00, subject='null', 
dataContentType='application/json', dataSchema=null, 
data=ProcessInstanceStateEventBody [eventDate=Wed Jul 09 05:59:47 EDT 2025, 
eventUser=null, eventType=1, processId=defaultPackage.TimerProcess, 
processVersion=1.0, processType=BPMN, 
processInstanceId=0cbe25ec-7a77-49c2-bc0d-d790f345c919, businessKey=null, 
processName=TimerProcess, parentInstanceId=null, rootProcessId=null, 
rootProcessInstanceId=null, state=1, roles=null, cloudEventId=null 
,cloudEventSource=null], 
kogitoProcessInstanceId='0cbe25ec-7a77-49c2-bc0d-d790f345c919', 
kogitoRootProcessInstanceId='null', 
kogitoProcessId='defaultPackage.TimerProcess', kogitoRootProcessId='null', 
kogitoAddons='test', kogitoIdentity='null', 
extensionAttributes={kogitoproctype=BPMN
 , kogitoprocinstanceid=0cbe25ec-7a77-49c2-bc0d-d790f345c919, kogitoprocist=1, 
kogitoprocversion=1.0, kogitoprocid=defaultPackage.TimerProcess, 
kogitoaddons=test}},ProcessInstanceNodeDataEvent {specVersion=1.0, 
id='895508ee-d53c-472d-a25d-8ec45b03e4df', source=http://myhost/TimerProcess, 
type='ProcessInstanceNodeDataEvent', time=2025-07-09T05:59:47.951119031-04:00, 
subject='null', dataContentType='application/json', dataSchema=null, 
data=ProcessInstanceNodeEventBody [eventDate=Wed Jul 09 05:59:47 EDT 2025, 
eventUser=null, eventType=1, processId=defaultPackage.TimerProcess, 
processVersion=1.0, processInstanceId=0cbe25ec-7a77-49c2-bc0d-d790f345c919, 
connectionNodeInstanceId=null, 
nodeDefinitionId=_F9AC8B12-8E75-49B5-B799-292F66270627, nodeName=start, 
nodeType=StartNode, nodeInstanceId=45adcefd-d719-4f19-a05f-7dd1c3b355af, 
data={}], kogitoProcessInstanceId='0cbe25ec-7a77-49c2-bc0d-d790f345c919', 
kogitoRootProcessInstanceId='null', 
kogitoProcessId='defaultPackage.TimerProcess', 
 kogitoRootProcessId='null', kogitoAddons='test', kogitoIdentity='null', 
extensionAttributes={kogitoproctype=BPMN, 
kogitoprocinstanceid=0cbe25ec-7a77-49c2-bc0d-d790f345c919, kogitoprocist=1, 
kogitoprocversion=1.0, kogitoprocid=defaultPackage.TimerProcess, 
kogitoaddons=test}},ProcessInstanceNodeDataEvent {specVersion=1.0, 
id='3fce5a25-252b-48fa-ae8e-4586bc03eb1b', source=http://myhost/TimerProcess, 
type='ProcessInstanceNodeDataEvent', time=2025-07-09T05:59:47.951362428-04:00, 
subject='null', dataContentType='application/json', dataSchema=null, 
data=ProcessInstanceNodeEventBody [eventDate=Wed Jul 09 05:59:47 EDT 2025, 
eventUser=null, eventType=1, processId=defaultPackage.TimerProcess, 
processVersion=1.0, processInstanceId=0cbe25ec-7a77-49c2-bc0d-d790f345c919, 
connectionNodeInstanceId=SequenceFlow_2, 
nodeDefinitionId=_E76AD186-6FA6-4378-B45B-C8F73E2C497C, nodeName=timer fired, 
nodeType=ActionNode, nodeInstanceId=9eefbc6d-7334-4f62-ab80-fb87e9bab593, 
data={}], kogitoProcessInsta
 nceId='0cbe25ec-7a77-49c2-bc0d-d790f345c919', 
kogitoRootProcessInstanceId='null', 
kogitoProcessId='defaultPackage.TimerProcess', kogitoRootProcessId='null', 
kogitoAddons='test', kogitoIdentity='null', 
extensionAttributes={kogitoproctype=BPMN, 
kogitoprocinstanceid=0cbe25ec-7a77-49c2-bc0d-d790f345c919, kogitoprocist=1, 
kogitoprocversion=1.0, kogitoprocid=defaultPackage.TimerProcess, 
kogitoaddons=test}},ProcessInstanceNodeDataEvent {specVersion=1.0, 
id='51b6633d-0897-475d-bd50-a50a8cda88c0', source=http://myhost/TimerProcess, 
type='ProcessInstanceNodeDataEvent', time=2025-07-09T05:59:47.951644300-04:00, 
subject='null', dataCo

Re: [PR] [Fix #3979] Fix InMemoryJobService handling in StaticWorkflowApplication [incubator-kie-kogito-runtimes]

2025-07-09 Thread via GitHub


fjtirado commented on code in PR #3980:
URL: 
https://github.com/apache/incubator-kie-kogito-runtimes/pull/3980#discussion_r2192994600


##
api/kogito-services/src/main/java/org/kie/kogito/services/jobs/impl/InMemoryJobService.java:
##
@@ -117,17 +103,14 @@ public String rescheduleJob(JobDescription 
jobDescription) {
 
 protected long calculateDelay(JobDescription description) {
 long delay = Duration.between(ZonedDateTime.now(), 
description.expirationTime().get()).toMillis();
-if (delay <= 0) {
-return 1;
-}
-return delay;
+return delay <= 0 ? 1 : delay;
 }
 
 @Override
 public void close() throws Exception {
 LOGGER.info("closing in memory job service");
-scheduledJobs.clear();
 scheduledJobs.forEach((k, v) -> v.cancel(true));

Review Comment:
   Clear before forEach was a  bug



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



Re: [PR] [Fix #3979] Fix InMemoryJobService handling in StaticWorkflowApplication [incubator-kie-kogito-runtimes]

2025-07-08 Thread via GitHub


fjtirado commented on code in PR #3980:
URL: 
https://github.com/apache/incubator-kie-kogito-runtimes/pull/3980#discussion_r2192997651


##
kogito-serverless-workflow/kogito-serverless-workflow-executor-core/src/test/java/org/kie/kogito/serverless/workflow/executor/StaticFluentWorkflowApplicationTest.java:
##
@@ -165,13 +158,6 @@ void testSwitchLoop() throws InterruptedException, 
TimeoutException {
 OperationStateBuilder sleepState = operation().action(call(expr("inc", 
".count=.count+1")).sleepAfter(Duration.ofSeconds(1)));
 
 try (StaticWorkflowApplication application = 
StaticWorkflowApplication.create()) {
-ProcessConfig processConfig = 
application.config().get(ProcessConfig.class);

Review Comment:
   This test should not have been modified, but StaticWorkflowApplication 
changed to make it work, as in this PR



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



Re: [PR] [Fix #3979] Fix InMemoryJobService handling in StaticWorkflowApplication [incubator-kie-kogito-runtimes]

2025-07-08 Thread via GitHub


fjtirado commented on code in PR #3980:
URL: 
https://github.com/apache/incubator-kie-kogito-runtimes/pull/3980#discussion_r2192994600


##
api/kogito-services/src/main/java/org/kie/kogito/services/jobs/impl/InMemoryJobService.java:
##
@@ -117,17 +103,14 @@ public String rescheduleJob(JobDescription 
jobDescription) {
 
 protected long calculateDelay(JobDescription description) {
 long delay = Duration.between(ZonedDateTime.now(), 
description.expirationTime().get()).toMillis();
-if (delay <= 0) {
-return 1;
-}
-return delay;
+return delay <= 0 ? 1 : delay;
 }
 
 @Override
 public void close() throws Exception {
 LOGGER.info("closing in memory job service");
-scheduledJobs.clear();
 scheduledJobs.forEach((k, v) -> v.cancel(true));

Review Comment:
   Clear before forEach is an ominous bug



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



Re: [PR] [Fix #3979] Fix InMemoryJobService handling in StaticWorkflowApplication [incubator-kie-kogito-runtimes]

2025-07-08 Thread via GitHub


fjtirado commented on code in PR #3980:
URL: 
https://github.com/apache/incubator-kie-kogito-runtimes/pull/3980#discussion_r2192994600


##
api/kogito-services/src/main/java/org/kie/kogito/services/jobs/impl/InMemoryJobService.java:
##
@@ -117,17 +103,14 @@ public String rescheduleJob(JobDescription 
jobDescription) {
 
 protected long calculateDelay(JobDescription description) {
 long delay = Duration.between(ZonedDateTime.now(), 
description.expirationTime().get()).toMillis();
-if (delay <= 0) {
-return 1;
-}
-return delay;
+return delay <= 0 ? 1 : delay;
 }
 
 @Override
 public void close() throws Exception {
 LOGGER.info("closing in memory job service");
-scheduledJobs.clear();
 scheduledJobs.forEach((k, v) -> v.cancel(true));

Review Comment:
   Clear before forEach was an ominous bug



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



Re: [PR] [Fix #3979] Fix InMemoryJobService handling in StaticWorkflowApplication [incubator-kie-kogito-runtimes]

2025-07-08 Thread via GitHub


fjtirado commented on code in PR #3980:
URL: 
https://github.com/apache/incubator-kie-kogito-runtimes/pull/3980#discussion_r2192994600


##
api/kogito-services/src/main/java/org/kie/kogito/services/jobs/impl/InMemoryJobService.java:
##
@@ -117,17 +103,14 @@ public String rescheduleJob(JobDescription 
jobDescription) {
 
 protected long calculateDelay(JobDescription description) {
 long delay = Duration.between(ZonedDateTime.now(), 
description.expirationTime().get()).toMillis();
-if (delay <= 0) {
-return 1;
-}
-return delay;
+return delay <= 0 ? 1 : delay;
 }
 
 @Override
 public void close() throws Exception {
 LOGGER.info("closing in memory job service");
-scheduledJobs.clear();
 scheduledJobs.forEach((k, v) -> v.cancel(true));

Review Comment:
   Clear before forEach is a bug



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



Re: [PR] [Fix #3979] Fix InMemoryJobService handling in StaticWorkflowApplication [incubator-kie-kogito-runtimes]

2025-07-08 Thread via GitHub


fjtirado commented on code in PR #3980:
URL: 
https://github.com/apache/incubator-kie-kogito-runtimes/pull/3980#discussion_r2192996667


##
api/kogito-services/src/main/java/org/kie/kogito/services/jobs/impl/StaticJobService.java:
##
@@ -20,12 +20,11 @@
 
 public class StaticJobService {
 
-private static InMemoryJobService INSTANCE;
+private static class InstanceHolder {
+private static InMemoryJobService INSTANCE = new InMemoryJobService();
+}
 
 public static InMemoryJobService staticJobService() {
-if (INSTANCE == null) {

Review Comment:
   This might cause double initilization of the static intance when multi 
threading



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]