[concurrency-interest] (no subject)

David Stuebe davidstuebe at upserve.com
Mon Aug 6 10:10:33 EDT 2018


Hey folks

Attempted to post this last week while I was joining the list. I think it
bounced. Please ignore if it is a repeat. I have not seen any responses and
I am sad.

I found some great discussion of a previous issue* with nested
Stream.parallel operations here and hoping I might find some answers to a
related question.
* http://cs.oswego.edu/pipermail/concurrency-interest/2014-May/012652.html

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.
https://gist.github.com/dstuebe/89361f64dc44a935e53d0a49f149317c#file-nestedparallel-java

The code deadlocks with the following stack trace:
https://gist.github.com/dstuebe/89361f64dc44a935e53d0a49f149317c#file-stacktrace-txt

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
loop.

Best

David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cs.oswego.edu/pipermail/concurrency-interest/attachments/20180806/543a8fb9/attachment.html>


More information about the Concurrency-interest mailing list