udim commented on a change in pull request #12934:
URL: https://github.com/apache/beam/pull/12934#discussion_r495178326



##########
File path: sdks/python/apache_beam/runners/worker/sdk_worker.py
##########
@@ -415,10 +465,19 @@ def release(self, instruction_id):
     Resets the ``BundleProcessor`` and moves it from the active to the
     inactive cache.
     """
-    descriptor_id, processor = 
self.active_bundle_processors.pop(instruction_id)
+    with self._lock:
+      self.known_not_running_instruction_ids[instruction_id] = True
+      while len(self.known_not_running_instruction_ids
+                ) > MAX_KNOWN_NOT_RUNNING_INSTRUCTIONS:
+        self.known_not_running_instruction_ids.popitem()
+      descriptor_id, processor = (
+          self.active_bundle_processors.pop(instruction_id))
+
+    # Make sure that we reset the processor while not holding the lock.
     processor.reset()
-    self.last_access_times[descriptor_id] = time.time()
-    self.cached_bundle_processors[descriptor_id].append(processor)
+    with self._lock:
+      self.last_access_times[descriptor_id] = time.time()
+      self.cached_bundle_processors[descriptor_id].append(processor)
 
   def shutdown(self):
     """

Review comment:
       Not sure if any locking needs to be done in this method. Perhaps 
`known_not_running_instruction_ids` should be cleared?
   
   It seems that this is called when no more requests will be processed (end of 
SdkHarness.run()), so this should be fine.

##########
File path: 
sdks/python/apache_beam/runners/portability/fn_api_runner/fn_runner.py
##########
@@ -894,7 +897,10 @@ def process_bundle(self,
       finalize_request = beam_fn_api_pb2.InstructionRequest(
           finalize_bundle=beam_fn_api_pb2.FinalizeBundleRequest(
               instruction_id=process_bundle_id))
-      self._worker_handler.control_conn.push(finalize_request)
+      finalize_response = self._worker_handler.control_conn.push(
+          finalize_request).get()

Review comment:
       This this bug is unrelated to SDF, right? Would this be erroneously 
reporting successful bundle processing, or is it a minor issue since the 
pipeline is being shut down?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to