martinweiler commented on PR #6218: URL: https://github.com/apache/incubator-kie-drools/pull/6218#issuecomment-2596550685
Hi @yesamer - thanks for looking into this. Let's take a look at the stacktrace posted in https://github.com/apache/incubator-kie-issues/issues/1753, from the bottom up: ``` "kogito-event-executor-12" #68 daemon prio=5 os_prio=0 cpu=4286.47ms elapsed=215.32s tid=0x00007f2f3d989670 nid=0x6a waiting for monitor entry [0x00007f2f3c7b6000] java.lang.Thread.State: BLOCKED (on object monitor) at java.util.zip.ZipFile.getEntry([email protected]/ZipFile.java:337) - locked <0x00000007408c6270> (a sun.net.www.protocol.jar.URLJarFile) at java.util.jar.JarFile.getEntry([email protected]/JarFile.java:513) at sun.net.www.protocol.jar.URLJarFile.getEntry([email protected]/URLJarFile.java:131) at sun.net.www.protocol.jar.JarURLConnection.connect([email protected]/JarURLConnection.java:135) at sun.net.www.protocol.jar.JarURLConnection.getInputStream([email protected]/JarURLConnection.java:175) at java.net.URL.openStream([email protected]/URL.java:1161) at org.kie.internal.utils.ChainedProperties.read(ChainedProperties.java:229) at org.kie.internal.utils.ChainedProperties.getChainedProperties(ChainedProperties.java:74) at org.kie.internal.utils.ChainedProperties.getChainedProperties(ChainedProperties.java:70) at org.drools.core.impl.RuleBaseFactory.newKnowledgeSessionConfiguration(RuleBaseFactory.java:155) at org.drools.project.model.ProjectRuntime.getConfForSession(ProjectRuntime.java:83) at org.drools.project.model.ProjectRuntime.newKieSession(ProjectRuntime.java:67) at com.test.SampleProcess.lambda$process$136(DataProcess.java:2337) at com.test.SampleProcess$$Lambda$1018/0x0000000800706cc0.get(Unknown Source) at org.jbpm.workflow.instance.rule.AbstractRuleTypeEngine.getKieRuntime(AbstractRuleTypeEngine.java:35) at org.jbpm.bpmn2.rule.RuleFlowGroupRuleTypeEngineImpl.evaluate(RuleFlowGroupRuleTypeEngineImpl.java:39) ``` * [RuleFlowGroupRuleTypeEngineImpl](https://github.com/apache/incubator-kie-kogito-runtimes/blob/main/jbpm/jbpm-bpmn2/src/main/java/org/jbpm/bpmn2/rule/RuleFlowGroupRuleTypeEngineImpl.java) is the integration code that calls Drools from the BPMN process, on each BusinessRuleTask handler node * It obains a KieRuntime at the beginning of the [evaluate](https://github.com/apache/incubator-kie-kogito-runtimes/blob/main/jbpm/jbpm-bpmn2/src/main/java/org/jbpm/bpmn2/rule/RuleFlowGroupRuleTypeEngineImpl.java#L39) method * The next lines in the stack are from the code generated classes, including the `org.drools.project.model.ProjectRuntime` class, which is generated based on the template that's being modified in this PR * The `ProjectRuntime.newKieSession` method invocation results in the [getConfForSession](https://github.com/apache/incubator-kie-drools/blob/d47db1851186a60e68f83c276bc30af310030c0b/drools-model/drools-model-codegen/src/main/resources/class-templates/rules/ProjectRuntimeQuarkusTemplate.java#L69) method being called * In this method, we are seeing the contention under load, due to the [ChainedProperties](https://github.com/apache/incubator-kie-drools/blob/main/kie-internal/src/main/java/org/kie/internal/utils/ChainedProperties.java#L229) trying to read the same file in multiple threads * The proposed fix moves the reading of the creation of the `SessionConfiguration` to the application startup, instead of having it recreated on each bpmn -> drools invocation * In addition, it removes the comment regarding a cache in `ChainedProperties`, as this cache no longer exists. I hope this helps to clarify. If you see any other optimization in the whole integration code, please let us know. Thanks! -- 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]
