Skip to content

Retry Azure client network and DNS errors instead of reporting a synthetic 500 - #115269

Merged
arsenmuk merged 2 commits into
masterfrom
arsenmuk/az-net-retryable
Aug 24, 2026
Merged

arsenmuk merged 2 commits into
masterfrom
arsenmuk/az-net-retryable

Conversation

@arsenmuk

@arsenmuk arsenmuk commented Aug 18, 2026 •

Copy link
Copy Markdown
Member

#112871 fixed transient Azure timeouts being misreported as broken data parts. The
follow-up suggestion (#112871 (comment))
was to extend that to Poco::Net::NetException, Poco::IOException and DB::NetException,
which the Azure HTTP client still turns into a synthetic 500.

Changes:

  • added handling for Poco::IOException, which also covers Poco::Net::NetException
  • added handling for DB::NetException
  • also tolerate transport errors in the container-existence check so an unreachable Azure disk doesn't crash startup (covered by test_azure_disk_unreachable)
  • added testing

Both new handlers throw Azure::Core::Http::TransportException (retryable, like the
existing timeout handler) and match the S3 client.

Changelog category (leave one):

  • Improvement

Changelog entry:

Azure client-side network failures (connection reset/refused, DNS and TLS errors) are now
retried as transport errors instead of surfacing as a synthetic 500, matching the S3
client.


Workflow [PR]
Sync PR [sync-upstream/pr/115269]

Version info

  • Merged into: 26.8.1.1990 (included in 26.8 and later)

…rors

makeRequestInternalImpl caught client-side transport failures only via the
terminal catch(...), turning them into a synthetic InternalServerError(500)
response. Add catch(const Poco::IOException&) — covering the whole
Poco::Net::NetException family (connection reset/refused, DNS, TLS) plus generic
IO — and catch(const NetException&) for ClickHouse's own DB::NetException(DNS_ERROR)
from makeHTTPSession, which is not a Poco::IOException. Both mirror the existing
Poco::TimeoutException arm and throw Azure::Core::Http::TransportException, so
network errors are retried unconditionally by the SDK rather than relying on 500
being in the retryable status set (matches the S3 client at src/IO/S3/PocoHTTPClient.cpp).

Add azure_inject_poco_network_error[_once] failpoints and a "network" case in
the test_azure_403_handling suite.

Follow-up to #112871, addresses review comment
#112871 (comment)
@clickhouse-gh

clickhouse-gh Bot commented Aug 18, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [7633f63]

Summary: ✅


AI Review

Summary

This PR teaches the Azure HTTP transport to rethrow more client-side failures as retryable Azure::Core::Http::TransportExceptions and makes the startup container probe tolerate those transport failures the same way it already tolerates synthetic 500s. The code change itself is plausible, but the PR still does not prove the DNS-specific DB::NetException path that the title and description explicitly promise.

Tests
  • ⚠️ The new catch (const NetException &) branch in src/IO/AzureBlobStorage/PocoHTTPClient.cpp:589 is the DNS_ERROR / HostResolver path the PR is adding, but the added "network" test case in tests/integration/test_azure_403_handling/test.py:51 only injects Poco::Net::ConnectionResetException, which exercises the Poco::IOException arm described in the comment at src/IO/AzureBlobStorage/PocoHTTPClient.cpp:390. Please add one focused regression that forces makeHTTPSession / HostResolver to raise DB::NetException(DNS_ERROR) and verifies it is retried instead of surfacing as the synthetic 500.
Final Verdict
  • Status: ⚠️ Request changes
  • Minimum required actions: add focused regression coverage for the DB::NetException(DNS_ERROR) branch the PR claims to fix.

LLVM Coverage Report

Metric Baseline Current Δ
Lines 86.90% 86.90% +0.00%
Functions 92.00% 92.00% +0.00%
Branches 79.30% 79.30% +0.00%

Changed lines: Changed C/C++ lines covered: 39/40 (97.50%) · Uncovered code

Full report · Diff report

@clickhouse-gh clickhouse-gh Bot added the pr-improvement Pull request with some product improvements label Aug 18, 2026
@arsenmuk arsenmuk assigned arsenmuk and CheSema and unassigned arsenmuk Aug 18, 2026
@arsenmuk
arsenmuk marked this pull request as ready for review August 18, 2026 10:19

throw Azure::Core::Http::TransportException(getCurrentExceptionMessageAndPattern(true).text);
}
catch (const NetException &)

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.

