Yilong, You need to be subscribed to the dev list in order to post to it.
On 13/09/2015 14:08, Yilong Li wrote: > Hi Mark, > > On Sun, Sep 13, 2015 at 4:08 AM, Mark Thomas <ma...@apache.org > <mailto:ma...@apache.org>> wrote: > > Please do not add any more RV-Predict bug reports to Bugzilla until the > current set have been evaluated. To be honest it would have been better > if you had paused after adding 58367-58379. > > > I am going to stop here because these are all the bugs reported by > RV-Predict in one run of the entire test suite. OK. Lets resolve these and then see where we stand. <snip/> > BZ 58367 is clearly a data race bug that is harmful. So are 58368 & > 58369. Consider the following code: > > if(st_200 == null ) { > st_200 = sm.getString("sc.200"); > } > return st_200; > > Since the field st_200 is in a data race, it's legal under JMM (Java > memory model) for this method to return null even when the first read of > st_200 returns a non-null value. How? Writes to references are atomic. sm.getString("sc.200"); is always going to return the same non-null String so once a thread has seen a non-null value for st_200 how can it later see a null one? > If you want it to be thread-safe, you > have to ensure there is at most one memory read: > > String s = st_200; > if(s == null ) { > st_200 = s = sm.getString("sc.200"); > } > return s; > > Only in this way, the data race becomes benign. I can see this would help if something was changing the value of st_200 from non-null to null, but nothing is. Mark --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org