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

Multiple deserializations of PipelineOptions leaks memory

Details

    • Bug
    • Status: Resolved
    • P2
    • Resolution: Fixed
    • None
    • 2.3.0
    • sdk-java-core

    Description

      In particular, upon deserializing a PipelineOptions object,
      ProxyInvocationHandler.Deserializer
      calls ValueProvider.RuntimeValueProvider.setRuntimeOptions(options) which
      stores the (newly) deserialized PipelineOptions instance in a static map
      inside the RuntimeValueProvider class, where the key is an id obtained by
      calling deserializedOptions.getOptionsId().

      The thing is, performing a serialize-deserialize cycle on a given
      PipelineOptions instance and invoking getOptionsId() yields different
      optionsIds. Therefore, multiple deserializations of the same
      PipelineOptions instance result in new keys being added to the static
      "optionsMap" map inside the ValueProvider.RuntimeValueProvider class.

      The fix is to populate the options id when PipelineOptions is created. This can be tested by creating a PipelineOptions object and then serializing/deserializing it and ensuring that it has the same options id as the original.

      Attachments

        Issue Links

          Activity

            People

              lcwik Luke Cwik
              lcwik Luke Cwik
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: