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

Deven You youdwei at linux.vnet.ibm.com
Tue Apr 17 07:33:16 UTC 2012


On 04/12/2012 10:09 AM, Mandy Chung wrote:
> 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>
>>
>
Hi Mandy,

I didn't catch you. Do you mean there are other setter methods of System 
properties in the Agent.java which are not synchronized?

Thanks a lot!

-- 
Best Regards,

Deven




More information about the core-libs-dev mailing list