<core-libs-dev> sun.management.Agent: the properties.putAll API may fail with ConcurrentModifcationException on multi-thread scenario

Mandy Chung mandy.chung at oracle.com
Wed Apr 11 19:09:09 PDT 2012


On 4/11/2012 12:36 AM, Deven You wrote:
> Hi core-libs-devs,
>
> I am not sure if sun.management.Agent belongs to jmx-dev mailing list, 
> if so please anyone tell me.
>

serviceability-dev (cc'ed) is the mailing list for this patch.

> This issue is that the sun.management.Agent.loadManagementProperties() 
> will invoke properties.putAll which will throw 
> ConcurrentModifcationException if there are other threads which modify 
> the properties concurrently.
>
> I have made a patch[1] which synchronize the sysProps so that putAll 
> can work on multi-thread scenario. The test case is also available in 
> [1].
>

I think this could still run into CME.  System Properties is not a 
synchronized map and the setter methods (System.setProperty or 
Properties.put method) doesn't synchronize on the Properties object.

Mandy

> Thanks a lot!
>
> [1] http://cr.openjdk.java.net/~littlee/OJDK-256/webrev.00 
> <http://cr.openjdk.java.net/%7Elittlee/OJDK-256/webrev.00>
>


More information about the serviceability-dev mailing list