Skip to content

fix(search): pin httpclient5 to 5.5.2 and bound the connection-request timeout - #31657

Merged
pmbrull merged 1 commit into
mainfrom
pmbrull/fix-hc5-client-core-skew
Aug 18, 2026
Merged

pmbrull merged 1 commit into
mainfrom
pmbrull/fix-hc5-client-core-skew

Conversation

@pmbrull

@pmbrull pmbrull commented Aug 17, 2026 •

Copy link
Copy Markdown
Member

Problem

Search dies completely and never recovers. Every OpenSearch-backed endpoint fails while everything else stays healthy.

Observed in production over a 20+ minute window:

Endpoints not touching OpenSearch p50 3ms (loggedInUser 38ms, docStore 5ms, tasks/visible 21ms)
Endpoints touching OpenSearch 195,000–257,000ms, 20 of 20 search/query → 500

slowrequest confirms where it goes: search: 257467ms, searchOps: 1. DB, Jetty and gRPC were all fine.

The only error in the logs, thousands of times, is:

org.apache.hc.core5.util.DeadlineTimeoutException: Deadline: ..., -29839 MILLISECONDS overdue
	at org.apache.hc.core5.pool.StrictConnPool.processPendingRequest(StrictConnPool.java:319)
	at org.apache.hc.client5.http.impl.nio.PoolingAsyncClientConnectionManager$1.closeExpired(...)
	at org.apache.hc.core5.reactor.IdleConnectionEvictor.lambda$new$0(...)

Zero successes. Zero response timeouts. Zero connect errors. Only the evictor sweeping rotted pool leases.

Root cause

Version skew introduced by #31442. Pinning httpcore5 to 5.4.3 for CVE-2026-54399 left httpclient5 unmanaged, so it resolved to 5.5 — a release built against httpcore5 5.3.4:

httpclient5 built against httpcore5
5.5 (what resolves today) 5.3.4
5.5.2 5.3.6 — changelog: "Fixed incompatibility with HttpCore 5.4"
5.6 5.4

Verified in the current tree:

org.apache.httpcomponents.client5:httpclient5:jar:5.5:runtime
 \- org.apache.httpcomponents.core5:httpcore5-h2:jar:5.4.3:runtime
    org.apache.httpcomponents.core5:httpcore5:jar:5.4.3:runtime

SingleCoreIOReactor was substantially rewritten between 5.3.4 and 5.4.3 (406 added / 291 removed / 72 modified lines), while MultiCoreIOReactor, IOWorkers and IOReactorWorker are byte-identical — the client's assumptions about reactor lifecycle did not move with the reactor underneath.

Why that produces exactly the symptoms above, all verified in HC5 source:

  1. A Throwable on an I/O dispatcher kills its SingleCoreIOReactor. IOReactorWorker.run() stores it in a package-private field nothing reads and the thread exits — silently, no log, no callback.
  2. MultiCoreIOReactor.status is only ever written by start() / initiateShutdown() / close(). A dead dispatcher never flips it, so the client stays ACTIVE and keeps accepting requests. A status check cannot detect this.
  3. Timeout enforcement lives inside SingleCoreIOReactor.execute()'s select loop (checkTimeout). A dead loop enforces nothing — hence 20+ minutes with no response timeout despite socketTimeoutSecs: 120.
  4. Connections bound to a dead dispatcher are leased forever. IOWorkers selection is blind round-robin with no health awareness, so pool slots keep migrating onto dead dispatchers.
  5. Once the pool is at maxConnPerRoute, no new connect is attempted, so IOReactorShutdownException never surfaces. Leases just queue.
  6. Queued leases rot until the connection-request deadline → DeadlineTimeoutException. Permanent; no recovery path exists short of a restart.

