jmx-dev JDK-7120365 DiffHBTest.java fails due to ConcurrentModificationException
shanliang
shanliang.jiang at oracle.com
Wed Dec 26 07:07:03 PST 2012
Yes should use a cop[y, it is a mistake to use a unmodifiable view.
Here is the new webrev:
http://cr.openjdk.java.net/~sjiang/JDK-7120365/webrev.02/
I have added a new test to reproduce the bug in an almost sure way.
Thanks,
Shanliang
Alan Bateman wrote:
> On 24/12/2012 14:08, shanliang wrote:
>> webrev: http://cr.openjdk.java.net/~sjiang/JDK-7120365/webrev.00/
>>
>> The test is correct, it was implemented to verify the fix for bug
>> 4911721, but in addition it detects luckily another problem within
>> the method ServerNotifForwarder.snoopOnUnregister
>>
>> The problem was that during a "for" cycle, the set list was modified
>> by anther thread, the solution is to use a unmodifiable set.
>>
>> This fix is important, it not only re-enables a test, but also fixes
>> a concurrent modification bug in the jmx notification.
>>
>> Shanliang
> Are you sure this is right? I don't know this code but from a brief
> glance then it appears to me that all access to listenerMap requires
> first synchronizes on it and maybe you need to do this and then take a
> copy (not a unmodifiable view) of the delegate set before you iterate
> over it. Apologies if you looked at this in detail, it's just not
> clear to me how using an unmodifiable view fixes the problem if the
> issue is actually that other threads are modifying the set.
>
> -Alan
More information about the serviceability-dev
mailing list