rkhachatryan commented on a change in pull request #12525:
URL: https://github.com/apache/flink/pull/12525#discussion_r442100640
##########
File path:
flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/StreamTask.java
##########
@@ -611,27 +611,21 @@ protected void cleanUpInvoke() throws Exception {
Thread.interrupted();
// stop all timers and threads
- tryShutdownTimerService();
+ Exception suppressedException =
suppressThrowable(this::tryShutdownTimerService, null);
// stop all asynchronous checkpoint threads
- try {
- cancelables.close();
- shutdownAsyncThreads();
- } catch (Throwable t) {
- // catch and log the exception to not replace the
original exception
- LOG.error("Could not shut down async checkpoint
threads", t);
- }
+ suppressedException = suppressThrowable(cancelables::close,
suppressedException);
+ suppressedException =
suppressThrowable(this::shutdownAsyncThreads, suppressedException);
// we must! perform this cleanup
- try {
- cleanup();
- } catch (Throwable t) {
- // catch and log the exception to not replace the
original exception
- LOG.error("Error during cleanup of stream task", t);
- }
+ suppressedException = suppressThrowable(this::cleanup,
suppressedException);
// if the operators were not disposed before, do a hard dispose
- disposeAllOperators(true);
+ try {
+ disposeAllOperators();
+ } catch (Exception t) {
+ suppressedException =
ExceptionUtils.firstOrSuppressed(t, suppressedException);
+ }
// release the output resources. this method should never fail.
if (operatorChain != null) {
Review comment:
In the current `master`, if an exception is thrown in both
`shutdownAsyncThreads` **and** `operatorChain.releaseOutputs` then both
exceptions are logged/thrown.
In this PR, only the latter will be thrown.
The simplest fix is to add `if (suppressedException != null) throw
suppressedException;` before `if (operatorChain != null)` and
`mailboxProcessor.close`.
More elegant way is to add `fail-immediately` flag to
`runAndSuppressThrowable` with `true` for lines 629 and 640.
----------------------------------------------------------------
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]