Skip to content

Conversation

Dream95
Copy link

@Dream95 Dream95 commented Oct 8, 2025

Fixes #24788
Fixes #24509

Motivation

The test is flaky.

Reproduce the issue:
Add Thread.sleep after sendAsync to avoid batching sends.

 for (int i = 0; i < 50; i++) {
       producer.newMessage(transaction).value(i).sendAsync();
       Thread.sleep(1);
}

The issue occurs because the in this test, the TransactionBufferTestImpl class extends TopicTransactionBuffer and declares a field with the same name publishFuture.
Therefore, in the appendBufferToTxn method, getPublishFuture() retrieves the publishFuture from the subclass, while the assignment publishFuture = future modifies the publishFuture belonging to the parent class.

 CompletableFuture<Position> future = getPublishFuture().thenCompose(ignore -> {
            ......
        }).whenComplete(((position, throwable) -> buffer.release()));
publishFuture = future;

Modifications

Use ‘setPublishFuture(future)’ to replace ‘publishFuture = future’

Verifying this change

  • Make sure that the change passes the CI checks.

This change is already covered by existing tests.

Does this pull request potentially affect one of the following parts:

  • Dependencies (add or upgrade a dependency)
  • The public API
  • The schema
  • The default values of configurations
  • The threading model
  • The binary protocol
  • The REST endpoints
  • The admin CLI options
  • The metrics
  • Anything that affects deployment

Documentation

  • doc
  • doc-required
  • doc-not-needed
  • doc-complete

Matching PR in forked repository

PR in forked repository: Dream95#1

@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label Oct 8, 2025
Copy link
Contributor

@Technoboy- Technoboy- left a comment

Choose a reason for hiding this comment

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

Please also delete the useless field publishFuture, transactionBufferFuture defined in the TransactionBufferTestImpl

@Technoboy- Technoboy- added this to the 4.2.0 milestone Oct 9, 2025
@Dream95 Dream95 force-pushed the fix-flaky-test-24788 branch from 78c24a0 to f571cc6 Compare October 9, 2025 14:09
@Dream95 Dream95 requested a review from Technoboy- October 10, 2025 08:14
@codecov-commenter
Copy link

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.30%. Comparing base (562d446) to head (c3bbca1).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #24826      +/-   ##
============================================
+ Coverage     74.28%   74.30%   +0.01%     
- Complexity    33842    33849       +7     
============================================
  Files          1913     1913              
  Lines        149315   149317       +2     
  Branches      17331    17331              
============================================
+ Hits         110915   110946      +31     
+ Misses        29558    29520      -38     
- Partials       8842     8851       +9     
Flag Coverage Δ
inttests 26.43% <100.00%> (-0.17%) ⬇️
systests 22.79% <0.00%> (-0.02%) ⬇️
unittests 73.81% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...ransaction/buffer/impl/TopicTransactionBuffer.java 85.63% <100.00%> (-1.24%) ⬇️

... and 89 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

doc-not-needed Your PR changes do not impact docs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Flaky-test: TopicTransactionBufferTest.testMessagePublishInOrder Flaky-test: TopicTransactionBufferTest.testMessagePublishInOrder

4 participants