RFR 8049220: URL.factory data race

Peter Levart peter.levart at gmail.com
Mon Jul 7 11:07:27 UTC 2014


Hi Pavel, Alan and Paul,

Thanks for reviewing. I accepted the suggestions from Pavel and Paul and 
created webrev.02:

http://cr.openjdk.java.net/~plevart/jdk9-dev/URL.factory/webrev.02/

Is this good to go into jdk9-dev?

Regards, Peter


On 07/04/2014 04:54 PM, Paul Sandoz wrote:
> On Jul 3, 2014, at 6:33 PM, Alan Bateman <Alan.Bateman at oracle.com> wrote:
>> On 03/07/2014 09:43, Peter Levart wrote:
>>> Hi,
>>>
>>> I noticed a data race in java.net.URL:
>>>
>>>     https://bugs.openjdk.java.net/browse/JDK-8049220
>>>
>>> I propose the following simple patch:
>>>
>>> http://cr.openjdk.java.net/~plevart/jdk9-dev/URL.factory/webrev.01/
>>>
>> A good catch and the change looks good to me.
> Yes, well spotted. May i suggest that the following comment is updated:
>
> 1109             factory = fac; // volatile write
>
> to say something about ensuring safe publication of a constructed handle? since it is often quite tricky to reason about why a volatile write is needed (to stamp in, at least, a StoreStore barrier).
>
> For JMM v9 we may not need to mark such a ref as volatile.
>
>
>> I assume it just wasn't noticed because it can only be set once and probably rared used too.
>>
> Yeah, i wonder whether it would ever get optimized/inlined to the point at which re-ordering could practically happen.
>
> Paul.
>



More information about the net-dev mailing list