This new branch is the one that turns DB::NetException from makeHTTPSession / HostResolver into a retryable TransportException, i.e. it is the actual DNS_ERROR path the PR body is promising. The added integration case only injects Poco::Net::ConnectionResetException, so it proves the Poco::IOException arm but still leaves this DNS-specific handler unexercised. Please add one focused regression test that forces a DB::NetException(DNS_ERROR) here and verifies we retry it instead of surfacing the synthetic 500 / reporting the part broken.

@clickhouse-gh

clickhouse-gh Bot commented Aug 18, 2026 •

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing 7633f63ad with master adae6c4db (stripped binary size, per-symbol sizes and ThinLTO time; compile times per translation unit against the most recent warmup build that recompiled it).

✅ No significant changes.

Binary sizes
Binary Master PR Δ
programs/clickhouse-stripped 702.04 MiB 699.01 MiB -3.03 MiB (-0.43%)

Only the stripped binary is compared: the official master build keeps debug symbols while PR builds strip them, so the other binaries differ by construction.

Compile time of recompiled translation units

11 translation units recompiled, 19 s compile time in total, 11 of them have a recent master baseline.

Job report

containerExists() only assumed the container exists on a synthetic-500 StorageException, but transport/DNS failures now surface as a TransportException, which propagated out and aborted server startup (and Azure table DDL) against an unreachable endpoint. Catch TransportException too and assume-exists, mirroring the InternalServerError arm; real I/O keeps the retryable-propagation behaviour.

Fixes test_azure_disk_unreachable::test_server_starts_with_unreachable_azure_disk and test_mask_sensitive_info::test_create_table.
@arsenmuk
arsenmuk added this pull request to the merge queue Aug 24, 2026
Merged via the queue into master with commit 94a1553 Aug 24, 2026
344 of 347 checks passed
@arsenmuk
arsenmuk deleted the arsenmuk/az-net-retryable branch August 24, 2026 08:41
@robot-ch-test-poll robot-ch-test-poll added the pr-synced-to-cloud The PR is synced to the cloud repo label Aug 24, 2026
groeneai added a commit to groeneai/ClickHouse that referenced this pull request Oct 23, 2026
On master the Azure transport now throws `TransportException` for a
timeout or a broken connection (ClickHouse#112871, ClickHouse#115269) instead of
returning a synthetic 408 or 500 from `PocoAzureHTTPClient`.
`TransportException` carries no status code, so the status-only
classifier reported a timed-out rename as a definite failure
("Rename failed: HTTP 0") and the destructor then claimed the file was
unchanged, although the rename may have been applied. The classifier
now takes the exception and treats a transport failure as ambiguous,
which yields "commit status unknown" as for 408 and 5xx.

A transport failure is also rendered with its explanation, which is in
`what` rather than `Message`, instead of as `HTTP 0: `, and it is logged
to `system.blob_storage_log` with a non-zero error code through
`getAzureErrorCodeForLog`, as `WriteBufferFromAzureBlobStorage` does.

`isRetryableAzureException` now retries a 403 unconditionally (ClickHouse#112871), so a
403 on the staging create is retried on the same staging name. The
test for that path now checks that only one staging name is used,
which is what it is about, rather than the number of requests.

The test's request classifier now uses `contains`, which clang-tidy 22,
the compiler version master pins now, requires.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-improvement Pull request with some product improvements pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants