You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iggy.apache.org by "ryerraguntla (via GitHub)" <gi...@apache.org> on 2026/07/18 17:22:37 UTC

[PR] fix(java-sdk): Stabilize async consumer group test [iggy]

ryerraguntla opened a new pull request, #3697:
URL: https://github.com/apache/iggy/pull/3697

   Fixes flakiness in the Java SDK async consumer-group integration test for concurrent join/leave operations. The change adds bounded retry handling for transient not-found errors and waits for the consumer-group membership count to converge before asserting, making the test more stable without changing its intent.
   
   Handle transient `IggyResourceNotFoundException` during concurrent join/leave operations in `AsyncConsumerGroupsTest`. This adds bounded retry/backoff helpers and waits for the expected member count before asserting, reducing flakiness from eventually consistent consumer-group state.
   
   ## Which issue does this PR address?
   Closes # 3641
   Relates to # [pr=3515](https://github.com/apache/iggy/actions/runs/28737059115?pr=3515)
   
   ## Rationale
   
   To address the flaky java tests.
   
   ## What changed?
   
    This PR stabilizes a flaky Java SDK integration test covering concurrent consumer-group join and leave operations.
   
   The test previously asserted consumer-group state immediately after concurrent operations completed. In some runs, transient IggyResourceNotFoundException errors or short propagation delays caused intermittent failures even though the underlying behavior was correct.
   
   **Changes in this PR**
   add retry handling around concurrent joinConsumerGroup calls
   add retry handling around concurrent leaveConsumerGroup calls
   retry only for transient IggyResourceNotFoundException cases
   wait until the consumer group reaches the expected member count before asserting
   extract shared helper methods for retry and polling behavior
   add reusable timeout and backoff constants for transient-state handling
   **Why**
   Concurrent async operations can briefly observe unstable or not-yet-visible consumer-group state. This PR makes the test robust to those short-lived conditions while preserving the original behavior being verified.
   
   **Impact**
   improves reliability of the Java SDK integration test suite
   reduces intermittent failures in consumer-group concurrency coverage
   limits scope to test code only
   Reviewer-focused summary
   
   **Primary goal:** eliminate flaky failures in AsyncConsumerGroupsTest
   **Approach:** add bounded retry logic for transient not-found errors and poll for expected membership state
   **Scope:** test-only change in the Java SDK
   **Risk:** low, since production code is unchanged
   Behavioral effect: assertions are now based on eventual stable state rather than immediate visibility after concurrent operations
   
   
   ## Local Execution
   
   - Passed 
   - Pre-commit hooks ran
   
   ## AI Usage
   
   
   If AI tools were used, please answer:
   1. Which tools?  Claude 
   2. Scope of usage?   generated functions and implementation)
   3. How did you verify the generated code works correctly? Manually verified
   4. Can you explain every line of the code if asked? yes
   
    


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(java): Stabilize async consumer group test [iggy]

Posted by "mmodzelewski (via GitHub)" <gi...@apache.org>.
mmodzelewski closed pull request #3697: fix(java): Stabilize async consumer group test
URL: https://github.com/apache/iggy/pull/3697


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(java): Stabilize async consumer group test [iggy]

Posted by "ryerraguntla (via GitHub)" <gi...@apache.org>.
ryerraguntla commented on PR #3697:
URL: https://github.com/apache/iggy/pull/3697#issuecomment-5012456594

   /ready


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(java): Stabilize async consumer group test [iggy]

Posted by "slbotbm (via GitHub)" <gi...@apache.org>.
slbotbm commented on code in PR #3697:
URL: https://github.com/apache/iggy/pull/3697#discussion_r3632869636


