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

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

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



##########
File path: sdks/python/apache_beam/runners/worker/sdk_worker.py
##########
@@ -543,15 +602,19 @@ def process_bundle_split(self,
                            instruction_id  # type: str
                           ):
     # type: (...) -> beam_fn_api_pb2.InstructionResponse
-    processor = self.bundle_processor_cache.lookup(request.instruction_id)
-    if processor:
-      return beam_fn_api_pb2.InstructionResponse(
-          instruction_id=instruction_id,
-          process_bundle_split=processor.try_split(request))
-    else:
+    try:
+      processor = self.bundle_processor_cache.lookup(request.instruction_id)
+    except RuntimeError:
       return beam_fn_api_pb2.InstructionResponse(
-          instruction_id=instruction_id,
-          error='Instruction not running: %s' % instruction_id)
+          instruction_id=instruction_id, error=traceback.format_exc())
+    # Return an empty response if we aren't running. This can happen
+    # if the ProcessBundleRequest has not started or already finished.
+    process_bundle_split = (
+        processor.try_split(request)
+        if processor else beam_fn_api_pb2.ProcessBundleSplitResponse())

Review comment:
       So to be clear, the semantics are required to be:
   
   Receive PB request for INST. -> Empty Splits & and Progress
   INST starts having results -> Return results.
   INST finishes -> EmptySplits and progress until "expired".
   And the "I don't know" is an error for  every other circumstance?
   
   In the case where the bundle finishes, but requires Finalization, it INST 
should remain valid and Empties until finalization occurs.
   




----------------------------------------------------------------
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: 491422)
    Time Spent: 7h  (was: 6h 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: 7h
>  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