[
https://issues.apache.org/jira/browse/FLINK-24294?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Dawid Wysakowicz closed FLINK-24294.
------------------------------------
Fix Version/s: 1.15.0
Resolution: Fixed
Fixed in:
* master
**
0be100bca749a8bf20dc1690632480aa93e8a5e8..249683b25655e1c8c17f3ac01e7739e558df1f9b
> Resources leak in the StreamTask constructor
> --------------------------------------------
>
> Key: FLINK-24294
> URL: https://issues.apache.org/jira/browse/FLINK-24294
> Project: Flink
> Issue Type: Bug
> Components: Runtime / Task
> Affects Versions: 1.14.0
> Reporter: Anton Kalashnikov
> Assignee: Anton Kalashnikov
> Priority: Major
> Labels: pull-request-available
> Fix For: 1.15.0
>
>
> Since we are initializing a lot of resources in the StreamTask constructor
> like RecordWriter, timerServices, etc. it is possible that some of these
> resources remain open if the exception happens below the initialization in
> the same constructor.
> So in my opinion, we have two choices here:
> * Avoiding allocation of resources in the constructor which allows us to do
> something like:
> {noformat}
> StreamTask task = new StreamTask(); //no leaks if it fails
> try {
> task.init();
> ....
> } finally {
> task.cleanUp();
> }
> {noformat}
> * or we can rewrite a code in such a way that exception in any
> constructor(ex. StreamTask) guarantee releasing the earlier allocated
> resources in this constructor. But it is not so easy to implement(see.
> initialization of recordWriter in StreamTask constructor)
> So perhaps it makes sense to separate creating object from
> initialization(allocation resources)
--
This message was sent by Atlassian Jira
(v8.20.1#820001)