##########
foreign/java/java-sdk/src/test/java/org/apache/iggy/client/async/AsyncConsumerGroupsTest.java:
##########
@@ -324,35 +327,79 @@ void shouldHandleConcurrentJoinAndLeaveOperations() throws Exception {
                     .get(TIMEOUT_SECONDS, TimeUnit.SECONDS);
 
             // when — join concurrently
-            CompletableFuture.allOf(
-                            client.consumerGroups().joinConsumerGroup(STREAM_ID, TOPIC_ID, groupId),
-                            secondClient.consumerGroups().joinConsumerGroup(STREAM_ID, TOPIC_ID, groupId),
-                            thirdClient.consumerGroups().joinConsumerGroup(STREAM_ID, TOPIC_ID, groupId))
-                    .get(TIMEOUT_SECONDS * 2, TimeUnit.SECONDS);
-
-            // then
-            ConsumerGroupDetails afterJoin = client.consumerGroups()
-                    .getConsumerGroup(STREAM_ID, TOPIC_ID, groupId)
-                    .get(TIMEOUT_SECONDS, TimeUnit.SECONDS)
-                    .get();
-            assertThat(afterJoin.membersCount()).isEqualTo(3);
+            retryOnTransientNotFound(
+                    () -> CompletableFuture.allOf(
+                                    client.consumerGroups().joinConsumerGroup(STREAM_ID, TOPIC_ID, groupId),
+                                    secondClient.consumerGroups().joinConsumerGroup(STREAM_ID, TOPIC_ID, groupId),
+                                    thirdClient.consumerGroups().joinConsumerGroup(STREAM_ID, TOPIC_ID, groupId))
+                            .get(TIMEOUT_SECONDS * 2, TimeUnit.SECONDS),
+                    TRANSIENT_RETRY_TIMEOUT,
+                    TRANSIENT_RETRY_BACKOFF);
+            awaitMembersCount(groupId, 3);
 
             // when — leave concurrently
-            CompletableFuture.allOf(
-                            client.consumerGroups().leaveConsumerGroup(STREAM_ID, TOPIC_ID, groupId),
-                            secondClient.consumerGroups().leaveConsumerGroup(STREAM_ID, TOPIC_ID, groupId),
-                            thirdClient.consumerGroups().leaveConsumerGroup(STREAM_ID, TOPIC_ID, groupId))
-                    .get(TIMEOUT_SECONDS * 2, TimeUnit.SECONDS);
-
-            // then
-            ConsumerGroupDetails afterLeave = client.consumerGroups()
-                    .getConsumerGroup(STREAM_ID, TOPIC_ID, groupId)
-                    .get(TIMEOUT_SECONDS, TimeUnit.SECONDS)
-                    .get();
-            assertThat(afterLeave.membersCount()).isEqualTo(0);
+            retryOnTransientNotFound(
+                    () -> CompletableFuture.allOf(
+                                    client.consumerGroups().leaveConsumerGroup(STREAM_ID, TOPIC_ID, groupId),
+                                    secondClient.consumerGroups().leaveConsumerGroup(STREAM_ID, TOPIC_ID, groupId),
+                                    thirdClient.consumerGroups().leaveConsumerGroup(STREAM_ID, TOPIC_ID, groupId))
+                            .get(TIMEOUT_SECONDS * 2, TimeUnit.SECONDS),
+                    TRANSIENT_RETRY_TIMEOUT,
+                    TRANSIENT_RETRY_BACKOFF);
+            awaitMembersCount(groupId, 0);

Review Comment:
   Here, if one leave succeeds while another returns `IggyResourceNotFoundException`, retry resubmits all three leaves. Already-successful client now returns “member not found,” so every later attempt fails. Helper eventually times out even if member count reaches zero. This defeats exact flaky case being fixed.
   
   fix: Treat “already left” as success, retry clients individually, or tolerate leave exceptions and use awaitMembersCount(groupId, 0) as final condition.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(java): Stabilize async consumer group test [iggy]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #3697:
URL: https://github.com/apache/iggy/pull/3697#issuecomment-5247580636

   This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs.
   
   If you need a review, please ensure CI is green and the PR is rebased on the latest master. Don't hesitate to ping the maintainers - either `@core` on Discord or by mentioning them directly here on the PR.
   
   Thank you for your contribution!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(java): Stabilize async consumer group test [iggy]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #3697:
URL: https://github.com/apache/iggy/pull/3697#issuecomment-5137840803

   This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs.
   
   If you need a review, please ensure CI is green and the PR is rebased on the latest master. Don't hesitate to ping the maintainers - either `@core` on Discord or by mentioning them directly here on the PR.
   
   Thank you for your contribution!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(java): Stabilize async consumer group test [iggy]

Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #3697:
URL: https://github.com/apache/iggy/pull/3697#issuecomment-5041096118

   ## [Codecov](https://app.codecov.io/gh/apache/iggy/pull/3697?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   :white_check_mark: All modified and coverable lines are covered by tests.
   :white_check_mark: Project coverage is 74.34%. Comparing base ([`a5001d3`](https://app.codecov.io/gh/apache/iggy/commit/a5001d3592889dca2ffc805ea8744d8518cd83bd?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`9bda9da`](https://app.codecov.io/gh/apache/iggy/commit/9bda9da4e8d8cc3916398e155170b27fc0ee0cdc?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   ```diff
   @@            Coverage Diff            @@
   ##             master    #3697   +/-   ##
   =========================================
     Coverage     74.34%   74.34%           
     Complexity      950      950           
   =========================================
     Files          1303     1303           
     Lines        148712   148712           
     Branches     124225   124224    -1     
   =========================================
   + Hits         110562   110565    +3     
     Misses        34673    34673           
   + Partials       3477     3474    -3     
   ```
   
   | [Components](https://app.codecov.io/gh/apache/iggy/pull/3697/components?src=pr&el=components&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
   |---|---|---|
   | [Rust Core](https://app.codecov.io/gh/apache/iggy/pull/3697/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `74.57% <ø> (+<0.01%)` | :arrow_up: |
   | [Java SDK](https://app.codecov.io/gh/apache/iggy/pull/3697/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `62.64% <ø> (ø)` | |
   | [C# SDK](https://app.codecov.io/gh/apache/iggy/pull/3697/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `72.28% <ø> (ø)` | |
   | [Python SDK](https://app.codecov.io/gh/apache/iggy/pull/3697/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `92.27% <ø> (ø)` | |
   | [PHP SDK](https://app.codecov.io/gh/apache/iggy/pull/3697/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `84.52% <ø> (ø)` | |
   | [Node SDK](https://app.codecov.io/gh/apache/iggy/pull/3697/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `92.70% <ø> (ø)` | |
   | [Go SDK](https://app.codecov.io/gh/apache/iggy/pull/3697/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `43.08% <ø> (ø)` | |
   [see 10 files with indirect coverage changes](https://app.codecov.io/gh/apache/iggy/pull/3697/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   </details>
   <details><summary> :rocket: New features to boost your workflow: </summary>
   
   - :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
   - :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
   </details>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(java): Stabilize async consumer group test [iggy]

Posted by "mmodzelewski (via GitHub)" <gi...@apache.org>.
mmodzelewski commented on PR #3697:
URL: https://github.com/apache/iggy/pull/3697#issuecomment-5251092547

   @ryerraguntla thanks for digging into this, and sorry for the slow turnaround.
   
   I'm going to close this one. I haven't seen this flake in the CI runs over the
   last few weeks, and the tests in their current form already wait at every step,
   so the responses they assert on should be stable. Adding retries on top of that
   mostly hides a root cause rather than fixing it: as noted above, the failure in
   #3641 looked like server-side lost consumer-group membership, not eventual
   consistency, and a retry would have swallowed exactly the signal we need.
   
   On top of that, the Java SDK tests now run against the new server, so the
   behaviour under test has changed. Let's observe that for a while first, and if
   the flake shows up again we can revisit with server logs from the failing run
   and fix it where it actually breaks.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(java-sdk): Stabilize async consumer group test [iggy]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #3697:
URL: https://github.com/apache/iggy/pull/3697#issuecomment-5012205745

   <!-- iggy-pr-triage-welcome -->
   Thanks for the PR. It is labeled `S-waiting-on-review` and queued for review.
   
   Slash commands (own line, regular comment) move it around the queue:
   
   - `/ready` - back to `S-waiting-on-review` after addressing feedback
   - `/author` - flip to `S-waiting-on-author` while you finish changes
   - `/request-review @user-or-team` - request a reviewer
   
   See [CONTRIBUTING.md](https://github.com/apache/iggy/blob/master/CONTRIBUTING.md#pr-triage-commands) for details.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(java): Stabilize async consumer group test [iggy]

Posted by "ryerraguntla (via GitHub)" <gi...@apache.org>.
ryerraguntla commented on PR #3697:
URL: https://github.com/apache/iggy/pull/3697#issuecomment-5172473764

   /ready


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org