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

√iktor Ҡlang viktor.klang at gmail.com
Thu Apr 3 11:00:59 EDT 2014


In Scala, we solve these problems primarily by:

* Always executing callbacks *asynchronously[1]*—i.e. we get a
*trampolining* effect that avoids StackOverflowErrors.
* Always *compressing[2]* intermittent futures, so that *asynchronous tail
calls[3]* (potentially nested "infinite" thenCompose) don't lead to a long
chain of intermittent Futures that have no use (avoiding OutOfMemoryErrors).

[1]:
https://github.com/viktorklang/scala/blob/master/src/library/scala/concurrent/impl/Promise.scala#L35
[2]:
https://github.com/scala/scala/blob/master/src/library/scala/concurrent/impl/Promise.scala#L289
[3]: Example: https://gist.github.com/viktorklang/9414163



On Thu, Apr 3, 2014 at 1:08 PM, Doug Lea <dl at cs.oswego.edu> wrote:

> On 04/03/2014 04:28 AM, Paul Sandoz wrote:
>
>  It appears to be caused by a StackOverflowException being thrown when an
>> async task attempts to complete all its dependent tasks in the completion
>> chain. That exception gets swallowed and does not propagate.
>>
>
> Thanks! I'll look into ways of ensuring that StackOverflowException,
> OutOfMemoryError, and the like at least get reported. These have
> a history of being difficult to deal with, but we can surely do
> better.
>
> -Doug
>
> _______________________________________________
> Concurrency-interest mailing list
> Concurrency-interest at cs.oswego.edu
> http://cs.oswego.edu/mailman/listinfo/concurrency-interest
>



-- 
Cheers,
√
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cs.oswego.edu/pipermail/concurrency-interest/attachments/20140403/8e38e41c/attachment-0001.html>


More information about the Concurrency-interest mailing list