[concurrency-interest] CHM.compute restrictions (was: no subject)
dl at cs.oswego.edu
Mon Aug 6 10:31:55 EDT 2018
On 08/06/2018 10:10 AM, David Stuebe via Concurrency-interest wrote:
> Hey folks
> Attempted to post this last week while I was joining the list.
To reduce spam, non-member posts are silently dropped. Sorry.
> I am using a ConcurrentHashMap.compute operation in an outer
> Stream.parallel forEach operation. A library used in the compute method
> also uses Stream.parallel.
> I have written a test that illustrates the issue and explores different
> implementations in 215 lines of code.
> The code deadlocks with the following stack trace:
> I do not understand why line 87 (the compute block) appears to be called
> recursively leading to deadlock when I use Stream.parallel for the outer
A recursive CHM.compute call appears to invoked while trying to
initialize the contents of an element in the same map, which is
disallowed in general, but sometimes works anyway. In most other cases,
CHM successfully detects this and throws an exception, but it cannot
catch all of them.
More information about the Concurrency-interest