[concurrency-interest] A race in SubmissionPublisher?

Doug Lea dl at cs.oswego.edu
Sun Nov 26 15:56:47 EST 2017


Back to...

On 09/26/2017 07:51 AM, Doug Lea wrote:
> On 09/25/2017 09:21 AM, Pavel Rappo wrote:
>> Hi,
>>
>> I've been using SubmissionPublisher in my own publisher implementation in order
>> to reuse its complex state machine that serializes invocations to subscribers.
>>
>> While testing my implementation I ran into what I believe might be a race
>> condition in SubmissionPublisher.
> 
> Thanks for finding a use case that at first doesn't even seem legal,
> but I agree should work according to spec, and breaks assumptions
> about produce-consumer relations that can cause a wakeup not to be
> issued. I'll post a fix at the corresponding bug report:
>   https://bugs.openjdk.java.net/browse/JDK-8187947
> after deciding which of a couple of ways to address.
> 

It took a while to decide, but a fix is now in jsr166 and will
hopefully be reviewed for next JDK release. Reviews would be welcome
(see
http://gee.cs.oswego.edu/cgi-bin/viewcvs.cgi/jsr166/src/main/java/util/concurrent/SubmissionPublisher.java?view=log)

While I'm at it: One of the goals for SubmissionPublisher is to
be a good (often the best) choice for any producer-consumer
design, not only those plugging into existing Reactive frameworks.
Performance should be good, and the API makes them the easy
to express once you get past initial unfamiliarity.

-Doug





More information about the Concurrency-interest mailing list