RFR: JDK-8303742: CompletableFuture.orTimeout leaks if the future completes exceptionally

Viktor Klang duke at openjdk.org
Thu Mar 16 13:43:13 UTC 2023


Addresses the situation where exceptional completion of `orTimeout`:ed CompletableFutures wouldn't cancel the timeout task which could lead to memory leaks if done frequently enough with long enough timeout durations.

Fix discussed with @DougLea

-------------

Commit messages:
 - Adding a regression test for 8303742
 - Addressing JDK-8303742 by removing the check for a null exception in Canceller

Changes: https://git.openjdk.org/jdk/pull/13059/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=13059&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8303742
  Stats: 50 lines in 2 files changed: 49 ins; 0 del; 1 mod
  Patch: https://git.openjdk.org/jdk/pull/13059.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/13059/head:pull/13059

PR: https://git.openjdk.org/jdk/pull/13059


More information about the core-libs-dev mailing list