RFR 8230303 : JDB hangs when running monitor command

Ivan Gerasimov ivan.gerasimov at oracle.com
Tue Sep 10 03:41:58 UTC 2019


Hello!

jdb utility has a command 'monitor <command>', which allows to execute 
the specified command every time the debuggee stops.

If the <command> modifies the list of installed monitors (the simplest 
example is 'monitor unmonitor 1'), then jdb hits a 
ConcurrentModificationException, and hangs the debuggee.

While it is questionable, if modifying the monitor list has to be 
implemented in some specific way, it seems sensible to at least prevent 
a hard failure.

The simplest fix appears to be to use CopyOnWriteArrayList, so that an 
immutable snapshot of the list will be traversed.
Even if the list is modified, it wouldn't affect any iterator that might 
exist at that moment of time.

BUGURL: https://bugs.openjdk.java.net/browse/JDK-8230303
WEBREV: http://cr.openjdk.java.net/~igerasim/8230303/00/webrev/

Mach5 control build was successfully run with hs-tier7-rt, which 
includes the new test and other jdb related tests.

Would you please help review?
Thanks in advance!

-- 
With kind regards,
Ivan Gerasimov



More information about the serviceability-dev mailing list