Uploaded image for project: 'Beam'
  1. Beam
  2. BEAM-11417

StreamingDataflowWorker can leak UnboundedSource finalization callbacks

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P1
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.27.0
    • Component/s: runner-dataflow
    • Labels:
      None

      Description

      StreamingDataflowWorker keeps a map of finalization callbacks (https://github.com/apache/beam/blob/master/runners/google-cloud-dataflow-java/worker/src/main/java/org/apache/beam/runners/dataflow/worker/StreamingDataflowWorker.java#L401).  If the Dataflow service loses a callback ID (due to autoscaling etc; they are best-effort), the callback will stay around forever.

      This can cause a relatively rapid memory leak for sources like KafkaIO where the callback (the KafkaCheckpointMark) has a reference to the KafkaUnboundedReader object, which keeps a KafkaConsumer object alive.

      A simple fix would be to change the ConcurrentHashMap to a guava Cache with a timeout on elements.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                boyuanz Boyuan Zhang
                Reporter:
                millsd@google.com Daniel Mills
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 40m
                  40m