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

List:       openjdk-serviceability-dev
Subject:    [PATCH] typeToVtbl of BasicTypeDataBase should not be static
From:       云 <yunda.mly () taobao ! com>
Date:       2013-02-28 3:59:37
Message-ID: F6ACE14573EC5F40AEA19AEB2F62E579016D6F () CNHZ-EXMAIL-04 ! ali ! com
[Download RAW message or body]

[Attachment #2 (text/plain)]

Hi all,

I found that when I detached a java process and attached another java process, the \
"universe" command of CLHSDB didn't show the right information. But when I restarted \
CLHSDB and attached to the same process the problem disappeared:

hsdb> attach 29211
Attaching to process 29211, please wait...
hsdb> universe
Heap Parameters:
ParallelScavengeHeap [ PSYoungGen [ eden =  \
[0x00000000ee200000,0x00000000ee289aa8,0x00000000eef70000] , from =  \
[0x00000000ef1a0000,0x00000000ef1a0000,0x00000000ef3d0000] , to =  \
[0x00000000eef70000,0x00000000eef70000,0x00000000ef1a0000]  ] PSOldGen [  \
[0x00000000ca600000,0x00000000ca600000,0x00000000cc9c0000]  ]  ] hsdb> hsdb> detach
hsdb> attach 29887
Attaching to process 29887, please wait...
hsdb> universe
Heap Parameters:
unknown subtype of CollectedHeap @ 0x0000000000d56fb0 \
(0x00000000ca600000,0x0000000100000000) hsdb> quit
[~]$ java -cp .:$JAVA_HOME/lib/sa-jdi.jar sun.jvm.hotspot.CLHSDB
hsdb> attach 29887
Attaching to process 29887, please wait...
hsdb> universe
Heap Parameters:
ParallelScavengeHeap [ PSYoungGen [ eden =  \
[0x00000000ee200000,0x00000000ee289a68,0x00000000eef70000] , from =  \
[0x00000000ef1a0000,0x00000000ef1a0000,0x00000000ef3d0000] , to =  \
[0x00000000eef70000,0x00000000eef70000,0x00000000ef1a0000]  ] PSOldGen [  \
[0x00000000ca600000,0x00000000ca600000,0x00000000cc9c0000]  ]  ] hsdb>

I think it's caused by the wrong definition of "typeToVtbl" field of \
BasicTypeDataBase. Since typeToVtbl should be recreated every time SA attaches to a \
new process, it should not be static. So I made a small patch fo fix it:

diff -r ec2eddfed950 \
                agent/src/share/classes/sun/jvm/hotspot/types/basic/BasicTypeDataBase.java
                
--- a/agent/src/share/classes/sun/jvm/hotspot/types/basic/BasicTypeDataBase.java     \
                Tue Feb 26 14:09:52 2013 +0100
+++ b/agent/src/share/classes/sun/jvm/hotspot/types/basic/BasicTypeDataBase.java  Thu \
Feb 28 11:57:55 2013 +0800 @@ -150,7 +150,7 @@
     return VM.getVM().getOopSize();
   }
-  static HashMap typeToVtbl = new HashMap();
+  private HashMap typeToVtbl = new HashMap();
   private Address vtblForType(Type type) {
     Address vtblAddr = (Address)typeToVtbl.get(type);


After applying this patch, the problem I mentioned above disappeared.

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.

本电邮(包括任何附件)可能含有机密资料并受法律保护。如您不是正确的收件人,请您立即 \
除本邮件。请不要将本电邮进行复制并用作任何其他用途、或透露本邮件之内容。谢谢。



[Attachment #3 (text/html)]

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style>
<!--
@font-face
	{font-family:宋体}
@font-face
	{font-family:宋体}
@font-face
	{font-family:Calibri}
@font-face
	{font-family:"\@宋体"}
p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0cm;
	margin-bottom:.0001pt;
	text-align:justify;
	text-justify:inter-ideograph;
	font-size:10.5pt;
	font-family:"Calibri","sans-serif"}
a:link, span.MsoHyperlink
	{color:blue;
	text-decoration:underline}
a:visited, span.MsoHyperlinkFollowed
	{color:purple;
	text-decoration:underline}
span.EmailStyle17
	{font-family:"Calibri","sans-serif";
	color:windowtext}
.MsoChpDefault
	{font-family:"Calibri","sans-serif"}
@page WordSection1
	{margin:72.0pt 90.0pt 72.0pt 90.0pt}
div.WordSection1
	{}
-->
</style>
</head>
<body lang="ZH-CN" link="blue" vlink="purple" style="">
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-US" style="font-size:12.0pt">Hi all,</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:12.0pt">&nbsp;</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:12.0pt">I found that when I \
detached a java process and attached another java process, the "universe" command of \
CLHSDB didn't show the right information. But when I restarted CLHSDB and attached to \
the  same process the problem disappeared:</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:12.0pt">&nbsp;</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:12.0pt">hsdb&gt; attach \
29211</span></p> <p class="MsoNormal"><span lang="EN-US" \
style="font-size:12.0pt">Attaching to process 29211, please wait...</span></p> <p \
class="MsoNormal"><span lang="EN-US" style="font-size:12.0pt">hsdb&gt; \
universe</span></p> <p class="MsoNormal"><span lang="EN-US" \
style="font-size:12.0pt">Heap Parameters:</span></p> <p class="MsoNormal"><span \
lang="EN-US" style="font-size:12.0pt">ParallelScavengeHeap [ PSYoungGen [ eden \
=&nbsp; [0x00000000ee200000,0x00000000ee289aa8,0x00000000eef70000] , from =&nbsp; \
[0x00000000ef1a0000,0x00000000ef1a0000,0x00000000ef3d0000] , to =&nbsp; \
[0x00000000eef70000,0x00000000eef70000,0x00000000ef1a0000]&nbsp;  ] PSOldGen [&nbsp; \
[0x00000000ca600000,0x00000000ca600000,0x00000000cc9c0000]&nbsp; ]&nbsp; ] hsdb&gt; \
</span></p> <p class="MsoNormal"><span lang="EN-US" style="font-size:12.0pt">hsdb&gt; \
detach</span></p> <p class="MsoNormal"><span lang="EN-US" \
style="font-size:12.0pt">hsdb&gt; attach 29887</span></p> <p class="MsoNormal"><span \
lang="EN-US" style="font-size:12.0pt">Attaching to process 29887, please \
wait...</span></p> <p class="MsoNormal"><span lang="EN-US" \
style="font-size:12.0pt">hsdb&gt; universe</span></p> <p class="MsoNormal"><span \
lang="EN-US" style="font-size:12.0pt">Heap Parameters:</span></p> <p \
class="MsoNormal"><b><span lang="EN-US" style="font-size:12.0pt; color:red">unknown \
subtype of CollectedHeap</span></b><span lang="EN-US" style="font-size:12.0pt"> @ \
0x0000000000d56fb0 (0x00000000ca600000,0x0000000100000000)</span></p> <p \
class="MsoNormal"><span lang="EN-US" style="font-size:12.0pt">hsdb&gt; \
quit</span></p> <p class="MsoNormal"><span lang="EN-US" style="font-size:12.0pt">[~]$ \
java -cp .:$JAVA_HOME/lib/sa-jdi.jar sun.jvm.hotspot.CLHSDB</span></p> <p \
class="MsoNormal"><span lang="EN-US" style="font-size:12.0pt">hsdb&gt; attach \
29887</span></p> <p class="MsoNormal"><span lang="EN-US" \
style="font-size:12.0pt">Attaching to process 29887, please wait...</span></p> <p \
class="MsoNormal"><span lang="EN-US" style="font-size:12.0pt">hsdb&gt; \
universe</span></p> <p class="MsoNormal"><span lang="EN-US" \
style="font-size:12.0pt">Heap Parameters:</span></p> <p class="MsoNormal"><b><span \
lang="EN-US" style="font-size:12.0pt; color:red">ParallelScavengeHeap</span></b><span \
lang="EN-US" style="font-size:12.0pt; color:red"> </span><span lang="EN-US" \
style="font-size:12.0pt">[ PSYoungGen [ eden =&nbsp; \
[0x00000000ee200000,0x00000000ee289a68,0x00000000eef70000] , from =&nbsp; \
[0x00000000ef1a0000,0x00000000ef1a0000,0x00000000ef3d0000] , to =&nbsp; \
[0x00000000eef70000,0x00000000eef70000,0x00000000ef1a0000]&nbsp;  ] PSOldGen [&nbsp; \
[0x00000000ca600000,0x00000000ca600000,0x00000000cc9c0000]&nbsp; ]&nbsp; ] \
hsdb&gt;</span></p> <p class="MsoNormal"><span lang="EN-US" \
style="font-size:12.0pt">&nbsp;</span></p> <p class="MsoNormal"><span lang="EN-US" \
style="font-size:12.0pt">I think it's caused by the wrong definition of "typeToVtbl" \
field of BasicTypeDataBase. Since typeToVtbl should be recreated every time SA \
attaches to a new process, it should not be static. So  I made a small patch fo fix \
it:</span></p> <p class="MsoNormal"><span lang="EN-US" \
style="font-size:12.0pt">&nbsp;</span></p> <p class="MsoNormal"><span lang="EN-US" \
style="font-size:12.0pt">diff -r ec2eddfed950 \
agent/src/share/classes/sun/jvm/hotspot/types/basic/BasicTypeDataBase.java</span></p> \
<p class="MsoNormal"><span lang="EN-US" style="font-size:12.0pt">--- \
a/agent/src/share/classes/sun/jvm/hotspot/types/basic/BasicTypeDataBase.java&nbsp;&nbsp;&nbsp;&nbsp; \
Tue Feb 26 14:09:52 2013 &#43;0100</span></p> <p class="MsoNormal"><span lang="EN-US" \
style="font-size:12.0pt">&#43;&#43;&#43; \
b/agent/src/share/classes/sun/jvm/hotspot/types/basic/BasicTypeDataBase.java&nbsp; \
Thu Feb 28 11:57:55 2013 &#43;0800</span></p> <p class="MsoNormal"><span lang="EN-US" \
style="font-size:12.0pt">@@ -150,7 &#43;150,7 @@</span></p> <p \
class="MsoNormal"><span lang="EN-US" \
style="font-size:12.0pt">&nbsp;&nbsp;&nbsp;&nbsp; return \
VM.getVM().getOopSize();</span></p> <p class="MsoNormal"><span lang="EN-US" \
style="font-size:12.0pt">&nbsp;&nbsp; }</span></p> <p class="MsoNormal"><span \
lang="EN-US" style="font-size:12.0pt"></span></p> <p class="MsoNormal"><span \
lang="EN-US" style="font-size:12.0pt">-&nbsp; static HashMap typeToVtbl = new \
HashMap();</span></p> <p class="MsoNormal"><span lang="EN-US" \
style="font-size:12.0pt">&#43;&nbsp; private HashMap typeToVtbl = new \
HashMap();</span></p> <p class="MsoNormal"><span lang="EN-US" \
style="font-size:12.0pt"></span></p> <p class="MsoNormal"><span lang="EN-US" \
style="font-size:12.0pt">&nbsp;&nbsp;&nbsp;private Address vtblForType(Type type) \
{</span></p> <p class="MsoNormal"><span lang="EN-US" \
style="font-size:12.0pt">&nbsp;&nbsp;&nbsp;&nbsp; Address vtblAddr = \
(Address)typeToVtbl.get(type);</span></p> <p class="MsoNormal"><span lang="EN-US" \
style="font-size:12.0pt">&nbsp;</span></p> <p class="MsoNormal"><span lang="EN-US" \
style="font-size:12.0pt">&nbsp;</span></p> <p class="MsoNormal"><span lang="EN-US" \
style="font-size:12.0pt">After applying this patch, the problem I mentioned above \
disappeared.</span></p> <p class="MsoNormal"><span lang="EN-US" \
style="font-size:12.0pt">&nbsp;</span></p> <p class="MsoNormal"><span lang="EN-US" \
style="font-size:12.0pt">Regards,</span></p> <p class="MsoNormal"><span lang="EN-US" \
style="font-size:12.0pt">Yunda</span></p> <p class="MsoNormal"><span \
lang="EN-US">&nbsp;</span></p> </div>
<br>
<hr>
<font face="Arial" color="Gray" size="1"><br>
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.<br> <br>
本电邮(包括任何附件)可能含有机密资料并受法律保护。如您不是正确的收件人,请您立即 \
除本邮件。请不要将本电邮进行复制并用作任何其他用途、或透露本邮件之内容。谢谢。<br>
 </font>
</body>
</html>



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

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