beam icon indicating copy to clipboard operation
beam copied to clipboard

[Failing Test]: Prism TestPersistBundle_ResidualResumeDelay/parks_with_hold_and_schedules is flaky

Open jonathansudhakar1 opened this issue 4 weeks ago • 2 comments

What happened?

TestPersistBundle_ResidualResumeDelay/parks_with_hold_and_schedules in the Prism engine is flaky. The test was added in #39849.

It failed on master in the "Go tests" workflow on 2026-11-03: https://github.com/apache/beam/actions/runs/41695459870 (commit 26f3d47cc16)

--- FAIL: TestPersistBundle_ResidualResumeDelay (0.30s)
    --- FAIL: TestPersistBundle_ResidualResumeDelay/parks_with_hold_and_schedules (0.00s)
        elementmanager_continuation_test.go:370: residual release scheduled 5.000001877s after persisting, want within (0, 5s]

It reproduces locally on master (b0c68c4a4f7). On macOS/arm64 with Go 1.26, it failed 13 times in 20,000 runs:

cd sdks && go test ./go/pkg/beam/runners/prism/internal/engine/ \
  -run 'TestPersistBundle_ResidualResumeDelay/parks_with_hold_and_schedules' -count=20000

Cause: the test compares a millisecond-precision release time against a nanosecond-precision start time. The runner code is correct; only the test's bound is wrong.

  • The test takes before := time.Now() and checks that fireAt.ToTime().Sub(before) is in (0, delay] (test L343-L371).
  • PersistBundle computes fireAt as emNow.Add(r.Delay) (elementmanager.go L971, L812-L825).
  • With EnableRTC (as in this test), emNow is mtime.Now(), which truncates to milliseconds (mtime L67-L69).
  • emNow is read slightly after before. If a millisecond boundary falls between the two reads, emNow is later than before, and until comes out a few microseconds above delay.

Suggested fix: take after := time.Now() once PersistBundle returns, and check fireAt against [mtime.FromTime(before).Add(delay), mtime.FromTime(after).Add(delay)]. That is the exact range of possible release times, so the test stays strict.

I'm planning to submit a PR with this fix.

Issue Failure

Failure: Test is flaky

Issue Priority

Priority: 2 (backlog / disabled test but we think the product is healthy)

Issue Components

  • [ ] Component: Python SDK
  • [ ] Component: Java SDK
  • [x] Component: Go SDK
  • [ ] Component: Typescript SDK
  • [ ] Component: IO connector
  • [ ] Component: Beam YAML
  • [ ] Component: Beam examples
  • [ ] Component: Beam playground
  • [ ] Component: Beam katas
  • [ ] Component: Website
  • [ ] Component: Infrastructure
  • [ ] Component: Spark Runner
  • [ ] Component: Flink Runner
  • [x] Component: Prism Runner
  • [ ] Component: Hazelcast Jet Runner
  • [ ] Component: Google Cloud Dataflow Runner

jonathansudhakar1 avatar Nov 04 '26 17:11 jonathansudhakar1

.take-issue

jonathansudhakar1 avatar Nov 04 '26 17:11 jonathansudhakar1

.add-labels bug,'awaiting triage','failing test'

jonathansudhakar1 avatar Nov 04 '26 17:11 jonathansudhakar1