Skip to content

Fix flaky test_s3_aws_sdk_has_slightly_unreliable_behaviour::test_dataloss - #106400

Closed
groeneai wants to merge 1 commit into
ClickHouse:masterfrom
groeneai:groeneai/fix-test-dataloss-async-insert-hang
Closed

groeneai wants to merge 1 commit into
ClickHouse:masterfrom
groeneai:groeneai/fix-test-dataloss-async-insert-hang

Conversation

@groeneai

@groeneai groeneai commented Jun 3, 2026

Copy link
Copy Markdown
Collaborator

The integration test test_s3_aws_sdk_has_slightly_unreliable_behaviour/test.py::test_dataloss is flaky and slow in CI. It times out at the cleanup DROP under the 600s client timeout, e.g. on Integration tests (amd_asan_ubsan, db disk, old analyzer).

The test asserts that an INSERT into an S3-backed table throws when the S3 proxy always fails CompleteMultipartUpload. Two independent causes broke it:

  1. async_insert defaults to true, so the INSERT was routed through the async queue. The client returned after the WaitForAsyncInsert timeout (satisfying pytest.raises), while a background flush kept retry-storming the always-failing proxy and raced the cleanup DROP. The test was written for the synchronous S3 write-failure path, so this disables async_insert on the INSERT.

  2. The disk config set retry_attempts, but S3 disk request settings are read with the s3_ prefix (loadFromConfigForObjectStorage passes setting_name_prefix = "s3_"), so the bare key was silently ignored and the 500-attempt default stayed active. Even synchronously this made the INSERT take about 300s. The key is renamed to s3_retry_attempts so the intended cap of 2 takes effect.

With both fixes the test fails synchronously in about 6s. Validated with 6/6 passing runs locally on the amd_tsan integration image, each call phase 5.5-6.8s.

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)

…aloss

The test verifies that an INSERT into an S3-backed table throws when the
S3 proxy always fails CompleteMultipartUpload. It was flaky and slow in CI,
timing out at the cleanup DROP under the 600s client timeout.

Two independent causes:

1. async_insert defaults to true, so the INSERT was routed through the
   async queue. The client returned after the WaitForAsyncInsert timeout
   (satisfying pytest.raises), but a background flush kept retry-storming
   the always-failing proxy and raced the cleanup DROP. The test was
   designed for the synchronous S3 write-failure path, so disable
   async_insert on the INSERT to restore those semantics.

2. The disk config set retry_attempts, but S3 disk request settings are
   read with the s3_ prefix (loadFromConfigForObjectStorage passes
   setting_name_prefix = "s3_"), so the bare key was silently ignored and
   the 500-attempt default stayed active. Even synchronously this made the
   INSERT take about 300s. Rename the key to s3_retry_attempts so the
   intended cap of 2 attempts takes effect.

With both fixes the test fails synchronously in about 6s. Validated with
6/6 passing runs locally (amd_tsan integration image), each call phase
5.5-6.8s.
@groeneai

groeneai commented Jun 3, 2026

Copy link
Copy Markdown
Collaborator Author

cc @kssenii could you review? Test-only fix for the flaky test_s3_aws_sdk_has_slightly_unreliable_behaviour::test_dataloss. It disables async_insert (so the S3 write-failure path runs synchronously instead of a background flush racing the cleanup DROP) and renames the disk's bare retry_attempts to s3_retry_attempts so the 2-attempt cap actually applies (disk request settings need the s3_ prefix). Validated 6/6 locally, ~6s per run.

Pre-PR validation gate:

  • Deterministic: old path = async background flush + 500-attempt retry storm racing the finally DROP (CIDB: 34/41 failures at the DROP line); new path = synchronous failure in ~6s every run.
  • Root cause: async_insert default subverts the synchronous-write-failure semantics; bare retry_attempts disk key is ignored (needs s3_ prefix), leaving 500 attempts.
  • Fix matches cause; test intent (pytest.raises data-loss assertion) preserved; no no-* tags added.
  • Both directions shown: without fix ~300s + DROP hang; with fix 6/6 at ~6s.

@Algunenano

Copy link
Copy Markdown
Member

Wasn't this fixed by reverting #106353?

@evillique

Copy link
Copy Markdown
Member

Indeed, it was.

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.

3 participants