addenergyx opened a new issue, #39383:
URL: https://github.com/apache/beam/issues/39383

   ### What happened?
   
   `GlobalCachingStateHandler.blocking_get` caches partially materialized bag 
state as a `ContinuationIterable` across bundles, keyed by the user-state cache 
token. The iterable's lazy remainder holds the continuation token minted by the 
read that created it (`functools.partial(self._lazy_iterator, state_key, coder, 
continuation_token)`).
   
   Continuation tokens can become permanently invalid — e.g. Dataflow revokes 
them together with the work item that created them ("work token no longer valid 
on the backend"). When that happens, iterating the cached object raises, but 
nothing invalidates the cache entry: the user-state cache token is unchanged, 
so every subsequent bundle reading that state cell is served the same poisoned 
object and replays the dead token. A fresh read would succeed, but never 
happens. The stage retries forever and its watermark stalls.
   
   Observed in production on Dataflow (Python streaming, Streaming Engine, 
Runner v2, Beam 2.74.0) with a stateful transform whose bag state exceeded one 
page: unbounded "work token no longer valid" retry storms wedging the stage; 
disappears when state stays under one page (no continuation token → plain list 
cached → unreachable code path). Deterministic unit repro attached in the PR 
(no Dataflow required).
   
   Proposed fix: invalidate the cache entry when iterating the continuation 
fails, so the next read loads fresh state. Under transient failures this costs 
one extra reload; under permanent token invalidation it is the difference 
between self-healing and an infinite retry storm.
   
   ### Issue Priority
   
   Priority: 2 (default / most bugs should be filed as P2)
   
   ### Issue Components
   
   - [X] Component: Python SDK
   - [ ] Component: Java SDK
   - [ ] 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
   - [ ] Component: Samza Runner
   - [ ] Component: Twister2 Runner
   - [ ] Component: Hazelcast Jet Runner
   - [X] Component: Google Cloud Dataflow Runner
   


-- 
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