RFR: 8222968 ByteArrayPublisher is not thread-safe resulting in broken re-use of HttpRequests

Chris Hegarty chris.hegarty at oracle.com
Thu Jun 27 11:30:10 UTC 2019


> On 27 Jun 2019, at 12:16, Daniel Fuchs <daniel.fuchs at oracle.com> wrote:
> 
> Hi Micahel, Chris,
> 
> On 27/06/2019 11:50, Chris Hegarty wrote:
>>> http://cr.openjdk.java.net/~michaelm/8222968/webrev.1/index.html
>> If I’m not mistaken, then after this change there will be no explicit
>> reference to the PullPublisher. There is an implicit reference from the
>> nested Subscription. I think this should be ok, but just want to ensure
>> that this has been considered.
> 
> I had similar concerns. Note that the FilePublisher (later in that
> same file) already uses a local variable for the PullPublisher,
> so there's a precedent.
> Hopefully we would have seen some failures already if that had been
> an issue. Once the subscription has been forwarded to the subscriber
> then the publisher has served its role, and it might not matter
> if it's GC'ed or not as long as the subscription itself keeps
> operating. I have convinced myself that it would not be an issue
> after looking at PullPublisher.java.

It is not an issue because there is an implicit reference ( from the
nested class ). If we believe that the publisher is not strictly needed,
then let's make the nested Subscription static, which will mean no ref,
and is explicit. Concerns?

-Chris.


More information about the net-dev mailing list