Errors when use "universe" command in CLHSDB

Staffan Larsen staffan.larsen at oracle.com
Fri Jan 18 04:13:55 PST 2013


This patch applied cleanly. 

I can sponsor this fix, but we still need a review from someone with Reviewer status. Once we have that, I can push the change.

Thanks,
/Staffan

On 18 jan 2013, at 11:22, ÔÆ´ï <yunda.mly at taobao.com> wrote:

> OK. I diffed it with the latest http://hg.openjdk.java.net/hsx/hotspot-rt/hotspot/ and I hope it works. Thanks for the review!
>  
>  
> Regards,
> Yunda
> ·¢¼þÈË: Staffan Larsen [mailto:staffan.larsen at oracle.com] 
> ·¢ËÍʱ¼ä: 2013Äê1ÔÂ18ÈÕ 17:07
> ÊÕ¼þÈË: ÔÆ´ï
> ³­ËÍ: daniel.daugherty at oracle.com; serviceability-dev at openjdk.java.net
> Ö÷Ìâ: Re: Errors when use "universe" command in CLHSDB
>  
> Yunda,
>  
> I think this fixes http://bugs.sun.com/view_bug.do?bug_id=8005278
>  
> The changes look good to me. I couldn't apply the patch to the code cleanly, however (see below). Perhaps the patch was broken in email? Can you regenerate the patch and include it as a zipped attachment?
>  
> Thanks,
> /Staffan
>  
>  
> file agent/src/share/classes/sun/jvm/hotspot/memory/AFLBinaryTreeDictionary.java already exists
> 1 out of 1 hunks FAILED -- saving rejects to file agent/src/share/classes/sun/jvm/hotspot/memory/AFLBinaryTreeDictionary.java.rej
> patching file agent/src/share/classes/sun/jvm/hotspot/memory/CompactibleFreeListSpace.java
> Hunk #1 FAILED at 116
> Hunk #2 FAILED at 40
> 2 out of 2 hunks FAILED -- saving rejects to file agent/src/share/classes/sun/jvm/hotspot/memory/CompactibleFreeListSpace.java.rej
> patching file src/share/vm/gc_implementation/concurrentMarkSweep/vmStructs_cms.hpp
> Hunk #1 succeeded at 45 with fuzz 2 (offset 0 lines).
> patch failed, unable to continue (try -v)
> patch failed, rejects left in working dir
>  
> On 18 jan 2013, at 04:54, ÔÆ´ï <yunda.mly at taobao.com> wrote:
> 
> 
>  
> Thanks Dan!
>  
> Regards,
> Yunda
> ·¢¼þÈË: Daniel D. Daugherty [mailto:daniel.daugherty at oracle.com] 
> ·¢ËÍʱ¼ä: 2013Äê1ÔÂ18ÈÕ 10:46
> ÊÕ¼þÈË: ÔÆ´ï; serviceability-dev at openjdk.java.net
> Ö÷Ìâ: Re: Errors when use "universe" command in CLHSDB
>  
> Yunda,
> 
> The Serviceability Agent is maintained by the Serviceability team.
> I'm adding that alias to this e-mail thread (and Bcc'ing the Runtime
> alias.
> 
> Dan
> 
> On 1/17/13 7:42 PM, ÔÆ´ï wrote:
> Hi all,
>  
> This is Yunda <yunda.mly at taobao.com> from Alibaba Group(with OCA).
>  
> When I used CLHSDB( java -classpath .:$JAVA_HOME/lib/sa-jdi.jar sun.jvm.hotspot.CLHSDB) I found two errors below(the second error occurred after I made some fix). It seemed that some code about CMS in SA didn¡¯t change accordingly.
> hsdb> universe
> Heap Parameters:
> Gen 0:   eden [0x0000000609200000,0x00000006094aeb90,0x0000000611820000) space capacity = 140640256, 2.000007736049627 used
>   from [0x0000000611820000,0x0000000611820000,0x00000006128e0000) space capacity = 17563648, 0.0 used
>   to   [0x00000006128e0000,0x00000006128e0000,0x00000006139a0000) space capacity = 17563648, 0.0 usedInvocations: 0
>  
> Gen 1: concurrent mark-sweep generation
> Exception in thread "main" java.lang.ExceptionInInitializerError
>          at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
>          at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
>          at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
>          at java.lang.reflect.Constructor.newInstance(Constructor.java:395)
>          at sun.jvm.hotspot.runtime.VMObjectFactory.newObject(VMObjectFactory.java:58)
>          at sun.jvm.hotspot.memory.ConcurrentMarkSweepGeneration.cmsSpace(ConcurrentMarkSweepGeneration.java:55)
>          at sun.jvm.hotspot.memory.ConcurrentMarkSweepGeneration.printOn(ConcurrentMarkSweepGeneration.java:79)
>          at sun.jvm.hotspot.memory.GenCollectedHeap.printOn(GenCollectedHeap.java:139)
>          at sun.jvm.hotspot.CommandProcessor$48.doit(CommandProcessor.java:1605)
>          at sun.jvm.hotspot.CommandProcessor.executeCommand(CommandProcessor.java:1897)
>          at sun.jvm.hotspot.CommandProcessor.executeCommand(CommandProcessor.java:1867)
>          at sun.jvm.hotspot.CommandProcessor.run(CommandProcessor.java:1747)
>          at sun.jvm.hotspot.CLHSDB.run(CLHSDB.java:91)
>          at sun.jvm.hotspot.CLHSDB.main(CLHSDB.java:35)
> Caused by: java.lang.RuntimeException: field "_dictionary" not found in type CompactibleFreeListSpace
>          at sun.jvm.hotspot.types.basic.BasicType.getField(BasicType.java:183)
>          at sun.jvm.hotspot.types.basic.BasicType.getField(BasicType.java:190)
>          at sun.jvm.hotspot.types.basic.BasicType.getField(BasicType.java:194)
>          at sun.jvm.hotspot.types.basic.BasicType.getAddressField(BasicType.java:282)
>          at sun.jvm.hotspot.memory.CompactibleFreeListSpace.initialize(CompactibleFreeListSpace.java:69)
>          at sun.jvm.hotspot.memory.CompactibleFreeListSpace.access$000(CompactibleFreeListSpace.java:35)
>          at sun.jvm.hotspot.memory.CompactibleFreeListSpace$1.update(CompactibleFreeListSpace.java:55)
>          at sun.jvm.hotspot.runtime.VM.registerVMInitializedObserver(VM.java:402)
>          at sun.jvm.hotspot.memory.CompactibleFreeListSpace.<clinit>(CompactibleFreeListSpace.java:53)
>          ... 14 more
>  
> hsdb> universe
> Heap Parameters:
> Gen 0:   eden [0x0000000609200000,0x00000006094aeb90,0x0000000611820000) space capacity = 140640256, 2.000007736049627 used
>   from [0x0000000611820000,0x0000000611820000,0x00000006128e0000) space capacity = 17563648, 0.0 used
>   to   [0x00000006128e0000,0x00000006128e0000,0x00000006139a0000) space capacity = 17563648, 0.0 usedInvocations: 0
>  
> Gen 1: concurrent mark-sweep generation
> free-list-space[ 0x000000064cb90000 , 0x0000000661ad0000 ) Exception in thread "main" java.lang.ExceptionInInitializerError
>          at sun.jvm.hotspot.memory.CompactibleFreeListSpace.free(CompactibleFreeListSpace.java:112)
>          at sun.jvm.hotspot.memory.CompactibleFreeListSpace.used(CompactibleFreeListSpace.java:95)
>          at sun.jvm.hotspot.memory.CompactibleFreeListSpace.printOn(CompactibleFreeListSpace.java:137)
>          at sun.jvm.hotspot.memory.ConcurrentMarkSweepGeneration.printOn(ConcurrentMarkSweepGeneration.java:79)
>          at sun.jvm.hotspot.memory.GenCollectedHeap.printOn(GenCollectedHeap.java:139)
>          at sun.jvm.hotspot.CommandProcessor$48.doit(CommandProcessor.java:1605)
>          at sun.jvm.hotspot.CommandProcessor.executeCommand(CommandProcessor.java:1897)
>          at sun.jvm.hotspot.CommandProcessor.executeCommand(CommandProcessor.java:1867)
>          at sun.jvm.hotspot.CommandProcessor.run(CommandProcessor.java:1747)
>          at sun.jvm.hotspot.CLHSDB.run(CLHSDB.java:91)
>          at sun.jvm.hotspot.CLHSDB.main(CLHSDB.java:35)
> Caused by: java.lang.RuntimeException: No type named "FreeList" in database
>          at sun.jvm.hotspot.types.basic.BasicTypeDataBase.lookupType(BasicTypeDataBase.java:80)
>          at sun.jvm.hotspot.HotSpotTypeDataBase.lookupType(HotSpotTypeDataBase.java:134)
>          at sun.jvm.hotspot.types.basic.BasicTypeDataBase.lookupType(BasicTypeDataBase.java:74)
>          at sun.jvm.hotspot.memory.FreeList.initialize(FreeList.java:44)
>          at sun.jvm.hotspot.memory.FreeList.access$000(FreeList.java:34)
>          at sun.jvm.hotspot.memory.FreeList$1.update(FreeList.java:38)
>          at sun.jvm.hotspot.runtime.VM.registerVMInitializedObserver(VM.java:402)
>          at sun.jvm.hotspot.memory.FreeList.<clinit>(FreeList.java:36)
>          ... 11 more
>  
> So I made a patch to fix them and now ¡°universe¡± command works well. Could someone help to review the patch below?
>  
> diff -r b14da2e6f2dc -r 8652e04889a4 agent/src/share/classes/sun/jvm/hotspot/memory/AFLBinaryTreeDictionary.java
> --- /dev/null      Thu Jan 01 00:00:00 1970 +0000
> +++ b/agent/src/share/classes/sun/jvm/hotspot/memory/AFLBinaryTreeDictionary.java   Fri Jan 18 09:56:06 2013 +0800
> @@ -0,0 +1,59 @@
> +/*
> + * @(#)AFLBinaryTreeDictionary.java
> + * Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved.
> + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
> + *
> + * This code is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU General Public License version 2 only, as
> + * published by the Free Software Foundation.
> + *
> + * This code is distributed in the hope that it will be useful, but WITHOUT
> + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
> + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
> + * version 2 for more details (a copy is included in the LICENSE file that
> + * accompanied this code).
> + *
> + * You should have received a copy of the GNU General Public License version
> + * 2 along with this work; if not, write to the Free Software Foundation,
> + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
> + *
> + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
> + * or visit www.oracle.com if you need additional information or have any
> + * questions.
> + *
> + */
> +
> +package sun.jvm.hotspot.memory;
> +
> +import java.util.*;
> +import sun.jvm.hotspot.debugger.*;
> +import sun.jvm.hotspot.types.*;
> +import sun.jvm.hotspot.runtime.*;
> +
> +public class AFLBinaryTreeDictionary extends VMObject {
> +   static {
> +      VM.registerVMInitializedObserver(new Observer() {
> +         public void update(Observable o, Object data) {
> +            initialize(VM.getVM().getTypeDataBase());
> +         }
> +      });
> +   }
> +
> +   private static synchronized void initialize(TypeDataBase db) {
> +      Type type = db.lookupType("AFLBinaryTreeDictionary");
> +      totalSizeField = type.getCIntegerField("_total_size");
> +   }
> +
> +   // Fields
> +   private static CIntegerField totalSizeField;
> +
> +   // Accessors
> +   public long size() {
> +      return totalSizeField.getValue(addr);
> +   }
> +
> +   // Constructor
> +   public AFLBinaryTreeDictionary(Address addr) {
> +      super(addr);
> +   }
> +}
> diff -r b14da2e6f2dc -r 8652e04889a4 agent/src/share/classes/sun/jvm/hotspot/memory/BinaryTreeDictionary.java
> --- a/agent/src/share/classes/sun/jvm/hotspot/memory/BinaryTreeDictionary.java   Thu Jan 17 13:40:31 2013 -0500
> +++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
> @@ -1,59 +0,0 @@
> -/*
> - * @(#)BinaryTreeDictionary.java
> - * Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved.
> - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
> - *
> - * This code is free software; you can redistribute it and/or modify it
> - * under the terms of the GNU General Public License version 2 only, as
> - * published by the Free Software Foundation.
> - *
> - * This code is distributed in the hope that it will be useful, but WITHOUT
> - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
> - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
> - * version 2 for more details (a copy is included in the LICENSE file that
> - * accompanied this code).
> - *
> - * You should have received a copy of the GNU General Public License version
> - * 2 along with this work; if not, write to the Free Software Foundation,
> - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
> - *
> - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
> - * or visit www.oracle.com if you need additional information or have any
> - * questions.
> - *
> - */
> -
> -package sun.jvm.hotspot.memory;
> -
> -import java.util.*;
> -import sun.jvm.hotspot.debugger.*;
> -import sun.jvm.hotspot.types.*;
> -import sun.jvm.hotspot.runtime.*;
> -
> -public class BinaryTreeDictionary extends VMObject {
> -   static {
> -      VM.registerVMInitializedObserver(new Observer() {
> -         public void update(Observable o, Object data) {
> -            initialize(VM.getVM().getTypeDataBase());
> -         }
> -      });
> -   }
> -
> -   private static synchronized void initialize(TypeDataBase db) {
> -      Type type = db.lookupType("BinaryTreeDictionary");
> -      totalSizeField = type.getCIntegerField("_totalSize");
> -   }
> -
> -   // Fields
> -   private static CIntegerField totalSizeField;
> -
> -   // Accessors
> -   public long size() {
> -      return totalSizeField.getValue(addr);
> -   }
> -
> -   // Constructor
> -   public BinaryTreeDictionary(Address addr) {
> -      super(addr);
> -   }
> -}
> diff -r b14da2e6f2dc -r 8652e04889a4 agent/src/share/classes/sun/jvm/hotspot/memory/CompactibleFreeListSpace.java
> --- a/agent/src/share/classes/sun/jvm/hotspot/memory/CompactibleFreeListSpace.java  Thu Jan 17 13:40:31 2013 -0500
> +++ b/agent/src/share/classes/sun/jvm/hotspot/memory/CompactibleFreeListSpace.java         Fri Jan 18 09:56:06 2013 +0800
> @@ -117,7 +117,7 @@
>        }
>        // large block
> -      BinaryTreeDictionary bfbd = (BinaryTreeDictionary) VMObjectFactory.newObject(BinaryTreeDictionary.class,
> +      AFLBinaryTreeDictionary bfbd = (AFLBinaryTreeDictionary) VMObjectFactory.newObject(AFLBinaryTreeDictionary.class,
>                                                                                     dictionaryField.getValue(addr));
>        size += bfbd.size();
> diff -r b14da2e6f2dc -r 8652e04889a4 agent/src/share/classes/sun/jvm/hotspot/memory/FreeList.java
> --- a/agent/src/share/classes/sun/jvm/hotspot/memory/FreeList.java         Thu Jan 17 13:40:31 2013 -0500
> +++ b/agent/src/share/classes/sun/jvm/hotspot/memory/FreeList.java      Fri Jan 18 09:56:06 2013 +0800
> @@ -41,7 +41,7 @@
>     }
>     private static synchronized void initialize(TypeDataBase db) {
> -      Type type = db.lookupType("FreeList");
> +      Type type = db.lookupType("FreeList<FreeChunk>");
>        sizeField = type.getCIntegerField("_size");
>        countField = type.getCIntegerField("_count");
>        headerSize = type.getSize();
> diff -r b14da2e6f2dc -r 8652e04889a4 src/share/vm/gc_implementation/concurrentMarkSweep/vmStructs_cms.hpp
> --- a/src/share/vm/gc_implementation/concurrentMarkSweep/vmStructs_cms.hpp  Thu Jan 17 13:40:31 2013 -0500
> +++ b/src/share/vm/gc_implementation/concurrentMarkSweep/vmStructs_cms.hpp         Fri Jan 18 09:56:06 2013 +0800
> @@ -43,7 +43,8 @@
>    nonstatic_field(LinearAllocBlock,            _word_size,                                    size_t)                                \
>    nonstatic_field(AFLBinaryTreeDictionary,     _total_size,                                   size_t)                                \
>    nonstatic_field(CompactibleFreeListSpace,    _indexedFreeList[0],                           FreeList<FreeChunk>)                   \
> -  nonstatic_field(CompactibleFreeListSpace,    _smallLinearAllocBlock,                        LinearAllocBlock)
> +  nonstatic_field(CompactibleFreeListSpace,    _smallLinearAllocBlock,                        LinearAllocBlock)                      \
> +  nonstatic_field(CompactibleFreeListSpace,    _dictionary,                                   FreeBlockDictionary<FreeChunk>*)
>  
>  #define VM_TYPES_CMS(declare_type,                                        \
>  
>  
> Regards,
> Yunda
>  
> 
> This email (including any attachments) is confidential and may be legally privileged. If you received this email in error, please delete it immediately and do not copy it or use it for any purpose or disclose its contents to any other person. Thank you.
> 
> ±¾µçÓÊ(°üÀ¨Èκθ½¼þ)¿ÉÄܺ¬ÓлúÃÜ×ÊÁϲ¢ÊÜ·¨Âɱ£»¤¡£ÈçÄú²»ÊÇÕýÈ·µÄÊÕ¼þÈË£¬ÇëÄúÁ¢¼´É¾³ý±¾Óʼþ¡£Çë²»Òª½«±¾µçÓʽøÐи´ÖƲ¢ÓÃ×÷ÈκÎÆä ËûÓÃ;¡¢»ò͸¶±¾ÓʼþÖ®ÄÚÈÝ¡£Ð»Ð»¡£
>  
>  
> 
> This email (including any attachments) is confidential and may be legally privileged. If you received this email in error, please delete it immediately and do not copy it or use it for any purpose or disclose its contents to any other person. Thank you.
> 
> ±¾µçÓÊ(°üÀ¨Èκθ½¼þ)¿ÉÄܺ¬ÓлúÃÜ×ÊÁϲ¢ÊÜ·¨Âɱ£»¤¡£ÈçÄú²»ÊÇÕýÈ·µÄÊÕ¼þÈË£¬ÇëÄúÁ¢¼´É¾³ý±¾Óʼþ¡£Çë²»Òª½«±¾µçÓʽøÐи´ÖƲ¢ÓÃ×÷ÈκÎÆäËûÓÃ;¡¢»ò͸¶±¾ÓʼþÖ®ÄÚÈÝ¡£Ð»Ð»¡£
>  
> <tmp.zip>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/serviceability-dev/attachments/20130118/27e4bd24/attachment-0001.html 


More information about the serviceability-dev mailing list