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

StreamingDataflowWorker can leak UnboundedSource finalization callbacks

Details

    • Bug
    • Status: Resolved
    • P1
    • Resolution: Fixed
    • None
    • 2.27.0
    • runner-dataflow
    • 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

              boyuanz Boyuan Zhang
              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