8000 feat(inkless:storage): default S3 API call timeouts to 2s and 1s by giuseppelillo · Pull Request #791 · aiven/inkless · GitHub
[go: up one dir, main page]

Skip to content

feat(inkless:storage): default S3 API call timeouts to 2s and 1s - #791

Merged
jeqo merged 2 commits into
mainfrom
feat/inkless-s3-api-timeout-defaults
Sep 9, 2026
Merged

jeqo merged 2 commits into
mainfrom
feat/inkless-s3-api-timeout-defaults

Conversation

@giuseppelillo
Copy link
Copy Markdown
Contributor

Summary

  • Default inkless.storage.s3.api.call.timeout to 2000 ms (full call, including retries) and inkless.storage.s3.api.call.attempt.timeout to 1000 ms (single attempt).
  • Previously these configs defaulted to null, so the AWS SDK applied its own (much longer) timeouts. The new defaults fail hung S3 calls sooner and align with the GCS connect and read timeout defaults.

Test plan

  • ./gradlew :storage:inkless:test --tests io.aiven.inkless.storage_backend.s3.S3StorageConfigTest --tests io.aiven.inkless.storage_backend.s3.S3ClientBuilderTest

Made with Cursor

giuseppelillo and others added 2 commits September 8, 2026 14:53
Fail hung S3 calls sooner instead of relying on the AWS SDK's unbounded defaults, matching the GCS connect and read timeout defaults.

Co-authored-by: Cursor <cursoragent@cursor.com>
Give the server-error metrics integration test enough time to exhaust adaptive retries. This keeps the test focused on S3 response classification while production keeps the new fail-fast defaults.

Co-authored-by: Cursor <cursoragent@cursor.com>
@jeqo
jeqo merged commit 62e4c51 into main Sep 9, 2026
5 checks passed
@jeqo
jeqo deleted the feat/inkless-s3-api-timeout-defaults branch September 9, 2026 10:53
jeqo pushed a commit that referenced this pull request Sep 9, 2026
* feat(inkless:storage): default S3 API call timeouts to 2s and 1s

Fail hung S3 calls sooner instead of relying on the AWS SDK's unbounded defaults, matching the GCS connect and read timeout defaults.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(inkless:storage): isolate S3 error metrics timeout

Give the server-error metrics integration test enough time to exhaust adaptive retries. This keeps the test focused on S3 response classification while production keeps the new fail-fast defaults.

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
jeqo pushed a commit that referenced this pull request Sep 9, 2026
* feat(inkless:storage): default S3 API call timeouts to 2s and 1s

Fail hung S3 calls sooner instead of relying on the AWS SDK's unbounded defaults, matching the GCS connect and read timeout defaults.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(inkless:storage): isolate S3 error metrics timeout

Give the server-error metrics integration test enough time to exhaust adaptive retries. This keeps the test focused on S3 response classification while production keeps the new fail-fast defaults.

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
jeqo pushed a commit that referenced this pull request Sep 9, 2026
* feat(inkless:storage): default S3 API call timeouts to 2s and 1s

Fail hung S3 calls sooner instead of relying on the AWS SDK's unbounded defaults, matching the GCS connect and read timeout defaults.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(inkless:storage): isolate S3 error metrics timeout

