rkhachatryan commented on a change in pull request #12525:
URL: https://github.com/apache/flink/pull/12525#discussion_r439243834



##########
File path: 
flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/StreamTask.java
##########
@@ -646,10 +653,14 @@ protected void cleanUpInvoke() throws Exception {
                try {
                        channelIOExecutor.shutdown();
                } catch (Throwable t) {
-                       LOG.error("Error during shutdown the channel state 
unspill executor", t);
+                       suppressedThrowable = 
ExceptionUtils.firstOrSuppressed(t, suppressedThrowable);
                }
 
                mailboxProcessor.close();
+
+               if (suppressedThrowable != null) {
+                       throw (Exception) suppressedThrowable;

Review comment:
       So `OutOfMemoryError` will be masked as `ClassCastException` at the 
runtime which is not desirable.
   
   I think we can't replace `catch Throwable` to the usual `catch Exception` 
because cleanup is desirable even in case of fatal errors.
   And we don't want to propagate `Throwable`.
   
   So we have to wrap `Throwable` somewhere (I think here, in the end of 
`cleanUpInvoke`).
   
   Edit: if we wrap all errors as I [suggested 
above](https://github.com/apache/flink/pull/12525#discussion_r438652781) then 
`suppressedThrowable` can be just `Exception` and we don't need nor cast nor to 
wrap it.




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