Skip to content

Commit

Permalink
Deep-copy the process bundle descriptor when creating a new bundle pr…
Browse files Browse the repository at this point in the history
…ocessor.
  • Loading branch information
tvalentyn committed Dec 13, 2023
1 parent 8be85d2 commit adaceda
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion sdks/python/apache_beam/runners/worker/sdk_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import abc
import collections
import contextlib
import copy
import functools
import json
import logging
Expand Down Expand Up @@ -491,7 +492,10 @@ def get(self, instruction_id, bundle_descriptor_id):
# Make sure we instantiate the processor while not holding the lock.
processor = bundle_processor.BundleProcessor(
self.runner_capabilities,
self.fns[bundle_descriptor_id],
# Reduce risks of concurrent modifications of the same protos
# captured in bundle descriptor when the same bundle desciptor is used
# in different instructions.
copy.deepcopy(self.fns[bundle_descriptor_id]),
self.state_handler_factory.create_state_handler(
self.fns[bundle_descriptor_id].state_api_service_descriptor),
self.data_channel_factory,
Expand Down

0 comments on commit adaceda

Please sign in to comment.