GitHub user uce opened a pull request: https://github.com/apache/flink/pull/2996
[FLINK-5326] [network] Check release flag of parent in reader In `PipelinedSubpartitionView`, there is a possible race with releasing the parent subpartition and querying for a buffer in the view. The parent partition release clears all buffers in locked scope and releases the view outside of the lock. If concurrently the view is queried for a buffer it might get `null`, which is only allowed if the view was released. Because the release is only forwarded out of the lock scope, this can happen before the release has propagated. As a solution, we check the parent release status as well in the view. This is how it is handled in the spilled views, too. This surfaced with the recent refactorings, because the previous consumption model required multiple rounds of `get, registerListener, isReleased` calls, which hid this problem. The added parent isReleased call does not affect normal operation as it is only checked when the returned buffer is null, which only happens when the partition is consumed or released. --- This needs to be applied to `release-1.1`, too. cc @StephanEwen You can merge this pull request into a Git repository by running: $ git pull https://github.com/uce/flink 5326-illegal_state Alternatively you can review and apply these changes as the patch at: https://github.com/apache/flink/pull/2996.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #2996 ---- commit d965d5abdc389e9b65fd35a69bb16bfb71008504 Author: Ufuk Celebi <u...@apache.org> Date: 2016-12-13T10:26:47Z [FLINK-5326] [network] Check release flag of parent in reader In PipelinedSubpartitionView, there is a possible race with releasing the parent subpartition and querying for a buffer in the view. The parent partition release clears all buffers in locked scope and releases the view outside of the lock. If concurrently the view is queried for a buffer it might get null, which is only allowed if the view was released. Because the release is only forwarded out of the lock scope, this can happen before the release has propagated. As a solution, we check the parent release status as well in the view. This is how it is handled in the spilled views, too. This surfaced with the recent refactorings, because the previous consumption model required multiple rounds of get, registerListener, isReleased calls, which hid this problem. ---- --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---