Give the server-error metrics integration test enough time to exhaust adaptive retries. This keeps the test focused on S3 response classification while production keeps the new fail-fast defaults.

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
viktorsomogyi pushed a commit that referenced this pull request Sep 30, 2026
… switch systests (#813)

* fix(inkless:test): raise S3 timeouts and avoid the isolated broker in switch systests

Six `InklessClassicToDisklessSwitchTest` cases fail on the nightly run for
two reasons unrelated to the switch itself.

#791 set the S3 client defaults to a 2 s call timeout and a 1 s attempt
timeout. The degraded-network tests throttle every broker NIC, including the
path to MinIO, to 2 Mbit/s with 200 ms latency, so WAL uploads outlast 2 s
and fail with `ApiCallTimeoutException`. The producer retries each failed
produce, so it either never recovers or the consumer reads more records than
were acked. `_create_kafka` now sets the call timeout to 60 s and the attempt
timeout to 30 s. That fixes `test_switch_follower_crash_with_lagged_hw`,
`test_switch_leader_crash` (both variants), `test_switch_leader_restart`, and
`test_switch_rolling_restart`, which have failed since #791 merged.

`test_switch_follower_network_partition` isolates a follower and then runs
`kafka-configs.sh` from `self.nodes[0]`. When that node is the isolated
follower, the admin client can't reach its peers, and the describe that
precedes the alter hits its 30 s limit. `_switch_topic_to_diskless` now takes
a `node`, and both network-partition tests pass one from the reachable side.
`test_switch_leader_network_partition` has the same latent bug, since the
leader can also be `self.nodes[0]`.

## Test plan

Run the Inkless System Tests workflow on this branch and check that the six
cases pass. `test_switched_topic_urp_clears_after_replica_recovery` still
fails: that failure is the stranded-follower bug fixed by #760.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Fix comment formatting in inkless_topic_switch_test.py

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
jeqo pushed a commit that referenced this pull request Oct 19, 2026
… switch systests (#813)

* fix(inkless:test): raise S3 timeouts and avoid the isolated broker in switch systests

Six `InklessClassicToDisklessSwitchTest` cases fail on the nightly run for
two reasons unrelated to the switch itself.

#791 set the S3 client defaults to a 2 s call timeout and a 1 s attempt
timeout. The degraded-network tests throttle every broker NIC, including the
path to MinIO, to 2 Mbit/s with 200 ms latency, so WAL uploads outlast 2 s
and fail with `ApiCallTimeoutException`. The producer retries each failed
produce, so it either never recovers or the consumer reads more records than
were acked. `_create_kafka` now sets the call timeout to 60 s and the attempt
timeout to 30 s. That fixes `test_switch_follower_crash_with_lagged_hw`,
`test_switch_leader_crash` (both variants), `test_switch_leader_restart`, and
`test_switch_rolling_restart`, which have failed since #791 merged.

`test_switch_follower_network_partition` isolates a follower and then runs
`kafka-configs.sh` from `self.nodes[0]`. When that node is the isolated
follower, the admin client can't reach its peers, and the describe that
precedes the alter hits its 30 s limit. `_switch_topic_to_diskless` now takes
a `node`, and both network-partition tests pass one from the reachable side.
`test_switch_leader_network_partition` has the same latent bug, since the
leader can also be `self.nodes[0]`.

## Test plan

Run the Inkless System Tests workflow on this branch and check that the six
cases pass. `test_switched_topic_urp_clears_after_replica_recovery` still
fails: that failure is the stranded-follower bug fixed by #760.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Fix comment formatting in inkless_topic_switch_test.py

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
jeqo pushed a commit that referenced this pull request Oct 19, 2026
… switch systests (#813)

* fix(inkless:test): raise S3 timeouts and avoid the isolated broker in switch systests

Six `InklessClassicToDisklessSwitchTest` cases fail on the nightly run for
two reasons unrelated to the switch itself.

#791 set the S3 client defaults to a 2 s call timeout and a 1 s attempt
timeout. The degraded-network tests throttle every broker NIC, including the
path to MinIO, to 2 Mbit/s with 200 ms latency, so WAL uploads outlast 2 s
and fail with `ApiCallTimeoutException`. The producer retries each failed
produce, so it either never recovers or the consumer reads more records than
were acked. `_create_kafka` now sets the call timeout to 60 s and the attempt
timeout to 30 s. That fixes `test_switch_follower_crash_with_lagged_hw`,
`test_switch_leader_crash` (both variants), `test_switch_leader_restart`, and
`test_switch_rolling_restart`, which have failed since #791 merged.

`test_switch_follower_network_partition` isolates a follower and then runs
`kafka-configs.sh` from `self.nodes[0]`. When that node is the isolated
follower, the admin client can't reach its peers, and the describe that
precedes the alter hits its 30 s limit. `_switch_topic_to_diskless` now takes
a `node`, and both network-partition tests pass one from the reachable side.
`test_switch_leader_network_partition` has the same latent bug, since the
leader can also be `self.nodes[0]`.

## Test plan

Run the Inkless System Tests workflow on this branch and check that the six
cases pass. `test_switched_topic_urp_clears_after_replica_recovery` still
fails: that failure is the stranded-follower bug fixed by #760.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Fix comment formatting in inkless_topic_switch_test.py

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
jeqo pushed a commit that referenced this pull request Oct 19, 2026
… switch systests (#813)

* fix(inkless:test): raise S3 timeouts and avoid the isolated broker in switch systests

Six `InklessClassicToDisklessSwitchTest` cases fail on the nightly run for
two reasons unrelated to the switch itself.

#791 set the S3 client defaults to a 2 s call timeout and a 1 s attempt
timeout. The degraded-network tests throttle every broker NIC, including the
path to MinIO, to 2 Mbit/s with 200 ms latency, so WAL uploads outlast 2 s
and fail with `ApiCallTimeoutException`. The producer retries each failed
produce, so it either never recovers or the consumer reads more records than
were acked. `_create_kafka` now sets the call timeout to 60 s and the attempt
timeout to 30 s. That fixes `test_switch_follower_crash_with_lagged_hw`,
`test_switch_leader_crash` (both variants), `test_switch_leader_restart`, and
`test_switch_rolling_restart`, which have failed since #791 merged.

`test_switch_follower_network_partition` isolates a follower and then runs
`kafka-configs.sh` from `self.nodes[0]`. When that node is the isolated
follower, the admin client can't reach its peers, and the describe that
precedes the alter hits its 30 s limit. `_switch_topic_to_diskless` now takes
a `node`, and both network-partition tests pass one from the reachable side.
`test_switch_leader_network_partition` has the same latent bug, since the
leader can also be `self.nodes[0]`.

## Test plan

Run the Inkless System Tests workflow on this branch and check that the six
cases pass. `test_switched_topic_urp_clears_after_replica_recovery` still
fails: that failure is the stranded-follower bug fixed by #760.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Fix comment formatting in inkless_topic_switch_test.py

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
jeqo added a commit that referenced this pull request Nov 30, 2026
With a bounded `s3.api.call.timeout` (default 2000 ms), the AWS SDK `ADAPTIVE_V2` client-side token bucket can enter a self-sustaining lockout after S3 throttling. Once a throttling response sets `enabled = true` on `RateLimiterTokenBucket`, that flag never resets. If a throttling burst or a quiet period drops `fillRate` below concurrent request demand, callers subtract tokens into negative capacity and sleep in `RetryableStage2` past `apiCallTimeout`. Timed-out calls fail before sending an HTTP attempt, never refund their tokens, and never deliver the successful response required for CUBIC recovery, so the client stays stuck until broker restart. Current upstream AWS SDK v2 releases still queue timed-out sync waiters without skipping cancelled futures in `RateLimiterTokenBucket.doNotify()`.

`ADAPTIVE_V2` was enabled in #442 when `s3.api.call.timeout` defaulted to unbounded (`null`) and hot and cold reads shared one fetch client. Later changes split out a dedicated cold-path client (#562, which sees idle gaps between bursts that drag `fillRate` down via `2 * measuredTxRate`) and set the default `s3.api.call.timeout` to 2000 ms (#791), exposing the lockout cliff. AWS SDK Javadoc also cautions against `ADAPTIVE_V2` when predictable latency matters or a single client serves multiple resources, and upstream AWS SDK v2 now defaults to `STANDARD`.

Add `s3.retry.mode` (valid values `standard` and `adaptive_v2`, case-insensitive) to `S3StorageConfig`, wire it in `S3ClientBuilder`, and switch the default to `standard`. `STANDARD` keeps jittered exponential backoff and the SDK retry quota circuit breaker without the client-side rate limiter. Per-role overrides (such as `inkless.storage.fetch.s3.retry.mode`) work through the existing `InklessConfig` role layering.

Add `S3ThrottlingRecoveryTest` to verify concurrent fetches recover after `503 SlowDown` throttling with the default mode and that pre-attempt timeouts with `adaptive_v2` increment `configured-timeout-errors`.

Assisted-by: Gemini 4 Neon
jeqo added a commit that referenced this pull request Dec 1, 2026
…call-level timeouts [KC-874] (#915)

* fix(inkless:s3): record call-level timeouts in S3 metrics

`MetricCollector.publish()` reads `CoreMetric.ERROR_TYPE` only from `ApiCallAttempt` child collections. Because `ApiCallTimeoutTrackingStage` wraps `ApiCallAttemptMetricCollectionStage` in the AWS SDK sync pipeline, an `ApiCallTimeoutException` never appears on an attempt child. When a call times out before an HTTP attempt starts (such as during a backoff or rate-limiter wait) or while an attempt is in flight, `configured-timeout-errors` stays at zero even though requests time out.

Have `MetricCollector` implement `ExecutionInterceptor` and register it on the S3 client in `S3ClientBuilder`. On `onExecutionFailure`, record `CONFIGURED_TIMEOUT` globally and per operation when the failure is an `ApiCallTimeoutException`. Attempt-level `ApiCallAttemptTimeoutException` failures stay handled by `publish()` without double counting.

Assisted-by: Gemini 4 Neon

* fix(inkless:s3): default S3 retry mode to standard and add s3.retry.mode

With a bounded `s3.api.call.timeout` (default 2000 ms), the AWS SDK `ADAPTIVE_V2` client-side token bucket can enter a self-sustaining lockout after S3 throttling. Once a throttling response sets `enabled = true` on `RateLimiterTokenBucket`, that flag never resets. If a throttling burst or a quiet period drops `fillRate` below concurrent request demand, callers subtract tokens into negative capacity and sleep in `RetryableStage2` past `apiCallTimeout`. Timed-out calls fail before sending an HTTP attempt, never refund their tokens, and never deliver the successful response required for CUBIC recovery, so the client stays stuck until broker restart. Current upstream AWS SDK v2 releases still queue timed-out sync waiters without skipping cancelled futures in `RateLimiterTokenBucket.doNotify()`.

`ADAPTIVE_V2` was enabled in #442 when `s3.api.call.timeout` defaulted to unbounded (`null`) and hot and cold reads shared one fetch client. Later changes split out a dedicated cold-path client (#562, which sees idle gaps between bursts that drag `fillRate` down via `2 * measuredTxRate`) and set the default `s3.api.call.timeout` to 2000 ms (#791), exposing the lockout cliff. AWS SDK Javadoc also cautions against `ADAPTIVE_V2` when predictable latency matters or a single client serves multiple resources, and upstream AWS SDK v2 now defaults to `STANDARD`.

Add `s3.retry.mode` (valid values `standard` and `adaptive_v2`, case-insensitive) to `S3StorageConfig`, wire it in `S3ClientBuilder`, and switch the default to `standard`. `STANDARD` keeps jittered exponential backoff and the SDK retry quota circuit breaker without the client-side rate limiter. Per-role overrides (such as `inkless.storage.fetch.s3.retry.mode`) work through the existing `InklessConfig` role layering.

Add `S3ThrottlingRecoveryTest` to verify concurrent fetches recover after `503 SlowDown` throttling with the default mode and that pre-attempt timeouts with `adaptive_v2` increment `configured-timeout-errors`.

Assisted-by: Gemini 4 Neon

* fixup! fix(inkless:s3): record call-level timeouts in S3 metrics

Assisted-by: Gemini 4 Neon
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.

2 participants

0