[ 
https://issues.apache.org/jira/browse/HDFS-14279?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16773276#comment-16773276
 ] 

Erik Krogen commented on HDFS-14279:
------------------------------------

I ran some benchmarks offline and found that the use of {{volatile}} instead of 
{{synchronized}} wasn't helping performance at all. I ran with a client with 
100/1000/5000 threads all doing {{getFileInfo()}} via the 
ObserverReadProxyProvider with my v000 (using volatile) and v001 (using 
synchronized always) patches and found no substantial speedup from v000. So, go 
with the simpler approach of always synchronizing. Attaching v001 patch 
accordingly.

> [SBN Read] Race condition in ObserverReadProxyProvider
> ------------------------------------------------------
>
>                 Key: HDFS-14279
>                 URL: https://issues.apache.org/jira/browse/HDFS-14279
>             Project: Hadoop HDFS
>          Issue Type: Bug
>          Components: hdfs, namenode
>            Reporter: Erik Krogen
>            Assignee: Erik Krogen
>            Priority: Major
>         Attachments: HDFS-14279.000.patch, HDFS-14279.001.patch
>
>
> There is a race condition in {{ObserverReadProxyProvider#getCurrentProxy()}}:
> {code}
>   private NNProxyInfo<T> getCurrentProxy() {
>     if (currentProxy == null) {
>       changeProxy(null);
>     }
>     return currentProxy;
>   }
> {code}
> {{currentProxy}} is a {{volatile}}. Another {{changeProxy()}} could occur 
> after the {{changeProxy()}} and before the {{return}}, thus making the return 
> value incorrect. I have seen this result in an NPE.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to