jigarkb opened a new issue, #37176:
URL: https://github.com/apache/beam/issues/37176

   **Overview:** The Call transform in RequestResponseIO currently catches 
exceptions thrown by the user-provided Caller.call method and wraps them in a 
generic UserCodeExecutionException.
   
   This behavior obscures specific retryable exceptions such as 
UserCodeRemoteSystemException and UserCodeTimeoutException. Because the retry 
logic relies on identifying these specific exception types to trigger 
exponential backoff, wrapping them causing them to be treated as non-retryable 
errors (immediately emitting them to the failure output or failing the 
pipeline) instead of retrying.
   
   **Location:** 
[sdks/java/io/rrio/src/main/java/org/apache/beam/io/requestresponse/Call.java 
(Lines 
613-624)](https://github.com/apache/beam/blob/ab2b8d3fa9b1eecb30f6ae1fa87be16feb677957/sdks/java/io/rrio/src/main/java/org/apache/beam/io/requestresponse/Call.java#L613-L624)
   
   **Current Code**:
   
   ```Java
     private static <T> void parseAndThrow(Future<T> future, ExecutionException 
e)
         throws UserCodeExecutionException {
       future.cancel(true);
       if (e.getCause() == null) {
         throw new UserCodeExecutionException(e);
       }
       Throwable cause = checkStateNotNull(e.getCause());
       if (cause instanceof UserCodeQuotaException) {
         throw new UserCodeQuotaException(cause);
       }
       throw new UserCodeExecutionException(cause);
     }
   ```
   
   **Suggested Fix:** The code should check if the caught exception is already 
a retryable type (or an instance of UserCodeExecutionException) and rethrow it 
directly, or unwrap it before making retry decisions.
   
   
   ```Java
   private static <T> void parseAndThrow(Future<T> future, ExecutionException e)
         throws UserCodeExecutionException {
       future.cancel(true);
       if (e.getCause() == null) {
         throw new UserCodeExecutionException(e);
       }
       Throwable cause = checkStateNotNull(e.getCause());
       if (cause instanceof UserCodeQuotaException userCodeQuotaException) {
         throw userCodeQuotaException;
       } else if (cause instanceof UserCodeTimeoutException 
userCodeTimeoutException) {
         throw userCodeTimeoutException;
       } else if (cause instanceof UserCodeRemoteSystemException 
userCodeRemoteSystemException) {
         throw userCodeRemoteSystemException;
       } else if (cause instanceof UserCodeExecutionException 
userCodeExecutionException) {
         throw userCodeExecutionException;
       }
       throw new UserCodeExecutionException(cause);
     }
   ```


-- 
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.

To unsubscribe, e-mail: [email protected]

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

Reply via email to