Skip to content

Fix flaky test_url_reconnect - #114527

Merged
alexey-milovidov merged 1 commit into
masterfrom
fix-flaky-test-url-reconnect
Aug 13, 2026
Merged

alexey-milovidov merged 1 commit into
masterfrom
fix-flaky-test-url-reconnect

Conversation

@alexey-milovidov

@alexey-milovidov alexey-milovidov commented Aug 12, 2026 •

Copy link
Copy Markdown
Member

Related: #110130

test_redirect_url_storage/test.py::test_url_reconnect blocks the outgoing connections to the HDFS datanode web port with a silent DROP and heals the network only after the client has demonstrably hit a connect timeout, waiting up to 30 seconds for a fresh connect timed out line in the server log.

That budget is not always enough, because the query does not necessarily open a new connection at all: the earlier tests in the module leave keep-alive connections to hdfs1:50075 in the HTTP connection pool, and a silent DROP kills an already established connection only by the receive timeout - http_receive_timeout, 30 seconds by default - rather than by the one-second connect timeout. The first try then dies after 30 seconds with a bare Timeout, and the first connect timed out line appears only on the next try, about 31 seconds into the query, just past the budget:

16:57:35.001 executeQuery: select sum(cityHash64(id)) from url('http://hdfs1:50075/...
16:58:05.013 ReadWriteBufferFromHTTP: ... Error: Timeout. Failed at try 2/10.
16:58:06.115 ReadWriteBufferFromHTTP: ... Error: Timeout: connect timed out: 172.16.1.2:50075. Failed at try 3/10.

The fix drops the connection cache before installing the rule, so the query has to open a fresh connection and the first try fails by the connect timeout, as the test expects. The wait budget is also raised to 60 seconds: the loop exits as soon as the line shows up, so a generous budget costs nothing on a healthy run.

Seen in an unrelated pull request: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=110130&sha=7acc19de7fb0c97f7ea0fb7c6c234930d188ac66&name_0=PR&name_1=Integration%20tests%20%28amd_msan%2C%205%2F8%29

Changelog category (leave one):

  • CI Fix or Improvement (changelog entry is not required)

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

...

Documentation entry for user-facing changes

  • Documentation is written (mandatory for new features)

Version info

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

The test blocks the outgoing connections to the HDFS datanode web port
with a silent `DROP` and heals the network only after the client has
demonstrably hit a connect timeout, waiting up to 30 seconds for a fresh
`connect timed out` line in the server log.

That budget is not always enough, because the query does not necessarily
open a new connection at all: the earlier tests in the module leave
keep-alive connections to `hdfs1:50075` in the HTTP connection pool, and
a silent `DROP` kills an already established connection only by the
receive timeout - `http_receive_timeout`, 30 seconds by default - rather
than by the one-second connect timeout. The first try then dies after 30
seconds with a bare `Timeout`, and the first `connect timed out` line
appears only on the next try, about 31 seconds into the query, just past
the budget:

    16:57:35.001 executeQuery: select sum(cityHash64(id)) from url('http://hdfs1:50075/...
    16:58:05.013 ReadWriteBufferFromHTTP: ... Error: Timeout. Failed at try 2/10.
    16:58:06.115 ReadWriteBufferFromHTTP: ... Error: Timeout: connect timed out: 172.16.1.2:50075. Failed at try 3/10.

Drop the connection cache before installing the rule, so the query has
to open a fresh connection and the first try fails by the connect
timeout, as the test expects. Also raise the wait budget to 60 seconds:
the loop exits as soon as the line shows up, so a generous budget costs
nothing on a healthy run.

Report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=110130&sha=7acc19de7fb0c97f7ea0fb7c6c234930d188ac66&name_0=PR&name_1=Integration%20tests%20%28amd_msan%2C%205%2F8%29
Related: #110130

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

clickhouse-gh Bot commented Aug 12, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [9dc9d78]

Summary: ✅


AI Review

Summary

This PR makes test_url_reconnect deterministic by clearing the server's outgoing HTTP connection pools before installing the DROP rule and by extending the timeout-detection wait window from 30 seconds to 60 seconds. I checked the current diff, the surrounding test module and helpers, the prior PR discussion, and the existing review threads; I did not find a correctness or review-blocking issue in the change.

Final Verdict

✅ Looks good to merge.

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Aug 12, 2026
@clickhouse-gh

clickhouse-gh Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing 9dc9d7858 with master bb1bd3074 (stripped binary size, per-symbol sizes and ThinLTO time; object sizes against the warmup build of 2e330af4c; 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 692.05 MiB 689.04 MiB -3.01 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

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

Job report

@alexey-milovidov alexey-milovidov left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Ok.

@alexey-milovidov alexey-milovidov self-assigned this Aug 12, 2026
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Aug 12, 2026
Merged via the queue into master with commit f025827 Aug 13, 2026
181 checks passed
@alexey-milovidov
alexey-milovidov deleted the fix-flaky-test-url-reconnect branch August 13, 2026 00:06
@robot-clickhouse-ci-1 robot-clickhouse-ci-1 added the pr-synced-to-cloud The PR is synced to the cloud repo label Aug 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-ci 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.

2 participants