[ 
https://issues.apache.org/jira/browse/BEAM-10959?focusedWorklogId=491369&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-491369
 ]

ASF GitHub Bot logged work on BEAM-10959:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 25/Sep/20 19:17
            Start Date: 25/Sep/20 19:17
    Worklog Time Spent: 10m 
      Work Description: 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]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 491369)
    Time Spent: 4h 20m  (was: 4h 10m)

> Fix race where split/progress calls return "Unknown process bundle 
> instruction"
> -------------------------------------------------------------------------------
>
>                 Key: BEAM-10959
>                 URL: https://issues.apache.org/jira/browse/BEAM-10959
>             Project: Beam
>          Issue Type: Bug
>          Components: sdk-py-harness
>            Reporter: Luke Cwik
>            Assignee: Luke Cwik
>            Priority: P2
>          Time Spent: 4h 20m
>  Remaining Estimate: 0h
>
> Currently there is a race where a BundleProcessor doesn't exist until another 
> thread picks up the task and inserts into the active set. This allows for 
> split/progress calls to happen and error out with "Unknown process bundle 
> instruction X".
> Since the control stream is ordered, we can guarantee that an uninitialized 
> BundleProcessor exists that can respond to this really early split/progress 
> calls.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to