RFR: 8282241: Invalid generic signature for redefined classes
JDK-8238048 (fixed in jdk15) moved major_version, minor_version, generic_signature_index and source_file_name_index from InstanceKlass to ConstantPool. We still have some incorrect code in CP merge during class redefinition. rewrite_cp_refs(scratch_class) updates generic_signature_index and source_file_name_index in the scratch_cp, so we need to copy the attributes (merge_cp->copy_fields(scratch_cp())) after rewrite_cp_refs. In redefine_single_class we don't need to copy source_file_name_index because it's a CP property and we swap CPs. So this copying actually sets the value from old class. tested: - test/jdk/java/lang/instrument - test/hotspot/jtreg/serviceability/jvmti/RedefineClasses - test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses - test/hotspot/jtreg/vmTestbase/nsk/jvmti/RetransformClasses - Commit messages: - JDK-8282241 Changes: https://git.openjdk.java.net/jdk/pull/7676/files Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=7676&range=00 Issue: https://bugs.openjdk.java.net/browse/JDK-8282241 Stats: 249 lines in 2 files changed: 239 ins; 7 del; 3 mod Patch: https://git.openjdk.java.net/jdk/pull/7676.diff Fetch: git fetch https://git.openjdk.java.net/jdk pull/7676/head:pull/7676 PR: https://git.openjdk.java.net/jdk/pull/7676
Possible memory leak in invoker_completeInvokeRequest()?
A user is reporting a memory leak starting from invoker_completeInvokeRequest(). Consider the trace below (relative to JDK11): It looks like invoker_completeInvokeRequest() calls outStream_writeValue(), which calls outStream_writeObjectRef(), which then ends up calling commonRef_refToID(). There a new node is created via newCommonRef(). I am not sure about the intended lifecycle of the RefNode object in the hashtable. Is it cleaned when the backing Java object gets collected? Or does it have to be released explicitely via commonRef_release()? (There is another leak in the same block of code in invoker_completeInvokeRequest(): the PacketOutputStream gets initialized via outStream_initReply(&out, id), but it seems like it's missing a corresponding outStream_destroy(&out). I'm working on a fix already: https://github.com/rkennke/jdk11u-dev/tree/memleak-invoker2 I will do it vs jdk19, but I want to understand the other leak first, maybe I can group the fixes.) [115200 bytes leaked] je_prof_backtrace (/home/sandreev/git/misc/jemalloc/src/prof.c:636 (discriminator 2)) je_malloc_default (/home/sandreev/git/misc/jemalloc/src/jemalloc.c:2289) os::malloc (/tmp/jdk11u-dev/./src/hotspot/share/runtime/os.cpp:682) JvmtiEnv::Allocate (/tmp/jdk11u-dev/./src/hotspot/share/prims/jvmtiEnv.cpp:127) jvmti_Allocate (/tmp/jdk11u-dev/./build/linux-x86_64-normal-server-release/hotspot/variant-server/gensrc/jvmtifiles/jvmtiEnter.cpp:343) jvmtiAllocate (/tmp/jdk11u-dev/./src/jdk.jdwp.agent/share/native/libjdwp/util.c:1808) commonRef_refToID (/tmp/jdk11u-dev/./src/jdk.jdwp.agent/share/native/libjdwp/commonRef.c:428) outStream_writeObjectRef.part.2 (/tmp/jdk11u-dev/./src/jdk.jdwp.agent/share/native/libjdwp/outStream.c:219) outStream_writeValue (/tmp/jdk11u-dev/./src/jdk.jdwp.agent/share/native/libjdwp/outStream.c:344) invoker_completeInvokeRequest (/tmp/jdk11u-dev/./src/jdk.jdwp.agent/share/native/libjdwp/invoker.c:839) commandLoop (/tmp/jdk11u-dev/./src/jdk.jdwp.agent/share/native/libjdwp/eventHelper.c:713) JvmtiAgentThread::start_function_wrapper (/tmp/jdk11u-dev/./src/hotspot/share/prims/jvmtiImpl.cpp:80) JavaThread::thread_main_inner (/tmp/jdk11u-dev/./src/hotspot/share/runtime/thread.cpp:1869) Thread::call_run (/tmp/jdk11u-dev/./src/hotspot/share/runtime/thread.cpp:387) thread_native_entry (/tmp/jdk11u-dev/./src/hotspot/os/linux/os_linux.cpp:799) start_thread (/usr/src/debug/glibc-2.17-c758a686/nptl/pthread_create.c:307) ?? (/usr/src/debugglibc-2.17-c758a686/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:111)
Re: RFR: 8282241: Invalid generic signature for redefined classes
On Thu, 3 Mar 2022 15:07:05 GMT, Alex Menkov wrote: > JDK-8238048 (fixed in jdk15) moved major_version, minor_version, > generic_signature_index and source_file_name_index from InstanceKlass to > ConstantPool. > We still have some incorrect code in CP merge during class redefinition. > > rewrite_cp_refs(scratch_class) updates generic_signature_index and > source_file_name_index in the scratch_cp, so we need to copy the attributes > (merge_cp->copy_fields(scratch_cp())) after rewrite_cp_refs. > > In redefine_single_class we don't need to copy source_file_name_index because > it's a CP property and we swap CPs. So this copying actually sets the value > from old class. > > tested: > - test/jdk/java/lang/instrument > - test/hotspot/jtreg/serviceability/jvmti/RedefineClasses > - test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses > - test/hotspot/jtreg/vmTestbase/nsk/jvmti/RetransformClasses Thank you for fixing this. It took me a while to figure this out again and it looks correct. Can you use the new redefine class test framework for the test instead? test/jdk/java/lang/instrument/RetransformGenericSignatureTest.java line 1: > 1: /* Can you write this test in the framework where the newer RedefineClasses test are in test/hotspot/jtreg/serviceability/jvmti/RedefineClasses ? You can just write the new class as a string that the inMemory compiler compiles for you. It's a lot simpler and doesn't use a shell script at all. - Changes requested by coleenp (Reviewer). PR: https://git.openjdk.java.net/jdk/pull/7676
Re: RFR: 8275775: Add jcmd VM.classes to print details of all classes [v6]
On Fri, 11 Feb 2022 06:49:25 GMT, David Holmes wrote: >> src/hotspot/share/oops/instanceKlass.cpp line 2081: >> >>> 2079: _st->print(INTPTR_FORMAT " ", p2i(k)); >>> 2080: // klass size >>> 2081: _st->print("%-4d ", k->size()); >> >> Should be `%4d` so that the numbers are aligned correctly. > > This issue seem still outstanding. Current: $./jcmd 83908 VM.classes|head -10 83908: KlassAddr Size State FlagsClassName 0x000800df8400 62fully_initialized W java.lang.invoke.LambdaForm$DMH/0x000800df8400 0x000800df8000 62fully_initialized W java.lang.invoke.LambdaForm$DMH/0x000800df8000 0x000800de4400 62fully_initialized W java.lang.invoke.LambdaForm$DMH/0x000800de4400 0x000800de4000 62fully_initialized W java.lang.invoke.LambdaForm$DMH/0x000800de4000 0x000800dc8800 62fully_initialized W java.lang.invoke.LambdaForm$DMH/0x000800dc8800 0x000800dc8400 62fully_initialized W java.lang.invoke.LambdaForm$DMH/0x000800dc8400 0x000800dc8000 62fully_initialized W java.lang.invoke.LambdaForm$DMH/0x000800dc8000 0x000800db9800 62fully_initialized W java.lang.invoke.LambdaForm$DMH/0x000800db9800 After using "%4d": $./jcmd 75481 VM.classes|head 75481: KlassAddr Size State FlagsClassName 0x000800df840062 fully_initialized W java.lang.invoke.LambdaForm$DMH/0x000800df8400 0x000800df800062 fully_initialized W java.lang.invoke.LambdaForm$DMH/0x000800df8000 0x000800de440062 fully_initialized W java.lang.invoke.LambdaForm$DMH/0x000800de4400 0x000800de400062 fully_initialized W java.lang.invoke.LambdaForm$DMH/0x000800de4000 So we do not need to change this. - PR: https://git.openjdk.java.net/jdk/pull/7105
Re: RFR: 8275775: Add jcmd VM.classes to print details of all classes [v7]
> Add VM.classes to print details of all classes, output looks like: > > 1. jcmd VM.classes > > KlassAddr Size State Flags LoaderName ClassName > 0x000800c0b400 62 inited W bootstrap > java.lang.invoke.LambdaForm$MH/0x000800c0b400 > 0x000800c0b000 62 inited W bootstrap > java.lang.invoke.LambdaForm$DMH/0x000800c0b000 > 0x000800c0ac00 62 inited W bootstrap > java.lang.invoke.LambdaForm$MH/0x000800c0ac00 > ... > > 2. jcmd VM.classes verbose > > KlassAddr Size State Flags LoaderName ClassName > 0x000800c0b400 62 inited W bootstrap > java.lang.invoke.LambdaForm$MH/0x000800c0b400 > java.lang.invoke.LambdaForm$MH/0x000800c0b400 {0x000800c0b400} > - instance size: 2 > - klass size: 62 > - access: final synchronized > - state: inited > - name: 'java/lang/invoke/LambdaForm$MH+0x000800c0b400' > - super: 'java/lang/Object' > - sub: > - arrays: NULL > - methods: Array(0x7f620841f210) > - method ordering: Array(0x000800a7e5a8) > - default_methods: Array(0x) > - local interfaces: Array(0x0008005af748) > - trans. interfaces: Array(0x0008005af748) > - constants: constant pool [41] {0x7f620841f030} for > 'java/lang/invoke/LambdaForm$MH+0x000800c0b400' cache=0x7f620841f380 > - class loader data: loader data: 0x7f61c804a690 of 'bootstrap' has a > class holder > - source file: 'LambdaForm$MH' > - class annotations: Array(0x) > - class type annotations: Array(0x) > - field annotations: Array(0x) > - field type annotations: Array(0x) > - inner classes: Array(0x0008005af6d8) > - nest members: Array(0x0008005af6d8) > - permitted subclasses: Array(0x0008005af6d8) > - java mirror: a 'java/lang/Class'{0x00011f4b3968} = > 'java/lang/invoke/LambdaForm$MH+0x000800c0b400' > - vtable length 5 (start addr: 0x000800c0b5b8) > - itable length 2 (start addr: 0x000800c0b5e0) > - static fields (1 words): > - static final '_D_0' 'Ljava/lang/invoke/LambdaForm;' @112 > - non-static fields (0 words): > - non-static oop maps: > 0x000800c0b000 62 inited W bootstrap > java.lang.invoke.LambdaForm$DMH/0x000800c0b000 > java.lang.invoke.LambdaForm$DMH/0x000800c0b000 {0x000800c0b000} > - instance size: 2 > - klass size: 62 > - access: final synchronized > - state: inited > - name: 'java/lang/invoke/LambdaForm$DMH+0x000800c0b000' > - super: 'java/lang/Object' > - sub: > - arrays: NULL > - methods: Array(0x7f620841ea68) > - method ordering: Array(0x000800a7e5a8) > - default_methods: Array(0x) > - local interfaces: Array(0x0008005af748) > - trans. interfaces: Array(0x0008005af748) > - constants: constant pool [49] {0x7f620841e838} for > 'java/lang/invoke/LambdaForm$DMH+0x000800c0b000' cache=0x7f620841ebe0 > - class loader data: loader data: 0x7f61c804a750 of 'bootstrap' has a > class holder > - source file: 'LambdaForm$DMH' > - class annotations: Array(0x) > - class type annotations: Array(0x) > - field annotations: Array(0x) > - field type annotations: Array(0x) > - inner classes: Array(0x0008005af6d8) > - nest members: Array(0x0008005af6d8) > - permitted subclasses: Array(0x0008005af6d8) > - java mirror: a 'java/lang/Class'{0x00011f4b0968} = > 'java/lang/invoke/LambdaForm$DMH+0x000800c0b000' > - vtable length 5 (start addr: 0x000800c0b1b8) > - itable length 2 (start addr: 0x000800c0b1e0) > - static fields (1 words): > - static final '_D_0' 'Ljava/lang/invoke/LambdaForm;' @112 > - non-static fields (0 words): > ... Yi Yang has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains eight commits: - Merge branch 'master' into jcmd_classes - typo - fix - fix test - -verbose and help doc - -verbose - review - 8275775 Add VM.classes to print details of all classes - Changes: https://git.openjdk.java.net/jdk/pull/7105/files Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=7105&range=06 Stats: 172 lines in 6 files changed: 171 ins; 0 del; 1 mod Patch: https://git.openjdk.java.net/jdk/pull/7105.diff Fetch: git fetch https://git.openjdk.java.net/jdk pull/7105/head:pull/7105 PR: https://git.openjdk.java.net/jdk/pull/7105
Re: RFR: 8275775: Add jcmd VM.classes to print details of all classes [v7]
On Fri, 4 Mar 2022 03:07:26 GMT, Yi Yang wrote: >> Add VM.classes to print details of all classes, output looks like: >> >> 1. jcmd VM.classes >> >> KlassAddr Size State Flags LoaderName ClassName >> 0x000800c0b400 62 inited W bootstrap >> java.lang.invoke.LambdaForm$MH/0x000800c0b400 >> 0x000800c0b000 62 inited W bootstrap >> java.lang.invoke.LambdaForm$DMH/0x000800c0b000 >> 0x000800c0ac00 62 inited W bootstrap >> java.lang.invoke.LambdaForm$MH/0x000800c0ac00 >> ... >> >> 2. jcmd VM.classes verbose >> >> KlassAddr Size State Flags LoaderName ClassName >> 0x000800c0b400 62 inited W bootstrap >> java.lang.invoke.LambdaForm$MH/0x000800c0b400 >> java.lang.invoke.LambdaForm$MH/0x000800c0b400 {0x000800c0b400} >> - instance size: 2 >> - klass size: 62 >> - access: final synchronized >> - state: inited >> - name: 'java/lang/invoke/LambdaForm$MH+0x000800c0b400' >> - super: 'java/lang/Object' >> - sub: >> - arrays: NULL >> - methods: Array(0x7f620841f210) >> - method ordering: Array(0x000800a7e5a8) >> - default_methods: Array(0x) >> - local interfaces: Array(0x0008005af748) >> - trans. interfaces: Array(0x0008005af748) >> - constants: constant pool [41] {0x7f620841f030} for >> 'java/lang/invoke/LambdaForm$MH+0x000800c0b400' cache=0x7f620841f380 >> - class loader data: loader data: 0x7f61c804a690 of 'bootstrap' has a >> class holder >> - source file: 'LambdaForm$MH' >> - class annotations: Array(0x) >> - class type annotations: Array(0x) >> - field annotations: Array(0x) >> - field type annotations: Array(0x) >> - inner classes: Array(0x0008005af6d8) >> - nest members: Array(0x0008005af6d8) >> - permitted subclasses: Array(0x0008005af6d8) >> - java mirror: a 'java/lang/Class'{0x00011f4b3968} = >> 'java/lang/invoke/LambdaForm$MH+0x000800c0b400' >> - vtable length 5 (start addr: 0x000800c0b5b8) >> - itable length 2 (start addr: 0x000800c0b5e0) >> - static fields (1 words): >> - static final '_D_0' 'Ljava/lang/invoke/LambdaForm;' @112 >> - non-static fields (0 words): >> - non-static oop maps: >> 0x000800c0b000 62 inited W bootstrap >> java.lang.invoke.LambdaForm$DMH/0x000800c0b000 >> java.lang.invoke.LambdaForm$DMH/0x000800c0b000 {0x000800c0b000} >> - instance size: 2 >> - klass size: 62 >> - access: final synchronized >> - state: inited >> - name: 'java/lang/invoke/LambdaForm$DMH+0x000800c0b000' >> - super: 'java/lang/Object' >> - sub: >> - arrays: NULL >> - methods: Array(0x7f620841ea68) >> - method ordering: Array(0x000800a7e5a8) >> - default_methods: Array(0x) >> - local interfaces: Array(0x0008005af748) >> - trans. interfaces: Array(0x0008005af748) >> - constants: constant pool [49] {0x7f620841e838} for >> 'java/lang/invoke/LambdaForm$DMH+0x000800c0b000' cache=0x7f620841ebe0 >> - class loader data: loader data: 0x7f61c804a750 of 'bootstrap' has a >> class holder >> - source file: 'LambdaForm$DMH' >> - class annotations: Array(0x) >> - class type annotations: Array(0x) >> - field annotations: Array(0x) >> - field type annotations: Array(0x) >> - inner classes: Array(0x0008005af6d8) >> - nest members: Array(0x0008005af6d8) >> - permitted subclasses: Array(0x0008005af6d8) >> - java mirror: a 'java/lang/Class'{0x00011f4b0968} = >> 'java/lang/invoke/LambdaForm$DMH+0x000800c0b000' >> - vtable length 5 (start addr: 0x000800c0b1b8) >> - itable length 2 (start addr: 0x000800c0b1e0) >> - static fields (1 words): >> - static final '_D_0' 'Ljava/lang/invoke/LambdaForm;' @112 >> - non-static fields (0 words): >> ... > > Yi Yang has updated the pull request with a new target base due to a merge or > a rebase. The pull request now contains eight commits: > > - Merge branch 'master' into jcmd_classes > - typo > - fix > - fix test > - -verbose and help doc > - -verbose > - review > - 8275775 Add VM.classes to print details of all classes Changes requested by dholmes (Reviewer). src/hotspot/share/services/diagnosticCommand.cpp line 964: > 962:"Dump the detailed content of a Java class. " > 963:"Some classes are annotated with flags: " > 964:"F = has finialize method, " This is still spelt incorrectly: finalize - PR: https://git.openjdk.java.net/jdk/pull/7105
Re: RFR: 8275775: Add jcmd VM.classes to print details of all classes [v8]
> Add VM.classes to print details of all classes, output looks like: > > 1. jcmd VM.classes > > KlassAddr Size State Flags LoaderName ClassName > 0x000800c0b400 62 inited W bootstrap > java.lang.invoke.LambdaForm$MH/0x000800c0b400 > 0x000800c0b000 62 inited W bootstrap > java.lang.invoke.LambdaForm$DMH/0x000800c0b000 > 0x000800c0ac00 62 inited W bootstrap > java.lang.invoke.LambdaForm$MH/0x000800c0ac00 > ... > > 2. jcmd VM.classes verbose > > KlassAddr Size State Flags LoaderName ClassName > 0x000800c0b400 62 inited W bootstrap > java.lang.invoke.LambdaForm$MH/0x000800c0b400 > java.lang.invoke.LambdaForm$MH/0x000800c0b400 {0x000800c0b400} > - instance size: 2 > - klass size: 62 > - access: final synchronized > - state: inited > - name: 'java/lang/invoke/LambdaForm$MH+0x000800c0b400' > - super: 'java/lang/Object' > - sub: > - arrays: NULL > - methods: Array(0x7f620841f210) > - method ordering: Array(0x000800a7e5a8) > - default_methods: Array(0x) > - local interfaces: Array(0x0008005af748) > - trans. interfaces: Array(0x0008005af748) > - constants: constant pool [41] {0x7f620841f030} for > 'java/lang/invoke/LambdaForm$MH+0x000800c0b400' cache=0x7f620841f380 > - class loader data: loader data: 0x7f61c804a690 of 'bootstrap' has a > class holder > - source file: 'LambdaForm$MH' > - class annotations: Array(0x) > - class type annotations: Array(0x) > - field annotations: Array(0x) > - field type annotations: Array(0x) > - inner classes: Array(0x0008005af6d8) > - nest members: Array(0x0008005af6d8) > - permitted subclasses: Array(0x0008005af6d8) > - java mirror: a 'java/lang/Class'{0x00011f4b3968} = > 'java/lang/invoke/LambdaForm$MH+0x000800c0b400' > - vtable length 5 (start addr: 0x000800c0b5b8) > - itable length 2 (start addr: 0x000800c0b5e0) > - static fields (1 words): > - static final '_D_0' 'Ljava/lang/invoke/LambdaForm;' @112 > - non-static fields (0 words): > - non-static oop maps: > 0x000800c0b000 62 inited W bootstrap > java.lang.invoke.LambdaForm$DMH/0x000800c0b000 > java.lang.invoke.LambdaForm$DMH/0x000800c0b000 {0x000800c0b000} > - instance size: 2 > - klass size: 62 > - access: final synchronized > - state: inited > - name: 'java/lang/invoke/LambdaForm$DMH+0x000800c0b000' > - super: 'java/lang/Object' > - sub: > - arrays: NULL > - methods: Array(0x7f620841ea68) > - method ordering: Array(0x000800a7e5a8) > - default_methods: Array(0x) > - local interfaces: Array(0x0008005af748) > - trans. interfaces: Array(0x0008005af748) > - constants: constant pool [49] {0x7f620841e838} for > 'java/lang/invoke/LambdaForm$DMH+0x000800c0b000' cache=0x7f620841ebe0 > - class loader data: loader data: 0x7f61c804a750 of 'bootstrap' has a > class holder > - source file: 'LambdaForm$DMH' > - class annotations: Array(0x) > - class type annotations: Array(0x) > - field annotations: Array(0x) > - field type annotations: Array(0x) > - inner classes: Array(0x0008005af6d8) > - nest members: Array(0x0008005af6d8) > - permitted subclasses: Array(0x0008005af6d8) > - java mirror: a 'java/lang/Class'{0x00011f4b0968} = > 'java/lang/invoke/LambdaForm$DMH+0x000800c0b000' > - vtable length 5 (start addr: 0x000800c0b1b8) > - itable length 2 (start addr: 0x000800c0b1e0) > - static fields (1 words): > - static final '_D_0' 'Ljava/lang/invoke/LambdaForm;' @112 > - non-static fields (0 words): > ... Yi Yang has updated the pull request incrementally with one additional commit since the last revision: typo - Changes: - all: https://git.openjdk.java.net/jdk/pull/7105/files - new: https://git.openjdk.java.net/jdk/pull/7105/files/aab2c333..26b4d124 Webrevs: - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=7105&range=07 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=7105&range=06-07 Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod Patch: https://git.openjdk.java.net/jdk/pull/7105.diff Fetch: git fetch https://git.openjdk.java.net/jdk pull/7105/head:pull/7105 PR: https://git.openjdk.java.net/jdk/pull/7105
Re: RFR: 8275775: Add jcmd VM.classes to print details of all classes [v7]
On Fri, 4 Mar 2022 03:29:51 GMT, David Holmes wrote: >> Yi Yang has updated the pull request with a new target base due to a merge >> or a rebase. The pull request now contains eight commits: >> >> - Merge branch 'master' into jcmd_classes >> - typo >> - fix >> - fix test >> - -verbose and help doc >> - -verbose >> - review >> - 8275775 Add VM.classes to print details of all classes > > src/hotspot/share/services/diagnosticCommand.cpp line 964: > >> 962:"Dump the detailed content of a Java class. " >> 963:"Some classes are annotated with flags: " >> 964:"F = has finialize method, " > > This is still spelt incorrectly: finalize Sorry... changed. - PR: https://git.openjdk.java.net/jdk/pull/7105
Re: RFR: 8275775: Add jcmd VM.classes to print details of all classes [v6]
On Fri, 11 Feb 2022 06:53:23 GMT, David Holmes wrote: >> Yi Yang has updated the pull request incrementally with one additional >> commit since the last revision: >> >> fix > > src/hotspot/share/services/diagnosticCommand.cpp line 964: > >> 962:"Dump the detail content of Java class. " >> 963:"Some classes are annotated with flags: " >> 964:"F = has finializer method, " > > typo finializer - but should be finalize > > Is this actually only present for "non-trivial finalize" method? I'm not sure what's the meaning of "non-trivial finalize" method, can you elaborate more for it? (P.S. All comments are addressed) - PR: https://git.openjdk.java.net/jdk/pull/7105
Re: RFR: 8275775: Add jcmd VM.classes to print details of all classes [v2]
On Wed, 19 Jan 2022 02:50:16 GMT, Chris Plummer wrote: >>> It seems it would be useful to support the verbose output with just a >>> single class that is specified, although that would suggest that the dcmd >>> name should then be something other than `VM.classes`. >> >> This is a good idea, but `jcmd VM.classes verbose=XX` looks strange, `jcmd >> VM.class XX` is also not much proper, because we desire to print all classes >> in default(`jcmd VM.class`). an alternative is to use `jcmd VM.classes >> verbose | grep XX` currently. > >> > It seems it would be useful to support the verbose output with just a >> > single class that is specified, although that would suggest that the dcmd >> > name should then be something other than `VM.classes`. >> >> This is a good idea, but `jcmd VM.classes verbose=XX` looks strange, `jcmd >> VM.class XX` is also not much proper, because we desire to print all classes >> in default(`jcmd VM.class`). an alternative is to use `jcmd VM.classes >> verbose | grep XX` currently. > > I was thinking the syntax would look like: `jcmd VM.classes [verbose > [classname]]` > > Your grep solution doesn't work because each class has multiple lines of > output. @plummercj Can you please help review this from the serviceability point of view? Thanks in advance! - PR: https://git.openjdk.java.net/jdk/pull/7105
Re: RFR: 8275775: Add jcmd VM.classes to print details of all classes [v9]
> Add VM.classes to print details of all classes, output looks like: > > 1. jcmd VM.classes > > KlassAddr Size State Flags LoaderName ClassName > 0x000800c0b400 62 inited W bootstrap > java.lang.invoke.LambdaForm$MH/0x000800c0b400 > 0x000800c0b000 62 inited W bootstrap > java.lang.invoke.LambdaForm$DMH/0x000800c0b000 > 0x000800c0ac00 62 inited W bootstrap > java.lang.invoke.LambdaForm$MH/0x000800c0ac00 > ... > > 2. jcmd VM.classes verbose > > KlassAddr Size State Flags LoaderName ClassName > 0x000800c0b400 62 inited W bootstrap > java.lang.invoke.LambdaForm$MH/0x000800c0b400 > java.lang.invoke.LambdaForm$MH/0x000800c0b400 {0x000800c0b400} > - instance size: 2 > - klass size: 62 > - access: final synchronized > - state: inited > - name: 'java/lang/invoke/LambdaForm$MH+0x000800c0b400' > - super: 'java/lang/Object' > - sub: > - arrays: NULL > - methods: Array(0x7f620841f210) > - method ordering: Array(0x000800a7e5a8) > - default_methods: Array(0x) > - local interfaces: Array(0x0008005af748) > - trans. interfaces: Array(0x0008005af748) > - constants: constant pool [41] {0x7f620841f030} for > 'java/lang/invoke/LambdaForm$MH+0x000800c0b400' cache=0x7f620841f380 > - class loader data: loader data: 0x7f61c804a690 of 'bootstrap' has a > class holder > - source file: 'LambdaForm$MH' > - class annotations: Array(0x) > - class type annotations: Array(0x) > - field annotations: Array(0x) > - field type annotations: Array(0x) > - inner classes: Array(0x0008005af6d8) > - nest members: Array(0x0008005af6d8) > - permitted subclasses: Array(0x0008005af6d8) > - java mirror: a 'java/lang/Class'{0x00011f4b3968} = > 'java/lang/invoke/LambdaForm$MH+0x000800c0b400' > - vtable length 5 (start addr: 0x000800c0b5b8) > - itable length 2 (start addr: 0x000800c0b5e0) > - static fields (1 words): > - static final '_D_0' 'Ljava/lang/invoke/LambdaForm;' @112 > - non-static fields (0 words): > - non-static oop maps: > 0x000800c0b000 62 inited W bootstrap > java.lang.invoke.LambdaForm$DMH/0x000800c0b000 > java.lang.invoke.LambdaForm$DMH/0x000800c0b000 {0x000800c0b000} > - instance size: 2 > - klass size: 62 > - access: final synchronized > - state: inited > - name: 'java/lang/invoke/LambdaForm$DMH+0x000800c0b000' > - super: 'java/lang/Object' > - sub: > - arrays: NULL > - methods: Array(0x7f620841ea68) > - method ordering: Array(0x000800a7e5a8) > - default_methods: Array(0x) > - local interfaces: Array(0x0008005af748) > - trans. interfaces: Array(0x0008005af748) > - constants: constant pool [49] {0x7f620841e838} for > 'java/lang/invoke/LambdaForm$DMH+0x000800c0b000' cache=0x7f620841ebe0 > - class loader data: loader data: 0x7f61c804a750 of 'bootstrap' has a > class holder > - source file: 'LambdaForm$DMH' > - class annotations: Array(0x) > - class type annotations: Array(0x) > - field annotations: Array(0x) > - field type annotations: Array(0x) > - inner classes: Array(0x0008005af6d8) > - nest members: Array(0x0008005af6d8) > - permitted subclasses: Array(0x0008005af6d8) > - java mirror: a 'java/lang/Class'{0x00011f4b0968} = > 'java/lang/invoke/LambdaForm$DMH+0x000800c0b000' > - vtable length 5 (start addr: 0x000800c0b1b8) > - itable length 2 (start addr: 0x000800c0b1e0) > - static fields (1 words): > - static final '_D_0' 'Ljava/lang/invoke/LambdaForm;' @112 > - non-static fields (0 words): > ... Yi Yang has updated the pull request incrementally with one additional commit since the last revision: finalize desc change - Changes: - all: https://git.openjdk.java.net/jdk/pull/7105/files - new: https://git.openjdk.java.net/jdk/pull/7105/files/26b4d124..ba399fb5 Webrevs: - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=7105&range=08 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=7105&range=07-08 Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod Patch: https://git.openjdk.java.net/jdk/pull/7105.diff Fetch: git fetch https://git.openjdk.java.net/jdk pull/7105/head:pull/7105 PR: https://git.openjdk.java.net/jdk/pull/7105
Re: RFR: 8275775: Add jcmd VM.classes to print details of all classes [v6]
On Fri, 4 Mar 2022 03:43:59 GMT, David Holmes wrote: >> I'm not sure what's the meaning of "non-trivial finalize" method, can you >> elaborate more for it? >> (P.S. All comments are addressed) > > I mean a finalize() method that actually does something. I checked the code > and you will print F is the current class has a non-empty finalize() method, > or it has a superclass with a non-empty finalize method. I would suggest > updating the text to: > > `F = has, or inherits, a non-empty finalize method` > > Thanks, > David Done. This description is more clear compared to non-trivial finalize. - PR: https://git.openjdk.java.net/jdk/pull/7105
Re: RFR: 8275775: Add jcmd VM.classes to print details of all classes [v6]
On Fri, 4 Mar 2022 03:03:10 GMT, Yi Yang wrote: >> src/hotspot/share/services/diagnosticCommand.cpp line 964: >> >>> 962:"Dump the detail content of Java class. " >>> 963:"Some classes are annotated with flags: " >>> 964:"F = has finializer method, " >> >> typo finializer - but should be finalize >> >> Is this actually only present for "non-trivial finalize" method? > > I'm not sure what's the meaning of "non-trivial finalize" method, can you > elaborate more for it? > (P.S. All comments are addressed) I mean a finalize() method that actually does something. I checked the code and you will print F is the current class has a non-empty finalize() method, or it has a superclass with a non-empty finalize method. I would suggest updating the text to: `F = has, or inherits, a non-empty finalize method` Thanks, David - PR: https://git.openjdk.java.net/jdk/pull/7105
Re: RFR: 8275775: Add jcmd VM.classes to print details of all classes [v9]
On Fri, 4 Mar 2022 03:53:52 GMT, Yi Yang wrote: >> Add VM.classes to print details of all classes, output looks like: >> >> 1. jcmd VM.classes >> >> KlassAddr Size State Flags LoaderName ClassName >> 0x000800c0b400 62 inited W bootstrap >> java.lang.invoke.LambdaForm$MH/0x000800c0b400 >> 0x000800c0b000 62 inited W bootstrap >> java.lang.invoke.LambdaForm$DMH/0x000800c0b000 >> 0x000800c0ac00 62 inited W bootstrap >> java.lang.invoke.LambdaForm$MH/0x000800c0ac00 >> ... >> >> 2. jcmd VM.classes verbose >> >> KlassAddr Size State Flags LoaderName ClassName >> 0x000800c0b400 62 inited W bootstrap >> java.lang.invoke.LambdaForm$MH/0x000800c0b400 >> java.lang.invoke.LambdaForm$MH/0x000800c0b400 {0x000800c0b400} >> - instance size: 2 >> - klass size: 62 >> - access: final synchronized >> - state: inited >> - name: 'java/lang/invoke/LambdaForm$MH+0x000800c0b400' >> - super: 'java/lang/Object' >> - sub: >> - arrays: NULL >> - methods: Array(0x7f620841f210) >> - method ordering: Array(0x000800a7e5a8) >> - default_methods: Array(0x) >> - local interfaces: Array(0x0008005af748) >> - trans. interfaces: Array(0x0008005af748) >> - constants: constant pool [41] {0x7f620841f030} for >> 'java/lang/invoke/LambdaForm$MH+0x000800c0b400' cache=0x7f620841f380 >> - class loader data: loader data: 0x7f61c804a690 of 'bootstrap' has a >> class holder >> - source file: 'LambdaForm$MH' >> - class annotations: Array(0x) >> - class type annotations: Array(0x) >> - field annotations: Array(0x) >> - field type annotations: Array(0x) >> - inner classes: Array(0x0008005af6d8) >> - nest members: Array(0x0008005af6d8) >> - permitted subclasses: Array(0x0008005af6d8) >> - java mirror: a 'java/lang/Class'{0x00011f4b3968} = >> 'java/lang/invoke/LambdaForm$MH+0x000800c0b400' >> - vtable length 5 (start addr: 0x000800c0b5b8) >> - itable length 2 (start addr: 0x000800c0b5e0) >> - static fields (1 words): >> - static final '_D_0' 'Ljava/lang/invoke/LambdaForm;' @112 >> - non-static fields (0 words): >> - non-static oop maps: >> 0x000800c0b000 62 inited W bootstrap >> java.lang.invoke.LambdaForm$DMH/0x000800c0b000 >> java.lang.invoke.LambdaForm$DMH/0x000800c0b000 {0x000800c0b000} >> - instance size: 2 >> - klass size: 62 >> - access: final synchronized >> - state: inited >> - name: 'java/lang/invoke/LambdaForm$DMH+0x000800c0b000' >> - super: 'java/lang/Object' >> - sub: >> - arrays: NULL >> - methods: Array(0x7f620841ea68) >> - method ordering: Array(0x000800a7e5a8) >> - default_methods: Array(0x) >> - local interfaces: Array(0x0008005af748) >> - trans. interfaces: Array(0x0008005af748) >> - constants: constant pool [49] {0x7f620841e838} for >> 'java/lang/invoke/LambdaForm$DMH+0x000800c0b000' cache=0x7f620841ebe0 >> - class loader data: loader data: 0x7f61c804a750 of 'bootstrap' has a >> class holder >> - source file: 'LambdaForm$DMH' >> - class annotations: Array(0x) >> - class type annotations: Array(0x) >> - field annotations: Array(0x) >> - field type annotations: Array(0x) >> - inner classes: Array(0x0008005af6d8) >> - nest members: Array(0x0008005af6d8) >> - permitted subclasses: Array(0x0008005af6d8) >> - java mirror: a 'java/lang/Class'{0x00011f4b0968} = >> 'java/lang/invoke/LambdaForm$DMH+0x000800c0b000' >> - vtable length 5 (start addr: 0x000800c0b1b8) >> - itable length 2 (start addr: 0x000800c0b1e0) >> - static fields (1 words): >> - static final '_D_0' 'Ljava/lang/invoke/LambdaForm;' @112 >> - non-static fields (0 words): >> ... > > Yi Yang has updated the pull request incrementally with one additional commit > since the last revision: > > finalize desc change Marked as reviewed by dholmes (Reviewer). - PR: https://git.openjdk.java.net/jdk/pull/7105
Re: RFR: 8275775: Add jcmd VM.classes to print details of all classes [v6]
On Fri, 4 Mar 2022 02:47:28 GMT, Yi Yang wrote: >> This issue seem still outstanding. > > Current: > > $./jcmd 83908 VM.classes|head -10 > 83908: > KlassAddr Size State FlagsClassName > 0x000800df8400 62fully_initialized W > java.lang.invoke.LambdaForm$DMH/0x000800df8400 > 0x000800df8000 62fully_initialized W > java.lang.invoke.LambdaForm$DMH/0x000800df8000 > 0x000800de4400 62fully_initialized W > java.lang.invoke.LambdaForm$DMH/0x000800de4400 > 0x000800de4000 62fully_initialized W > java.lang.invoke.LambdaForm$DMH/0x000800de4000 > 0x000800dc8800 62fully_initialized W > java.lang.invoke.LambdaForm$DMH/0x000800dc8800 > 0x000800dc8400 62fully_initialized W > java.lang.invoke.LambdaForm$DMH/0x000800dc8400 > 0x000800dc8000 62fully_initialized W > java.lang.invoke.LambdaForm$DMH/0x000800dc8000 > 0x000800db9800 62fully_initialized W > java.lang.invoke.LambdaForm$DMH/0x000800db9800 > > After using "%4d": > > $./jcmd 75481 VM.classes|head > 75481: > KlassAddr Size State FlagsClassName > 0x000800df840062 fully_initialized W > java.lang.invoke.LambdaForm$DMH/0x000800df8400 > 0x000800df800062 fully_initialized W > java.lang.invoke.LambdaForm$DMH/0x000800df8000 > 0x000800de440062 fully_initialized W > java.lang.invoke.LambdaForm$DMH/0x000800de4400 > 0x000800de400062 fully_initialized W > java.lang.invoke.LambdaForm$DMH/0x000800de4000 > > So we do not need to change this. You should change it to `%4d`. Otherwise, when the numbers are changed in the future (e.g., to 3 or 4 digits) they will be misaligned: KlassAddr Size State FlagsClassName 0x000800df8400 62fully_initialized W java.lang.invoke.LambdaForm$DMH/0x000800df8400 0x000800df8000 123 fully_initialized W java.lang.invoke.LambdaForm$DMH/0x000800df8000 0x000800de4400 4567 fully_initialized W java.lang.invoke.LambdaForm$DMH/0x000800de4400 - PR: https://git.openjdk.java.net/jdk/pull/7105
RFR: 8282641: Make jdb "threadgroup" command with no args reset the current threadgroup back to the default
jdb has a probably very little used command called "threadgroup" which is used to set the current TheadGroup. The only purpose of the current ThreadGroup is as the default ThreadGroup to use for the "threads" command when no ThreadGroup argument is passed to it. "threads" prints out every thread in the ThreadGroup specified as the first argument. If none is specified, it uses the current ThreadGroup. If the current ThreadGroup has not yet been specified, it automatically gets set to the top level ThreadGroup. Once the current ThreadGroup has been set by using the threadgroup command, it's not that obvious how to reset it back to the default. It turns out the way to do this to set it to the "system" ThreadGroup, which is the top level ThreadGroup (and therefore the initial current ThreadGroup). With this enhancement I've made it so if you use the "threadgroup" command with no argument, it resets the current ThreadGroup back to the top level ThreadGroup ("system"). Previously with no argument it produces an error for not specifying the ThreadGroup argument. - Commit messages: - threadgroup with no args resets the current threadgroup back to the default. Changes: https://git.openjdk.java.net/jdk/pull/7687/files Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=7687&range=00 Issue: https://bugs.openjdk.java.net/browse/JDK-8282641 Stats: 29 lines in 5 files changed: 14 ins; 3 del; 12 mod Patch: https://git.openjdk.java.net/jdk/pull/7687.diff Fetch: git fetch https://git.openjdk.java.net/jdk pull/7687/head:pull/7687 PR: https://git.openjdk.java.net/jdk/pull/7687
Re: RFR: 8275775: Add jcmd VM.classes to print details of all classes [v9]
On Fri, 4 Mar 2022 03:53:52 GMT, Yi Yang wrote: >> Add VM.classes to print details of all classes, output looks like: >> >> 1. jcmd VM.classes >> >> KlassAddr Size State Flags LoaderName ClassName >> 0x000800c0b400 62 inited W bootstrap >> java.lang.invoke.LambdaForm$MH/0x000800c0b400 >> 0x000800c0b000 62 inited W bootstrap >> java.lang.invoke.LambdaForm$DMH/0x000800c0b000 >> 0x000800c0ac00 62 inited W bootstrap >> java.lang.invoke.LambdaForm$MH/0x000800c0ac00 >> ... >> >> 2. jcmd VM.classes verbose >> >> KlassAddr Size State Flags LoaderName ClassName >> 0x000800c0b400 62 inited W bootstrap >> java.lang.invoke.LambdaForm$MH/0x000800c0b400 >> java.lang.invoke.LambdaForm$MH/0x000800c0b400 {0x000800c0b400} >> - instance size: 2 >> - klass size: 62 >> - access: final synchronized >> - state: inited >> - name: 'java/lang/invoke/LambdaForm$MH+0x000800c0b400' >> - super: 'java/lang/Object' >> - sub: >> - arrays: NULL >> - methods: Array(0x7f620841f210) >> - method ordering: Array(0x000800a7e5a8) >> - default_methods: Array(0x) >> - local interfaces: Array(0x0008005af748) >> - trans. interfaces: Array(0x0008005af748) >> - constants: constant pool [41] {0x7f620841f030} for >> 'java/lang/invoke/LambdaForm$MH+0x000800c0b400' cache=0x7f620841f380 >> - class loader data: loader data: 0x7f61c804a690 of 'bootstrap' has a >> class holder >> - source file: 'LambdaForm$MH' >> - class annotations: Array(0x) >> - class type annotations: Array(0x) >> - field annotations: Array(0x) >> - field type annotations: Array(0x) >> - inner classes: Array(0x0008005af6d8) >> - nest members: Array(0x0008005af6d8) >> - permitted subclasses: Array(0x0008005af6d8) >> - java mirror: a 'java/lang/Class'{0x00011f4b3968} = >> 'java/lang/invoke/LambdaForm$MH+0x000800c0b400' >> - vtable length 5 (start addr: 0x000800c0b5b8) >> - itable length 2 (start addr: 0x000800c0b5e0) >> - static fields (1 words): >> - static final '_D_0' 'Ljava/lang/invoke/LambdaForm;' @112 >> - non-static fields (0 words): >> - non-static oop maps: >> 0x000800c0b000 62 inited W bootstrap >> java.lang.invoke.LambdaForm$DMH/0x000800c0b000 >> java.lang.invoke.LambdaForm$DMH/0x000800c0b000 {0x000800c0b000} >> - instance size: 2 >> - klass size: 62 >> - access: final synchronized >> - state: inited >> - name: 'java/lang/invoke/LambdaForm$DMH+0x000800c0b000' >> - super: 'java/lang/Object' >> - sub: >> - arrays: NULL >> - methods: Array(0x7f620841ea68) >> - method ordering: Array(0x000800a7e5a8) >> - default_methods: Array(0x) >> - local interfaces: Array(0x0008005af748) >> - trans. interfaces: Array(0x0008005af748) >> - constants: constant pool [49] {0x7f620841e838} for >> 'java/lang/invoke/LambdaForm$DMH+0x000800c0b000' cache=0x7f620841ebe0 >> - class loader data: loader data: 0x7f61c804a750 of 'bootstrap' has a >> class holder >> - source file: 'LambdaForm$DMH' >> - class annotations: Array(0x) >> - class type annotations: Array(0x) >> - field annotations: Array(0x) >> - field type annotations: Array(0x) >> - inner classes: Array(0x0008005af6d8) >> - nest members: Array(0x0008005af6d8) >> - permitted subclasses: Array(0x0008005af6d8) >> - java mirror: a 'java/lang/Class'{0x00011f4b0968} = >> 'java/lang/invoke/LambdaForm$DMH+0x000800c0b000' >> - vtable length 5 (start addr: 0x000800c0b1b8) >> - itable length 2 (start addr: 0x000800c0b1e0) >> - static fields (1 words): >> - static final '_D_0' 'Ljava/lang/invoke/LambdaForm;' @112 >> - non-static fields (0 words): >> ... > > Yi Yang has updated the pull request incrementally with one additional commit > since the last revision: > > finalize desc change Sorry that I just chime in. It seems this change adds new command options, so it seems that `csr` is required? - PR: https://git.openjdk.java.net/jdk/pull/7105
Re: RFR: 8275775: Add jcmd VM.classes to print details of all classes [v9]
On Fri, 4 Mar 2022 07:12:03 GMT, Lin Zang wrote: > Sorry that I just chime in. It seems this change adds new command options, so > it seems that `csr` is required? Hi @linzang, according to [previous discussion](https://github.com/openjdk/jdk/pull/6075) and [comments in JBS](https://bugs.openjdk.java.net/browse/JDK-8275775), it's not necessary to create a csr for it. - PR: https://git.openjdk.java.net/jdk/pull/7105
Re: RFR: 8282641: Make jdb "threadgroup" command with no args reset the current threadgroup back to the default [v2]
> jdb has a probably very little used command called "threadgroup" which is > used to set the current TheadGroup. The only purpose of the current > ThreadGroup is as the default ThreadGroup to use for the "threads" command > when no ThreadGroup argument is passed to it. > > "threads" prints out every thread in the ThreadGroup specified as the first > argument. If none is specified, it uses the current ThreadGroup. If the > current ThreadGroup has not yet been specified, it automatically gets set to > the top level ThreadGroup. > > Once the current ThreadGroup has been set by using the threadgroup command, > it's not that obvious how to reset it back to the default. It turns out the > way to do this to set it to the "system" ThreadGroup, which is the top level > ThreadGroup (and therefore the initial current ThreadGroup). > > With this enhancement I've made it so if you use the "threadgroup" command > with no argument, it resets the current ThreadGroup back to the top level > ThreadGroup ("system"). Previously with no argument it produces an error for > not specifying the ThreadGroup argument. Chris Plummer has updated the pull request incrementally with two additional commits since the last revision: - Use THREADGROUP_NAME instead of "MyThreadGroup#" - fix minor typo in help text - Changes: - all: https://git.openjdk.java.net/jdk/pull/7687/files - new: https://git.openjdk.java.net/jdk/pull/7687/files/ad800de5..fb7ac63f Webrevs: - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=7687&range=01 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=7687&range=00-01 Stats: 2 lines in 2 files changed: 0 ins; 0 del; 2 mod Patch: https://git.openjdk.java.net/jdk/pull/7687.diff Fetch: git fetch https://git.openjdk.java.net/jdk pull/7687/head:pull/7687 PR: https://git.openjdk.java.net/jdk/pull/7687
Re: RFR: 8275775: Add jcmd VM.classes to print details of all classes [v9]
On Fri, 4 Mar 2022 07:20:14 GMT, Yi Yang wrote: > > Sorry that I just chime in. It seems this change adds new command options, > > so it seems that `csr` is required? > > Hi @linzang, according to [previous > discussion](https://github.com/openjdk/jdk/pull/6075) and [comments in > JBS](https://bugs.openjdk.java.net/browse/JDK-8275775), it's not necessary to > create a csr for it. Ah, I missed that. thanks for point it out! - PR: https://git.openjdk.java.net/jdk/pull/7105
Re: RFR: 8275775: Add jcmd VM.classes to print details of all classes [v6]
On Fri, 4 Mar 2022 05:13:58 GMT, Ioi Lam wrote: > You should change it to `%4d`. Otherwise, when the numbers are changed in the > future (e.g., to 3 or 4 digits) they will be misaligned: > > ``` > KlassAddr Size State FlagsClassName > 0x000800df8400 62fully_initialized W > java.lang.invoke.LambdaForm$DMH/0x000800df8400 > 0x000800df8000 123 fully_initialized W > java.lang.invoke.LambdaForm$DMH/0x000800df8000 > 0x000800de4400 4567 fully_initialized W > java.lang.invoke.LambdaForm$DMH/0x000800de4400 > ``` This format looks pretty good to me, they are all aligned to left. If you still think it's more proper to have a format like this: KlassAddr Size State FlagsClassName 0x000800df8400 62fully_initialized W java.lang.invoke.LambdaForm$DMH/0x000800df8400 0x000800df8000 123 fully_initialized W java.lang.invoke.LambdaForm$DMH/0x000800df8000 0x000800de4400 4567 fully_initialized W java.lang.invoke.LambdaForm$DMH/0x000800de4400 Then I'm glad to do so ;) - PR: https://git.openjdk.java.net/jdk/pull/7105