[ 
https://issues.apache.org/jira/browse/HADOOP-6269?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Todd Lipcon updated HADOOP-6269:
--------------------------------

    Attachment: hadoop-6269.txt

OK. Here's the summary of a correct (I believe) fix:

- To avoid deadlock we need a lock ordering
- We'll order instance locks before class locks (ie you must never lock an 
instance when holding a class lock)

The issue is that addDefaultResource is currently static synchronized and locks 
a class instance by calling conf.reloadConfiguration (synchronized non-static)

Attaching a patch which breaks this synchronization by holding the lock only 
long enough to make a defensive copy of the shared list. I don't think this is 
a performance issue since addDefaultResource is called very rarely.

Tests pass. Will test on the application that keeps turning up this bug here. 
Review would be appreciated.

> 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.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