Github user zentol commented on the issue: https://github.com/apache/flink/pull/5394 I think neither solve the problem. Variant 2 looks identical to what we have in master. Variant 1 only allows interrupts after the task was canceled. According to what @StephanEwen said, if the UDF throws an exception after the task was canceled the exception will be suppressed and should not lead to a test failure. Since the test did fail it thus must've been thrown _before_ the task was cancelled. Given that variant 1 still throws an exception in this case we aren't solving the stability issue.
---