Skip to content

Bug: Apache transport deadlock in concurrent use case - #1953

Merged
cstamas merged 2 commits into
apache:masterfrom
cstamas:concurrency-http-transport
Jul 8, 2026
Merged

Bug: Apache transport deadlock in concurrent use case#1953
cstamas merged 2 commits into
apache:masterfrom
cstamas:concurrency-http-transport

Conversation

@cstamas

@cstamas cstamas commented Jul 8, 2026

Copy link
Copy Markdown
Member

Make sure the class SSLConnectionSocketFactory is initialized early, instead lazily in ConcurrentHashMap.computeIfAbsent, as latter may cause deadlock.

Refs:

Make sure the class SSLConnectionSocketFactory is initialized
early, instead lazily in ConcurrentHashMap.computeIfAbsent, as
latter may cause deadlock.

Ref:
quarkusio/quarkus#55317
@cstamas
cstamas marked this pull request as ready for review July 8, 2026 11:28
@cstamas cstamas added the bug Something isn't working label Jul 8, 2026
@cstamas cstamas self-assigned this Jul 8, 2026

@gnodet gnodet left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean, well-targeted fix for a real deadlock — the pattern (eager class initialization to avoid the documented ConcurrentHashMap.computeIfAbsent hazard) is sound and well-established.

Evaluation:

  • Correctness: The JVM guarantees GlobalState.<clinit> completes before any static/instance members are used, so SSLConnectionSocketFactory is fully initialized before computeIfAbsent is ever reached.
  • Sufficiency: A single call to getDefaultHostnameVerifier() triggers SSLConnectionSocketFactory.<clinit>, which initializes the class once. All three usage points (lines 153, 166, 190) then access an already-initialized class.
  • Scope: Minimal, focused change — exactly what's needed.
  • Tests: No tests added, but acceptable — class-initialization deadlocks are inherently timing-sensitive and non-deterministic.

Minor observation (non-blocking): The comment references the Quarkus PR (quarkus/pull/55345) which is the downstream workaround. Consider also linking to the Quarkus issue (quarkus/issues/55317) which contains the detailed thread-dump and root-cause analysis, for future maintainer context.

This review was generated by an AI agent and may contain inaccuracies. Please verify all suggestions before applying.

@cstamas
cstamas merged commit 5953267 into apache:master Jul 8, 2026
14 checks passed
@cstamas
cstamas deleted the concurrency-http-transport branch July 8, 2026 11:48
@github-actions github-actions Bot added this to the 2.0.21 milestone Jul 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants