[
https://issues.apache.org/jira/browse/FLINK-24182?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17411048#comment-17411048
]
Piotr Nowojski commented on FLINK-24182:
----------------------------------------
I agree this technically could be treated as a bug, but at the same time this
behaviour is so old (dating back to a commit
{{964aede783bee8e9a8b97de78ac1ecec99265876}} from 2011), and so crucial part of
the contract, that I would actually only fix it for 1.15.0 and arguably a
behaviour like that is no longer a bug.
After an offline discussion we are proposing two changes:
# no more interruption once the task exited its main loop and is closing
operators. Basically {{shouldInterruptOnCancel = false;}} should be moved
earlier in the {{StreamTask}}. If task is already closing, interrupting can
lead to resource leaks. So if task is stuck in closing, the only thing we can
do is to fail whole JVM.
# delay interruptions a bit. Currently interruptions are issued immediately. A
proper shutdown behaviour should probably first give time task to shutdown
cleanly. After 50% of the time out, start issuing interrupts. After 100% of the
timeout kill JVM.
(2)
> Tasks canceler should not immediately interrupt
> -----------------------------------------------
>
> Key: FLINK-24182
> URL: https://issues.apache.org/jira/browse/FLINK-24182
> Project: Flink
> Issue Type: Improvement
> Components: Runtime / Task
> Reporter: Arvid Heise
> Priority: Major
>
> While debugging resource leaks (FLINK-24131), I found that any connector is
> immediately interrupted on cancel. Hence, any attempts of using blocking
> calls in {{close}} to cleanup resources are immediately unreliable (e.g.
> aborting transactions).
> It would be nice if tasks get a grace period (e.g.
> task.cancellation.interval) where they can try to free resources in a proper,
> potentially blocking fashion before being interrupted.
> Nevertheless, connectors should always expect interruptions during shutdown,
> in particular when the user-configurable grace period is depleted. I'd add
> that to the connector documentation in a separate effort.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)