You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2020/08/14 08:45:00 UTC

[jira] [Updated] (FLINK-18956) StreamTask.invoke should catch Throwable instead of Exception

     [ https://issues.apache.org/jira/browse/FLINK-18956?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

ASF GitHub Bot updated FLINK-18956:
-----------------------------------
    Labels: pull-request-available  (was: )

> StreamTask.invoke should catch Throwable instead of Exception
> -------------------------------------------------------------
>
>                 Key: FLINK-18956
>                 URL: https://issues.apache.org/jira/browse/FLINK-18956
>             Project: Flink
>          Issue Type: Bug
>          Components: Runtime / Task
>    Affects Versions: 1.11.0
>            Reporter: Dian Fu
>            Assignee: Dian Fu
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 1.12.0, 1.11.2
>
>
> In StreamTask.invoke, we should catch Throwable. Otherwise, cleanUpInvoke() will not be called if Error is thrown:
> {code}
> 	@Override
> 	public final void invoke() throws Exception {
> 		try {
> 			beforeInvoke();
> 			// final check to exit early before starting to run
> 			if (canceled) {
> 				throw new CancelTaskException();
> 			}
> 			// let the task do its work
> 			runMailboxLoop();
> 			// if this left the run() method cleanly despite the fact that this was canceled,
> 			// make sure the "clean shutdown" is not attempted
> 			if (canceled) {
> 				throw new CancelTaskException();
> 			}
> 			afterInvoke();
> 		}
> 		catch (Exception invokeException) {
> 			failing = !canceled;
> 			try {
> 				cleanUpInvoke();
> 			}
> 			// TODO: investigate why Throwable instead of Exception is used here.
> 			catch (Throwable cleanUpException) {
> 				Throwable throwable = ExceptionUtils.firstOrSuppressed(cleanUpException, invokeException);
> 				throw (throwable instanceof Exception ? (Exception) throwable : new Exception(throwable));
> 			}
> 			throw invokeException;
> 		}
> 		cleanUpInvoke();
> 	}
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)