shunping opened a new pull request, #41681:
URL: https://github.com/apache/beam/pull/41681

   Fixes a Prism runner panic that showed up as a flaky failure in 
`WatchFilePatternTest.test_one_poll_emits_only_the_newest_model` 
(https://github.com/apache/beam/actions/runs/45540717650/job/138958347128?pr=41084):
   
   ```
       panic in ElementManager.Bundles watermark evaluation goroutine: 
assignment to entry in nil map
       ...(*aggregateStageKind).buildProcessingTimeBundle.func1
           .../prism/internal/engine/elementmanager.go:2329
   ```
   
   ### Root cause
   With a trigger like `AfterWatermark(early=AfterProcessingTime(1))` on the 
global window (used by `WatchFilePattern` since #40765):
   1. When an element arrives, the early trigger isn't ready yet, so 
`injectTriggeredBundlesIfReady` schedules a processing-time timer at `now + 1s`.
   2. In batch mode the watermark moves to +inf before that, the final on-time 
pane fires, and `updateWatermarks` garbage collects 
`ss.state[LinkID{}][window]`.
   3. The timer is never removed. When it fires, `buildProcessingTimeBundle` 
reads empty state. Prism builds the unset late trigger as `TriggerDefault`, 
which reports ready once the window has ended. The code then writes the state 
back into the deleted window map, which panics.
   
   **This only happens if the timer fires after the window's state was 
collected.** A pipeline that keeps running more than about 1s past that point 
hits it (in the ML test, the `AsSingleton` side-input branch).
   
   ### Fix
   In `aggregateStageKind.buildProcessingTimeBundle`, if the window's trigger 
state has
   already been collected, drop the timer. The window is closed, so it must not 
produce
   another pane.


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to