[concurrency-interest] Java 8 CompletableFuture.thenCombine() hangs

Doug Lea dl at cs.oswego.edu
Mon Apr 14 19:53:34 EDT 2014

On 04/14/2014 11:41 AM, Paul Sandoz wrote:
> I originally thought that the tail recursion fix would cover most cases, but
> as you have shown it is quite easy to create a linked list of completions > 1
> node.

Recapping: Because we cannot guarantee that a StackOverflowError
in another thread will always be noticed, we solve the harder-looking
problem of preventing them, by loopifying tail-recursion and/or heap-
allocating frames. So now people can write CompletableFuture based
recursive constructions that would blow up if coded using straight
recursion. Strange but true.

> Relevant jtreg unit tests pass with the latest fix.

I'll sit on this a few days in case anyone has any further
comments or experiences and then go for OpenJDK integration
via JDK-8039378.


More information about the Concurrency-interest mailing list