[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-hotspot-runtime-dev
Subject:    Re: Does CollectedHeap::print_on() need Heap_lock?
From:       Thomas Schatzl <thomas.schatzl () oracle ! com>
Date:       2016-04-29 12:35:19
Message-ID: 1461933319.2923.44.camel () oracle ! com
[Download RAW message or body]

Hi,

On Fri, 2016-04-29 at 21:12 +0900, Yasumasa Suenaga wrote:
> Hi Thomas,
> 
> Thank you for replying.
> 
> > 
> > It is not required. The methods are only ever called at a
> > safepoint.
> No, it is called from Attach Listener thread.
> I run JDK 9 EA b112 x64 Linux on GDB, and I got call stack as below:
> 
> ----------------
> Breakpoint 2, 0x00007ffff659b970 in HeapInfoDCmd::execute(DCmdSource,
> Thread*)
>           () from /usr/local/jdk-9/lib/amd64/server/libjvm.so
> (gdb) bt
> #0    0x00007ffff659b970 in HeapInfoDCmd::execute(DCmdSource, Thread*)
> ()
>         from /usr/local/jdk-9/lib/amd64/server/libjvm.so
> #1    0x00007ffff65a764c in DCmd::parse_and_execute(DCmdSource,
> outputStream*, char const*, char, Thread*) () from /usr/local/jdk-
> 9/lib/amd64/server/libjvm.so
> #2    0x00007ffff633bf80 in jcmd(AttachOperation*, outputStream*) ()
>         from /usr/local/jdk-9/lib/amd64/server/libjvm.so
> #3    0x00007ffff633cca9 in attach_listener_thread_entry(JavaThread*,
> Thread*) ()
>         from /usr/local/jdk-9/lib/amd64/server/libjvm.so
> #4    0x00007ffff6b6f876 in JavaThread::thread_main_inner() ()
>         from /usr/local/jdk-9/lib/amd64/server/libjvm.so
> #5    0x00007ffff6b6f982 in JavaThread::run() ()
>         from /usr/local/jdk-9/lib/amd64/server/libjvm.so
> #6    0x00007ffff69faad2 in java_start(Thread*) ()
>         from /usr/local/jdk-9/lib/amd64/server/libjvm.so
> #7    0x00007ffff79b060a in start_thread (arg=0x7fffa490c700)
>           at pthread_create.c:334
> #8    0x00007ffff72d8a4d in clone ()
>           at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109
> ----------------
> 
> According to you, I guess HeapInfoDCmd should enter safepoint or get
> Heap_lock.
> Is it correct?

   I always thought that DCmds doing heap operations tend to start a
safepoint, but of course this is configurable.

To get some kind of consistent view on the heap, print_on() should hold
the heap lock or be at a safepoint.

Thanks,
   Thomas
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic