rkhachatryan commented on a change in pull request #16885:
URL: https://github.com/apache/flink/pull/16885#discussion_r695619167
##########
File path:
flink-runtime/src/main/java/org/apache/flink/runtime/taskmanager/Task.java
##########
@@ -762,17 +762,21 @@ private void doRun() {
executingThread.setContextClassLoader(userCodeClassLoader.asClassLoader());
AbstractInvokable finalInvokable = invokable;
- runWithSystemExitMonitoring(finalInvokable::restore);
+ try {
+ runWithSystemExitMonitoring(finalInvokable::restore);
- if (!transitionState(ExecutionState.INITIALIZING,
ExecutionState.RUNNING)) {
- throw new CancelTaskException();
- }
+ if (!transitionState(ExecutionState.INITIALIZING,
ExecutionState.RUNNING)) {
+ throw new CancelTaskException();
+ }
- // notify everyone that we switched to running
- taskManagerActions.updateTaskExecutionState(
- new TaskExecutionState(executionId,
ExecutionState.RUNNING));
+ // notify everyone that we switched to running
+ taskManagerActions.updateTaskExecutionState(
+ new TaskExecutionState(executionId,
ExecutionState.RUNNING));
- runWithSystemExitMonitoring(finalInvokable::invoke);
+ runWithSystemExitMonitoring(finalInvokable::invoke);
+ } finally {
+ runWithSystemExitMonitoring(finalInvokable::cleanUp);
+ }
Review comment:
For the record:
I dicussed it with @xintongsong offline. There were no concerns regarding
merging the bugfix as well as the refactoring if it's necessary.
--
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]