Skip to content

try to fix async wrapper test - #40397

Closed
derrickaw wants to merge 1 commit into
apache:masterfrom
derrickaw:20261003_tryFixAsyncWrapperTest
Closed

derrickaw wants to merge 1 commit into
apache:masterfrom
derrickaw:20261003_tryFixAsyncWrapperTest

Conversation

@derrickaw

@derrickaw derrickaw commented Oct 4, 2026 •

Copy link
Copy Markdown
Collaborator

Seeing this failure:

Gradle Test Run :sdks:java:core:test > Gradle Test Executor 2 > AsyncWrapperTest > testBufferStopsAcceptingItems FAILED
java.lang.AssertionError: expected:<5> but was:<0>
at org.junit.Assert.fail(Assert.java:89)
at org.junit.Assert.failNotEquals(Assert.java:835)
at org.junit.Assert.assertEquals(Assert.java:647)
at org.junit.Assert.assertEquals(Assert.java:633)
at org.apache.beam.sdk.transforms.AsyncWrapperTest.testBufferStopsAcceptingItems(AsyncWrapperTest.java:678)

here

  1. Add polling

Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:

  • Mention the appropriate issue in your description (for example: addresses #123), if applicable. This will automatically add a link to the pull request in the issue. If you would like the issue to automatically close on merging the pull request, comment fixes #<ISSUE NUMBER> instead.
  • Update CHANGES.md with noteworthy changes.
  • If this contribution is large, please file an Apache Individual Contributor License Agreement.

See the Contributor Guide for more tips on how to make review process smoother.

To check the build health, please visit https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md

GitHub Actions Tests Status (on master branch)

Build python source distribution and wheels
Python tests
Java tests
Go tests

See CI.md for more information about GitHub Actions CI or the workflows README for a list of workflows and how to trigger them.

@github-actions github-actions Bot added the java label Oct 4, 2026
@derrickaw
derrickaw marked this pull request as ready for review October 4, 2026 11:02
@github-actions

github-actions Bot commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

Assigning reviewers:

R: @ahmedabu98 for label java.

Note: If you would like to opt out of this review, comment assign to next reviewer.

Available commands:

  • stop reviewer notifications - opt out of the automated review tooling
  • remind me after tests pass - tag the comment author after tests pass
  • waiting on author - shift the attention set back to the author (any comment or push by the author will return the attention set to the reviewers)

The PR bot will only process comments in the main thread (not review comments).

@tkaymak

tkaymak commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

Hi @derrickaw, I hit the same AsyncWrapperTest.java:678 failure on Windows and filed #40448. I opened #40449, which takes a deterministic route. It gates BasicDofn with a CountDownLatch and joins all producers before asserting, so the count no longer depends on sleep timing. It also covers the sibling tests that got the same race from #38970. Happy to fold anything from here into it, or close mine if you'd rather go ahead with this one.

@derrickaw

Copy link
Copy Markdown
Collaborator Author

Hi @derrickaw, I hit the same AsyncWrapperTest.java:678 failure on Windows and filed #40448. I opened #40449, which takes a deterministic route. It gates BasicDofn with a CountDownLatch and joins all producers before asserting, so the count no longer depends on sleep timing. It also covers the sibling tests that got the same race from #38970. Happy to fold anything from here into it, or close mine if you'd rather go ahead with this one.

Hi @tkaymak, I think yours is better. Will defer to yours. Thanks!

@derrickaw derrickaw closed this Oct 7, 2026
Abacn pushed a commit that referenced this pull request Oct 8, 2026
testBufferStopsAcceptingItems asserted the buffer count after a fixed
100ms sleep, which failed on slow Windows runners (expected 5 but was 0).

Add an optional CountDownLatch gate to BasicDofn so tests hold elements
in-flight until they release it, instead of relying on wall-clock sleeps.
testBufferStopsAcceptingItems now joins all producers before asserting
that exactly 5 items are buffered, then verifies the 5 throttled items
are rescheduled and emitted. testBufferCount, testBufferWithCancellation
and testLongItem use the same gate; testSlowDuplicates waits for the
buffer to drain instead of sleeping.

Fixes #40448. Supersedes the timing-based approach in #40397.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants