RFR 8049220: URL.factory data race (original) (raw)
Paul Sandoz paul.sandoz at oracle.com
Fri Jul 4 14:54:30 UTC 2014
- Previous message: RFR 8049220: URL.factory data race
- Next message: RFR 8049220: URL.factory data race
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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.
- Previous message: RFR 8049220: URL.factory data race
- Next message: RFR 8049220: URL.factory data race
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]