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

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

                Author: ASF GitHub Bot
            Created on: 25/Sep/20 19:44
            Start Date: 25/Sep/20 19:44
    Worklog Time Spent: 10m 
      Work Description: lukecwik commented on a change in pull request #12934:
URL: https://github.com/apache/beam/pull/12934#discussion_r495196469



##########
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:
       From my understanding I also think it should be fine since it is on 
shutdown.




----------------------------------------------------------------
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: 491386)
    Time Spent: 5h  (was: 4h 50m)

> 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: 5h
>  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