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

Dennis Sosnoski dms at sosnoski.com
Wed Apr 2 17:06:35 EDT 2014

On 04/03/2014 01:06 AM, Paul Sandoz wrote:
> On Apr 2, 2014, at 1:16 AM, Dennis Sosnoski <dms at sosnoski.com> wrote:
>> ...
>> When I run it from the command line it mostly doesn't make it through the first call to run(). Sometimes it does, but it generally only makes a few passes before hanging. In other circumstances (such as running inside Eclipse) I've seen it make it all the way through to the end, though most often it also hangs there in the first few passes. I'm thinking it might be Hotspot related because of the halting pattern.
> My gut feeling is that it is more likely to be a race condition in the CompletableFuture.thenCombine and completion linked list management code.

What I meant to say in my original email was that it seemed like the 
failure either occurred in the first few loop executions or not at all, 
and I thought it might relate to optimizations in the JVM eliminating 
the window for this to occur. But even if that's the case, there still 
has to be a problem either in the classes or the VM implementation, and 
this would show up with "random" failures in other code.

I first saw the problem with a slightly more complex set of 
calculations, just reduced it down to what I provided to keep things simple.

   - Dennis

More information about the Concurrency-interest mailing list