SafeResponseConsumer (#27698) guards only the response-consumer path, so it does not cover this.

Changes

1. Pin httpclient5 to 5.5.2 so it moves together with the httpcore5 pin.

5.5.2 over 5.6 deliberately: 5.6 is the release paired with the 5.4 core line, but it changes default hostname verification to BUILTIN and enables 5s TCP keep-alive by default. Both need TLS validation against createElasticSearchSSLContext / truststorePath setups. 5.5.2 is a patch on the 5.5 line that carries exactly the compatibility fix, with no breaking changes. 5.6 is worth doing separately.

2. Bound connectionRequestTimeout to 10s in both OpenSearchClient and ElasticSearchClient.

Both set connect and response timeouts but never set the connection-request (pool lease) timeout, leaving HC5's 3-minute default. A saturated pool therefore blocks a Jetty thread for three minutes per request before failing. This is independent of the version bug and worth having regardless — it turns a multi-minute hang into a fast error.

Verification

Resolution after the pin, including the shaded uber-jar (which bundles org.apache.hc.* unrelocated, so it needed checking):

# openmetadata-service
\- org.apache.httpcomponents.client5:httpclient5:jar:5.5.2
   +- org.apache.httpcomponents.core5:httpcore5:jar:5.4.3
   \- org.apache.httpcomponents.core5:httpcore5-h2:jar:5.4.3

# openmetadata-shaded-deps/opensearch-dep
+- org.apache.httpcomponents.client5:httpclient5:jar:5.5.2:compile
+- org.apache.httpcomponents.core5:httpcore5:jar:5.4.3:compile
\- org.apache.httpcomponents.core5:httpcore5-h2:jar:5.4.3:compile

mvn -pl openmetadata-service compile → BUILD SUCCESS. mvn spotless:apply clean.

CVE-2026-54399 stays closed — httpcore5 remains at 5.4.3.

Follow-ups (not in this PR)

  • SearchIndexMetrics.countMissingIndices probes every index individually — 71 mappings × 2 calls. refreshStats() already fetches listIndicesByPrefix(""); diffing that against getEntityIndexMap() keys would make it 1 call.
  • DatabseAndSearchServiceStatusJob has no @DisallowConcurrentExecution. During this outage 9 concurrent instances were observed across Quartz workers 1-5 and 7-10, consuming the entire 10-thread DefaultQuartzScheduler pool, so no scheduled job could run at all.

🤖 Generated with Claude Code

Greptile Summary

This PR pins Apache HttpClient 5.5.2 to remain compatible with the existing HttpCore 5.4.3 pin and adds a 10-second connection-pool lease timeout to both search clients.

  • Adds consistent connection-request timeout handling for Elasticsearch and OpenSearch.
  • Prevents pool saturation from blocking service threads for the previous three-minute default.
  • Aligns the managed HttpClient dependency used by the service and shaded search transports.

Confidence Score: 5/5

The PR appears safe to merge, with no concrete blocking or independently actionable non-blocking issues identified.

The dependency pin consistently applies the intended HC5 compatibility pairing, and both search-client builders now bound connection-pool acquisition without evidence of a broken build, ineffective configuration, or reachable regression.

Important Files Changed

Filename Overview
openmetadata-service/src/main/java/org/openmetadata/service/search/elasticsearch/ElasticSearchClient.java Adds a bounded connection-request timeout to the Elasticsearch HC5 request configuration; no actionable defect identified.
openmetadata-service/src/main/java/org/openmetadata/service/search/opensearch/OpenSearchClient.java Adds the same bounded pool-lease timeout to the OpenSearch transport configuration; no actionable defect identified.
pom.xml Manages httpclient5 at 5.5.2 alongside the existing httpcore5 5.4.3 pins to avoid the documented compatibility failure.

Reviews (1): Last reviewed commit: "fix(search): pin httpclient5 to 5.5.2 an..." | Re-trigger Greptile

Context used:

…t timeout

Two related fixes for a total, unrecoverable loss of search.

1. Version skew. Pinning httpcore5 to 5.4.3 for CVE-2026-54399 left
   httpclient5 unmanaged, so it resolved to 5.5 — a release built against
   httpcore5 5.3.4. Apache fixed HttpClient's incompatibility with the
   HttpCore 5.4 branch in httpclient5 5.5.2.

   On the mismatched pair, SingleCoreIOReactor dispatchers die on the I/O
   thread. IOReactorWorker stores the Throwable in a field nothing reads
   and the thread exits, and MultiCoreIOReactor's status is only ever
   written by start/initiateShutdown/close, so the client stays ACTIVE and
   keeps accepting work. Connections bound to a dead dispatcher are leased
   forever and no timeout fires, because timeout enforcement lives inside
   the dispatcher's own select loop. Once every maxConnPerRoute slot is a
   zombie, all search calls queue until the connection-request deadline
   and fail with DeadlineTimeoutException. Nothing recovers it but a
   restart.

   SafeResponseConsumer (#27698) guards only the response-consumer path,
   so it does not cover this.

2. Unbounded lease wait. Both clients set connect and response timeouts
   but never setConnectionRequestTimeout, leaving HC5's 3-minute default.
   A saturated pool therefore blocks a Jetty thread for three minutes per
   request before failing. Bound it to 10s so callers fail fast.

Observed in production: 100% of search-backed endpoints failing for 20+
minutes, p50 195-257s, while every non-search endpoint stayed at ~3ms.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@pmbrull
pmbrull requested a review from a team as a code owner August 17, 2026 21:13
Copilot AI lite review requested due to automatic review settings August 17, 2026 21:13

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

This PR cannot be merged until the following are addressed on its linked issue:

  • No GitHub issue is linked. Link an issue in the Development section of the PR (or add Fixes #12345 to the description). For a same-org cross-repo issue, add Fixes open-metadata/<repo>#123 to the description.

The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically.

Maintainers can bypass this check by adding the skip-pr-checks label.

@github-actions github-actions Bot added Ingestion safe to test Add this label to run secure Github workflows on PRs labels Aug 17, 2026
@gitar-bot

gitar-bot Bot commented Aug 17, 2026

Copy link
Copy Markdown
Code Review ✅ Approved

Pins httpclient5 to 5.5.2 to resolve version skew with httpcore5 and bounds the connection-request timeout to 10 seconds. No issues found.

Options

Display: compact → Showing less information.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

@github-actions

Copy link
Copy Markdown
Contributor

✅ Playwright Results — workflow succeeded

Validated commit 9fedf5c6b1a1b2e9b15c2ec17a047d5bb784646b in Playwright run 32070017523, attempt 1.

✅ 1027 passed · ❌ 0 failed · 🟡 0 flaky · ⏭️ 0 skipped · 🧰 0 lifecycle flaky

Performance

Blocking targets: ✅ met · Optimization targets: 🟡 in progress

Shard-job maxima below are not the full workflow wall time; the linked run includes build, fixture, planning, and reporting.

🕒 Full workflow signal wall (to summary) 1h 12m 2s

⏱️ Max setup 3m 5s · max shard execution 17m 9s · max shard-job elapsed before upload 25m 3s · reporting 5s

🌐 195.54 requests/attempt · 2.21 app boots/UI scenario · 12.05% common-shard skew

Optimization targets still in progress:

  • Application boot ratio was 2.21 per UI scenario (2310 boots / 1043 scenarios; convergence target: at most 1).
Shard Passed Failed Flaky Skipped Lifecycle failed Lifecycle flaky
✅ Shard chromium-01 121 0 0 0 0 0
✅ Shard chromium-02 138 0 0 0 0 0
✅ Shard chromium-03 154 0 0 0 0 0
✅ Shard chromium-04 143 0 0 0 0 0
✅ Shard chromium-05 141 0 0 0 0 0
✅ Shard chromium-06 143 0 0 0 0 0
✅ Shard data-asset-rules-01 61 0 0 0 0 0
✅ Shard domain-isolation-01 14 0 0 0 0 0
✅ Shard global-state-01 34 0 0 0 0 0
✅ Shard import-export-01 7 0 0 0 0 0
✅ Shard ingestion-01 2 0 0 0 0 0
✅ Shard reindex-01 28 0 0 0 0 0
✅ Shard search-01 12 0 0 0 0 0
✅ Shard search-rbac-01 29 0 0 0 0 0

📦 Download artifacts

How to debug locally
# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip    # view trace

@pmbrull
pmbrull merged commit 444b955 into main Aug 18, 2026
178 of 188 checks passed
@pmbrull
pmbrull deleted the pmbrull/fix-hc5-client-core-skew branch August 18, 2026 05:31
@github-actions

Copy link
Copy Markdown
Contributor

Changes have been cherry-picked to the 2.0 branch.

github-actions Bot pushed a commit that referenced this pull request Aug 18, 2026
…t timeout (#31657)

Two related fixes for a total, unrecoverable loss of search.

1. Version skew. Pinning httpcore5 to 5.4.3 for CVE-2026-54399 left
   httpclient5 unmanaged, so it resolved to 5.5 — a release built against
   httpcore5 5.3.4. Apache fixed HttpClient's incompatibility with the
   HttpCore 5.4 branch in httpclient5 5.5.2.

   On the mismatched pair, SingleCoreIOReactor dispatchers die on the I/O
   thread. IOReactorWorker stores the Throwable in a field nothing reads
   and the thread exits, and MultiCoreIOReactor's status is only ever
   written by start/initiateShutdown/close, so the client stays ACTIVE and
   keeps accepting work. Connections bound to a dead dispatcher are leased
   forever and no timeout fires, because timeout enforcement lives inside
   the dispatcher's own select loop. Once every maxConnPerRoute slot is a
   zombie, all search calls queue until the connection-request deadline
   and fail with DeadlineTimeoutException. Nothing recovers it but a
   restart.

   SafeResponseConsumer (#27698) guards only the response-consumer path,
   so it does not cover this.

2. Unbounded lease wait. Both clients set connect and response timeouts
   but never setConnectionRequestTimeout, leaving HC5's 3-minute default.
   A saturated pool therefore blocks a Jetty thread for three minutes per
   request before failing. Bound it to 10s so callers fail fast.

Observed in production: 100% of search-backed endpoints failing for 20+
minutes, p50 195-257s, while every non-search endpoint stayed at ~3ms.

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
(cherry picked from commit 444b955)
@github-actions

Copy link
Copy Markdown
Contributor

Changes have been cherry-picked to the 1.13 branch.

github-actions Bot pushed a commit that referenced this pull request Aug 18, 2026
…t timeout (#31657)

Two related fixes for a total, unrecoverable loss of search.

1. Version skew. Pinning httpcore5 to 5.4.3 for CVE-2026-54399 left
   httpclient5 unmanaged, so it resolved to 5.5 — a release built against
   httpcore5 5.3.4. Apache fixed HttpClient's incompatibility with the
   HttpCore 5.4 branch in httpclient5 5.5.2.

   On the mismatched pair, SingleCoreIOReactor dispatchers die on the I/O
   thread. IOReactorWorker stores the Throwable in a field nothing reads
   and the thread exits, and MultiCoreIOReactor's status is only ever
   written by start/initiateShutdown/close, so the client stays ACTIVE and
   keeps accepting work. Connections bound to a dead dispatcher are leased
   forever and no timeout fires, because timeout enforcement lives inside
   the dispatcher's own select loop. Once every maxConnPerRoute slot is a
   zombie, all search calls queue until the connection-request deadline
   and fail with DeadlineTimeoutException. Nothing recovers it but a
   restart.

   SafeResponseConsumer (#27698) guards only the response-consumer path,
   so it does not cover this.

2. Unbounded lease wait. Both clients set connect and response timeouts
   but never setConnectionRequestTimeout, leaving HC5's 3-minute default.
   A saturated pool therefore blocks a Jetty thread for three minutes per
   request before failing. Bound it to 10s so callers fail fast.

Observed in production: 100% of search-backed endpoints failing for 20+
minutes, p50 195-257s, while every non-search endpoint stayed at ~3ms.

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
(cherry picked from commit 444b955)
pmbrull added a commit that referenced this pull request Aug 18, 2026
…ntent compression (#31667)

* fix(search): move httpclient5 to 5.6.3 and disable transport-level content compression

Follow-up to #31657, which pinned httpclient5 to 5.5.2 so it stopped being
mismatched against the httpcore5 5.4 line. 5.5.2 was the minimal fix but it
still sits inside the CVE-2026-64607 range (affects 5.0-alpha1 through 5.6.2:
the classic i/o client leaks a connection when a response carries an invalid
Content-Encoding, exhausting the pool).

5.6.3 clears that CVE and is a better pairing besides: httpclient5-parent 5.6.3
declares httpcore5 5.4.3, exactly the version pinned here, whereas 5.5.2 targets
5.3.6. Client and core now come from the same line Apache releases together.

Moving to the 5.6 line requires one code change. httpclient5 5.6.0 turned on
automatic content decompression in the async client pipeline by default, and
both search transports already decompress the response body themselves. Leaving
both enabled runs the second pass over already-inflated bytes and throws
"java.util.zip.ZipException: Not in GZIP format". Disable it at the transport
layer in OpenSearchClient and ElasticSearchClient and let the search clients own
decompression.

The connection-request timeout bound from #31657 is unchanged.

Note for future bumps: the shaded uber-jars in openmetadata-shaded-deps bundle
org.apache.hc.* unrelocated, so they carry their own copy of httpclient5 and
httpcore5 and precede the standalone jars on the classpath. They inherit this
dependencyManagement block, so a clean build keeps both copies aligned - but the
pin only takes effect once those modules are rebuilt.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* test(search): disable transport-level content compression in integration test clients

The integration tests build their own OpenSearch/Elasticsearch clients, so they
need the same disableContentCompression() call as the production search clients
once httpclient5 moves to the 5.6 line. Without it they fail with
"java.util.zip.ZipException: Not in GZIP format".

Taken from #31525 by yan-3005.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

---------

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
pmbrull added a commit that referenced this pull request Aug 18, 2026
…ntent compression (#31667)

* fix(search): move httpclient5 to 5.6.3 and disable transport-level content compression

Follow-up to #31657, which pinned httpclient5 to 5.5.2 so it stopped being
mismatched against the httpcore5 5.4 line. 5.5.2 was the minimal fix but it
still sits inside the CVE-2026-64607 range (affects 5.0-alpha1 through 5.6.2:
the classic i/o client leaks a connection when a response carries an invalid
Content-Encoding, exhausting the pool).

5.6.3 clears that CVE and is a better pairing besides: httpclient5-parent 5.6.3
declares httpcore5 5.4.3, exactly the version pinned here, whereas 5.5.2 targets
5.3.6. Client and core now come from the same line Apache releases together.

Moving to the 5.6 line requires one code change. httpclient5 5.6.0 turned on
automatic content decompression in the async client pipeline by default, and
both search transports already decompress the response body themselves. Leaving
both enabled runs the second pass over already-inflated bytes and throws
"java.util.zip.ZipException: Not in GZIP format". Disable it at the transport
layer in OpenSearchClient and ElasticSearchClient and let the search clients own
decompression.

The connection-request timeout bound from #31657 is unchanged.

Note for future bumps: the shaded uber-jars in openmetadata-shaded-deps bundle
org.apache.hc.* unrelocated, so they carry their own copy of httpclient5 and
httpcore5 and precede the standalone jars on the classpath. They inherit this
dependencyManagement block, so a clean build keeps both copies aligned - but the
pin only takes effect once those modules are rebuilt.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* test(search): disable transport-level content compression in integration test clients

The integration tests build their own OpenSearch/Elasticsearch clients, so they
need the same disableContentCompression() call as the production search clients
once httpclient5 moves to the 5.6 line. Without it they fail with
"java.util.zip.ZipException: Not in GZIP format".

Taken from #31525 by yan-3005.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

---------

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
pmbrull added a commit that referenced this pull request Aug 18, 2026
…ntent compression (#31667)

* fix(search): move httpclient5 to 5.6.3 and disable transport-level content compression

Follow-up to #31657, which pinned httpclient5 to 5.5.2 so it stopped being
mismatched against the httpcore5 5.4 line. 5.5.2 was the minimal fix but it
still sits inside the CVE-2026-64607 range (affects 5.0-alpha1 through 5.6.2:
the classic i/o client leaks a connection when a response carries an invalid
Content-Encoding, exhausting the pool).

5.6.3 clears that CVE and is a better pairing besides: httpclient5-parent 5.6.3
declares httpcore5 5.4.3, exactly the version pinned here, whereas 5.5.2 targets
5.3.6. Client and core now come from the same line Apache releases together.

Moving to the 5.6 line requires one code change. httpclient5 5.6.0 turned on
automatic content decompression in the async client pipeline by default, and
both search transports already decompress the response body themselves. Leaving
both enabled runs the second pass over already-inflated bytes and throws
"java.util.zip.ZipException: Not in GZIP format". Disable it at the transport
layer in OpenSearchClient and ElasticSearchClient and let the search clients own
decompression.

The connection-request timeout bound from #31657 is unchanged.

Note for future bumps: the shaded uber-jars in openmetadata-shaded-deps bundle
org.apache.hc.* unrelocated, so they carry their own copy of httpclient5 and
httpcore5 and precede the standalone jars on the classpath. They inherit this
dependencyManagement block, so a clean build keeps both copies aligned - but the
pin only takes effect once those modules are rebuilt.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* test(search): disable transport-level content compression in integration test clients

The integration tests build their own OpenSearch/Elasticsearch clients, so they
need the same disableContentCompression() call as the production search clients
once httpclient5 moves to the 5.6 line. Without it they fail with
"java.util.zip.ZipException: Not in GZIP format".

Taken from #31525 by yan-3005.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

---------

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>

This branch was previously deployed

1 inactive deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Ingestion safe to test Add this label to run secure Github workflows on PRs To release Will cherry-pick this PR into the release branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants