You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kie.apache.org by "nikhiln64 (via GitHub)" <gi...@apache.org> on 2026/07/15 02:03:11 UTC
[PR] [incubator-kie-drools-6758] Register concrete project classloaders as parallel capable [incubator-kie-drools]
nikhiln64 opened a new pull request, #6809:
URL: https://github.com/apache/incubator-kie-drools/pull/6809
**Issue**:
* https://github.com/apache/incubator-kie-drools/issues/6758
**Summary**
Parallel capability is per-class, not inherited: `ProjectClassLoader` calls `registerAsParallelCapable()`, but the JVM checks the loader's **concrete runtime class** (and its whole superclass chain), so the concrete loaders never benefited - `getClassLoadingLock` fell back to locking the loader instance, serializing every class load through one monitor.
Registered all five concrete classes: `DynamicProjectClassLoader`, `IBMDynamicClassLoader`, `StaticProjectClassLoader`, `IBMStaticClassLoader`, and `DummyInternalTypesClassLoader` (the dynamic `DefaultInternalTypesClassLoader` already had it).
Thread-safety audit of what parallel loading newly exposes: the `defineType`/`defineClass`/`undefineClass` paths are already `synchronized`, and the `loadedClasses`/`nonExistingClasses` caches are `ConcurrentHashMap`s - the base class was designed for this; the subclasses just never opted in.
**Testing**
New tests in both wiring modules use a probe subclass: `registerAsParallelCapable()` returns `false` when any ancestor class is not itself registered, so the assertion is deterministic (no timing games) and goes red if a registration is ever removed - verified red against the unfixed loaders, green with the fix. Full `drools-wiring-dynamic` + `drools-wiring-static` test suites pass on JDK 17.
Developed with AI assistance (Claude Code), reviewed and driven by a human.
--
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: [PR] [incubator-kie-drools-6758] Register concrete project classloaders as parallel capable [incubator-kie-drools]
Posted by "tkobayas (via GitHub)" <gi...@apache.org>.
tkobayas merged PR #6809:
URL: https://github.com/apache/incubator-kie-drools/pull/6809
--
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: [PR] [incubator-kie-drools-6758] Register concrete project classloaders as parallel capable [incubator-kie-drools]
Posted by "nikhiln64 (via GitHub)" <gi...@apache.org>.
nikhiln64 commented on PR #6809:
URL: https://github.com/apache/incubator-kie-drools/pull/6809#issuecomment-4994476937
Thanks for the careful look @mariofusco - I dug into the history before this PR and again now, and I'd like to share what I found, because I think this PR completes an old fix rather than re-attempts a reverted one.
**The past attempt appears to have stuck, not reverted:** parallel-capable registration was introduced by 4381219ecf / #1874 (RHPAM-795/RHPAM-55, 2018) - and notably it was itself a **deadlock fix** (the commit adds "a test for a classloader deadlock"). That registration is still present today in `ProjectClassLoader` (drools-wiring-api, line 55), together with the descendant of that deadlock regression test (`ClassLoaderTest` in drools-wiring-dynamic). Searching `-S registerAsParallelCapable` across all branches I find no revert - only the 2018 introduction and the 2019 wiring-module split (#2652). If the revert you remember was in a different repo (jBPM/RHPAM product layer?), I'd genuinely appreciate the pointer.
**The gap this PR closes:** when the split created the concrete subclasses, the per-class registration wasn't carried over - and the JVM checks the loader's *runtime* class, so the 2018 registration is silently inert for every `DynamicProjectClassLoader`/`StaticProjectClassLoader` instance. `getClassLoadingLock` returns `this`, i.e. exactly the coarse-lock configuration the 2018 fix was eliminating.
**Relation to #6758:** the reporter runs unit tests where each scenario loads a test-specific subset of rules concurrently and hits the single-monitor serialization. So the benefit claimed here is not raw throughput - it's (a) restoring the deadlock-avoidance property of #1874 for the loaders actually instantiated at runtime, and (b) unblocking concurrent class loading for use cases like the reporter's.
That said, you have institutional memory I don't. I'm happy to (1) add a JMH or multi-threaded stress benchmark quantifying the concurrent-load behavior if that would help, or (2) park this if the team's risk assessment says the coarse lock is the safer default - your call either way.
--
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: [PR] [incubator-kie-drools-6758] Register concrete project classloaders as parallel capable [incubator-kie-drools]
Posted by "nikhiln64 (via GitHub)" <gi...@apache.org>.
nikhiln64 commented on PR #6809:
URL: https://github.com/apache/incubator-kie-drools/pull/6809#issuecomment-5029130816
@mariofusco I went deeper on this after the rerun on the rebased branch showed the same failures. The CI logs point somewhere unexpected. Right before the KJarLoadingTest errors there is a stream of warnings from MavenRepository.resolveArtifact saying it is unable to resolve org.drools.testcoverage:drools-kie-ci-with-domain-test-kjar:999-SNAPSHOT. So the tests are failing while resolving the fixture kjar through the embedded maven machinery, which happens before any class loading that this change could influence. The "Cannot find KieModule" message is what surfaces after the scanner swallows that resolution failure.
I also redid the local comparison more carefully this time. I installed the test kjar and domain modules into my local repo first, then ran the kieci suite with my change applied and again with the parent commit's wiring sources reinstalled. The outcome was identical in both states every time.
Given that main is green and the recently passing PRs only touched dependency versions, my best guess is that the PR build computes its module set from the diff, and when only drools-wiring changes the test kjar does not get built into the repository the kieci tests resolve from. Is that a known quirk of the kieci standalone suite? If there is a preferred way to debug or force the kjar build in the PR pipeline I am happy to do it, and equally happy to be proven wrong if you see a real interaction here.
--
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: [PR] [incubator-kie-drools-6758] Register concrete project classloaders as parallel capable [incubator-kie-drools]
Posted by "mariofusco (via GitHub)" <gi...@apache.org>.
mariofusco commented on PR #6809:
URL: https://github.com/apache/incubator-kie-drools/pull/6809#issuecomment-4999780282
I'm afraid that the test failures in CI could be also related and caused by this change. Please check them and if they aren't it is ok for me to try to merge this PR.
I just relaunched CI to see what happens.
--
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: [PR] [incubator-kie-drools-6758] Register concrete project classloaders as parallel capable [incubator-kie-drools]
Posted by "nikhiln64 (via GitHub)" <gi...@apache.org>.
nikhiln64 commented on PR #6809:
URL: https://github.com/apache/incubator-kie-drools/pull/6809#issuecomment-5024700917
@mariofusco I investigated the CI failures before asking you to consider merging - status so far:
**What fails:** `KJarLoadingTest` (kie-ci, with+without domain) with `Cannot find KieModule: ...999-SNAPSHOT` at container init - a module *resolution* failure, before any class loading through the project classloaders happens.
**What I could and couldn't prove locally:** in my local environment the test fails **identically with and without this change** (checked out the parent commit's wiring sources, reinstalled, reran) - so I can't reproduce a causal link locally; but my environment can't resolve the test KJar in either state, so I don't treat that as conclusive for CI.
**One variable I could eliminate:** this branch was based on a Jul 14 main while the recently passing PRs run on current main (which since picked up e.g. the quarkus bump in #6808). I've rebased onto today's main and pushed, which should also re-trigger CI.
If CI still shows the KJar failures on the fresh base, I'll treat that as real evidence of an interaction with this change and dig into the kie-ci module discovery path before this goes anywhere near a merge - I would not want it merged with an unexplained failure either.
--
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: [PR] [incubator-kie-drools-6758] Register concrete project classloaders as parallel capable [incubator-kie-drools]
Posted by "tkobayas (via GitHub)" <gi...@apache.org>.
tkobayas commented on PR #6809:
URL: https://github.com/apache/incubator-kie-drools/pull/6809#issuecomment-5031234646
I confirmed that the `CI :: Build` issue is reproducible with a simple edit in a file in `drools-wiring`. I filed a GH issue and will work on a fix : https://github.com/apache/incubator-kie-drools/issues/6819
So the CI failure doesn't block this PR. `Drools` job is green, we may think that the tests passed.
--
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