Skip to content

Conversation

@lostluck
Copy link
Contributor

@lostluck lostluck commented Dec 3, 2024

testEventTimeTimerOrderingWithCreate was hanging due to timers being fired in incorrect order. The issue was that the heap variant wasn't being maintained on inserting timers for a key. This would cause timers to fire out of event time ordering. In particular, the "GC" timer would fire first (because it was set first), instead of the earlier firing "append" timer.

This incorrect ordering was also what caused testTwoTimersSettingEachOtherWithCreateAsInputUnbounded to fail.

Fixes #32222.


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 to see a list of phrases to trigger workflows.

@lostluck
Copy link
Contributor Author

lostluck commented Dec 3, 2024

R: @damondouglas

@github-actions
Copy link
Contributor

github-actions bot commented Dec 3, 2024

Stopping reviewer notifications for this pull request: review requested by someone other than the bot, ceding control. If you'd like to restart, comment assign set of reviewers

@lostluck
Copy link
Contributor Author

lostluck commented Dec 3, 2024

Fix two Java tests, but now a Python test is failing. Curious.

@damondouglas damondouglas self-requested a review December 3, 2024 20:51
@github-actions github-actions bot added the python label Dec 4, 2024
@lostluck
Copy link
Contributor Author

lostluck commented Dec 4, 2024

R: @robertwb for the update to the test. Adjusted the timer firing to be just within the window in question instead of just outside of it.

# based on ordering and trigger firing timing.
self.assertEqual(sorted(sum((list(b) for b in actual), [])), elements)
self.assertEqual(max(len(list(buffer)) for buffer in actual), buffer_size)
self.assertEqual(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added the actual output to the asserts help with debugging, hence the line reflows.

ss.pendingByKeys[string(e.keyBytes)] = dnt
}
dnt.elements.Push(e)
heap.Push(&dnt.elements, e)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This fixes maintaining the heap invariant.

Copy link
Contributor

@robertwb robertwb left a comment

Choose a reason for hiding this comment

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

Test fix LGTM.

@lostluck
Copy link
Contributor Author

lostluck commented Dec 4, 2024

Thanks!

I've made a note to log a clear warning/error when timers are set beyond their window + AllowedLateness. Once that's in, it'll be clearer whether I can just hard fail pipelines when it happens with a hopefully clear error message.

@lostluck lostluck merged commit 2e43e29 into apache:master Dec 4, 2024
111 checks passed
@lostluck lostluck deleted the beam32222 branch December 4, 2024 22:04
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.

[prism] Resolve endless timer test org.apache.beam.sdk.transforms.ParDoTest$TimerTests.testEventTimeTimerOrderingWithCreate

3 participants