> When [JDK-8277969](https://bugs.openjdk.org/browse/JDK-8277969) was > implemented, a list of outstanding response subscribers was added to > `HttpClientImpl`. A body subscriber is added to the list after being created > and is removed from the list when it is completed, either successfully or > exceptionally. > > It appears that in the case where the subscription is cancelled before the > subscriber is completed, the subscriber might remain registered in the list > forever, or at least until the HttpClient gets garbage collected. This can be > easily reproduced using streaming subscribers, such as > BodySubscriber::ofInputStream. In the case where the input stream is closed > without having read all the bytes, Subscription::cancel will be called. > Whether the subscriber gets unregistered or not at that point becomes racy. > > Indeed, the reactive stream specification doesn't guarantee whether > onComplete or onError will be called or not after a subscriber cancels its > subscription. Any cleanup that would have been performed by > onComplete/onError might therefore need to be performed when the subscription > is cancelled too.
Daniel Fuchs has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains ten additional commits since the last revision: - Merge branch 'master' into inputstream-leak-8294916 - More review feedback - Update copyright years - Incorporated review feedback - More cleanup to the test - Minor cleanup to the test again - Minor cleanup to the test - Merge branch 'master' into inputstream-leak-8294916 - 8294916 ------------- Changes: - all: https://git.openjdk.org/jdk/pull/10659/files - new: https://git.openjdk.org/jdk/pull/10659/files/984e7e1d..74c2c702 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=10659&range=07 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=10659&range=06-07 Stats: 18865 lines in 895 files changed: 12135 ins; 3469 del; 3261 mod Patch: https://git.openjdk.org/jdk/pull/10659.diff Fetch: git fetch https://git.openjdk.org/jdk pull/10659/head:pull/10659 PR: https://git.openjdk.org/jdk/pull/10659
