Skip to content

Classanalyzer race condition fix backport for 3.1 - #6111

Merged
dmatej merged 5 commits into
eclipse-ee4j:3.1from
dmatej:classanalyzer-race-backport-31
Jul 24, 2026
Merged

Classanalyzer race condition fix backport for 3.1#6111
dmatej merged 5 commits into
eclipse-ee4j:3.1from
dmatej:classanalyzer-race-backport-31

Conversation

@dmatej

@dmatej dmatej commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

OndroMih and others added 5 commits July 23, 2026 20:57
Happens when many threads execute REST client call at the same.

Symptom:

Occasional 
IllegalStateException: Could not find an implementation of ClassAnalyzer with name CdiInjecteeSkippingClassAnalyzer
from WebTarget.request

Reason for the exception:
* The injectionManager is set earlier than it's used, it's stored to a shared volatile variable and later picked up
* If some thread sets the shared volatile variable to another injectionManager, the original thread would use another threads injectionManager
* In case the second thread doesn't bind the ClassAnalyzer class in time before the first thread uses it, the first thread won't have ClassAnalyzer bean available and throws exception
Remove the thread local from the correct component (same as retrieved in the CdiComponentProvider.initialize method)

Save a few nanoseconds by calling get instead of set on the thread local, log an error if a leaking injectionManager detected.
If ClientRuntime needs CDI beans, it initializes CdiComponentProvider again, we need to clean up later.
Signed-off-by: David Matějček <david.matejcek@omnifish.ee>
@dmatej dmatej added this to the 3.1.13 milestone Jul 23, 2026
@dmatej
dmatej requested a review from a team July 23, 2026 20:45
@lprimak

lprimak commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

LGTM, thanks David!

@OndroMih

Copy link
Copy Markdown
Contributor

LGTM too

@dmatej
dmatej merged commit 1537733 into eclipse-ee4j:3.1 Jul 24, 2026
7 checks passed
@dmatej
dmatej deleted the classanalyzer-race-backport-31 branch July 24, 2026 06:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants