=?GB2312?B?tPC4tDogRXJyb3JzIHdoZW4gdXNlICJ1bml2ZXJzZSIgY29tbQ==?= =?GB2312?B?YW5kIGluIENMSFNEQg==?=

Mikael Gerdin mikael.gerdin at oracle.com
Fri Jan 18 00:48:55 PST 2013


I saw an existing bug reported for this the other day:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=8005278

I cc:ed Yumin who currently owns the bug.

/Mikael

On 2013-01-18 04:54, ÔÆ´ï 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> <mailto: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 <http://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 <http://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.
> 
> ±¾µçÓÊ(°üÀ¨Èκθ½¼þ)¿ÉÄܺ¬ÓлúÃÜ×ÊÁϲ¢ÊÜ·¨Âɱ£»¤¡£ÈçÄú²»ÊÇÕýÈ·µÄÊÕ¼þÈË£¬ 
> ÇëÄúÁ¢¼´É¾³ý±¾Óʼþ¡£Çë²»Òª½«±¾µçÓʽøÐи´ÖƲ¢ÓÃ×÷ÈκÎÆäËûÓÃ;¡¢»ò͸¶±¾ÓÊ 
> ¼þÖ®ÄÚÈÝ¡£Ð»Ð»¡£

-- 
Mikael Gerdin
Java SE VM SQE Stockholm


More information about the serviceability-dev mailing list