Skip to content

[Bug]: Prism ignores the resume delay of self-checkpointing SDFs, so polling SDFs busy-spin #39848

Description

@Eliaaazzz

What happened?

A splittable DoFn that self-checkpoints with a requested resume delay (Python tracker.defer_remainder(Duration(...)), Go sdf.ResumeProcessingIn(...), Java ProcessContinuation.resume().withResumeDelay(...)) is resumed by Prism immediately. The delay is decoded from the bundle response into engine.Residual.Delay, but nothing consumes that field: PersistBundle returns every residual straight to the pending queue at the existing TODO

// TODO(https://github.com/apache/beam/issues/39446)
// Return unprocessed to this stage's pending
// TODO sort out pending element watermark holds for process continuation residuals.
unprocessedElements := reElementResiduals(residuals.Data, inputInfo, rb)
// Add unprocessed back to the pending stack.
if len(unprocessedElements) > 0 {
// TODO actually reschedule based on the residuals delay...
count := stage.AddPending(em, unprocessedElements)
em.addPending(count)

so a polling SDF busy-spins instead of pacing its poll rounds.

Measured on a current master build of Prism, driving the Python SDK in LOOPBACK: a Watch poll loop requesting a 3 second poll interval via defer_remainder executed 7,034 poll rounds in 9 seconds of wall time. Expected: 4 rounds.

This breaks transforms whose semantics assume the requested pacing. MatchContinuously derives a bounded number of polls from stop_timestamp and interval; on Prism the polling window collapses in wall-clock terms, so files added while the pipeline runs are missed. Reproduced with a pipeline matching a directory with interval=3 and stop_timestamp=now+24 while a file is added 8 seconds in: only the pre-existing file is matched. The same pipeline passes on the DirectRunner.

The engine already has the machinery a fix needs: em.processTimeEvents plus em.wakeUpAt schedule processing-time timers under the real-time clock, and checkForQuiescence treats scheduled processing-time events as pending work.

Issue Priority

Priority: 2 (default / most bugs should be filed as P2)

Issue Components

  • 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: Prism Runner
  • Component: Twister2 Runner
  • Component: Hazelcast Jet Runner
  • Component: Google Cloud Dataflow Runner
  • Component: Samza Runner
  • Component: Direct Runner

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions