[ 
https://issues.apache.org/jira/browse/HADOOP-6269?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12772425#action_12772425
 ] 

Hemanth Yamijala commented on HADOOP-6269:
------------------------------------------

I looked at the patch using CopyOnWriteArrayList. It seems like a reasonable 
approach to me, except for one point that I will mention in a bit. First I 
would like to see what others think about the usage of CopyOnWriteArrayList.

The defaultResources structure is modified only once per resource in the 
lifetime of an application - like a hadoop daemon or client. It is iterated 
over more number of times - typically every time a configuration instance is 
loaded in the application. Going from the javadoc for the CopyOnWriteArrayList, 
it does seem the usage is appropriate. The result of using this structure is a 
simpler code change that is fixing the problem at hand. Given these points, 
does the patch seem like a right direction ? (Todd, your thoughts ?)

Now, regarding the patch, even if we do agree on using it, I suppose we might 
still need to synchronize addDefaultResources, because the contains check needs 
to be synchronized with the add check, no ?



> Missing synchronization for defaultResources in Configuration.addResource
> -------------------------------------------------------------------------
>
>                 Key: HADOOP-6269
>                 URL: https://issues.apache.org/jira/browse/HADOOP-6269
>             Project: Hadoop Common
>          Issue Type: Bug
>          Components: conf
>    Affects Versions: 0.20.1
>            Reporter: Todd Lipcon
>            Assignee: Todd Lipcon
>             Fix For: 0.20.2, 0.21.0
>
>         Attachments: HADOOP-6269-1.patch, hadoop-6269.txt, hadoop-6269.txt
>
>
> Configuration.defaultResources is a simple ArrayList. In two places in 
> Configuration it is accessed without appropriate synchronization, which we've 
> seen to occasionally result in ConcurrentModificationExceptions.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to