OpenDataException thrown when constructing CompositeData for ThreadInfo
Mandy Chung
mandy.chung at oracle.com
Mon Oct 22 06:26:33 UTC 2018
Hi Sven,
Do you have a sample ThreadInfo to reproduce this issue? That will be
helpful. JMX monitoring is not impacted as far as I can tell. NB
profiling is using this internal API
`sun.management.ThreadInfoCompositeData::toCompositeData` which may be
unused since JMX supports MXBean.
Mandy
On 10/21/18 5:38 PM, Sven Reimers wrote:
> Hi,
>
> one more problem to go
>
> After applying the proposed fix for the
> ThreadINfoCompositeData.compositeTyoe() the following exception is raised:
>
> java.lang.reflect.InvocationTargetException
> at
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native
> Method)
> at
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> at
> java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.base/java.lang.reflect.Method.invoke(Method.java:566)
> at
> org.netbeans.modules.sampler.SamplesOutputStream.toCompositeData(SamplesOutputStream.java:178)
> at
> org.netbeans.modules.sampler.SamplesOutputStream.access$400(SamplesOutputStream.java:44)
> at
> org.netbeans.modules.sampler.SamplesOutputStream$Sample.writeToStream(SamplesOutputStream.java:285)
> at
> org.netbeans.modules.sampler.SamplesOutputStream$Sample.access$300(SamplesOutputStream.java:253)
> at
> org.netbeans.modules.sampler.SamplesOutputStream.close(SamplesOutputStream.java:202)
> at org.netbeans.modules.sampler.Sampler.stopSampling(Sampler.java:231)
> at org.netbeans.modules.sampler.Sampler.stop(Sampler.java:207)
> at
> org.netbeans.core.ui.sampler.SelfSamplerAction$1.doInBackground(SelfSamplerAction.java:90)
> at java.desktop/javax.swing.SwingWorker$1.call(SwingWorker.java:304)
> at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
> at java.desktop/javax.swing.SwingWorker.run(SwingWorker.java:343)
> at
> java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
> at
> java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
> at java.base/java.lang.Thread.run(Thread.java:835)
> Caused by: java.lang.AssertionError:
> javax.management.openmbean.OpenDataException: Argument value of wrong
> type for item lockInfo: value false, type
> javax.management.openmbean.CompositeType(name=java.lang.management.LockInfo,items=((itemName=className,itemType=javax.management.openmbean.SimpleType(name=java.lang.String)),(itemName=identityHashCode,itemType=javax.management.openmbean.SimpleType(name=java.lang.Integer))))
> at
> java.management/sun.management.ThreadInfoCompositeData.getCompositeData(ThreadInfoCompositeData.java:135)
> at
> java.management/sun.management.ThreadInfoCompositeData.toCompositeData(ThreadInfoCompositeData.java:72)
> ... 18 more
> Caused by: javax.management.openmbean.OpenDataException: Argument
> value of wrong type for item lockInfo: value false, type
> javax.management.openmbean.CompositeType(name=java.lang.management.LockInfo,items=((itemName=className,itemType=javax.management.openmbean.SimpleType(name=java.lang.String)),(itemName=identityHashCode,itemType=javax.management.openmbean.SimpleType(name=java.lang.Integer))))
> at
> java.management/javax.management.openmbean.CompositeDataSupport.<init>(CompositeDataSupport.java:235)
> at
> java.management/javax.management.openmbean.CompositeDataSupport.<init>(CompositeDataSupport.java:118)
> at
> java.management/sun.management.ThreadInfoCompositeData.getCompositeData(ThreadInfoCompositeData.java:130)
> ... 19 more
>
> Seems the sequence of values is broken for ThreadInfoCompoositeData also.
>
> Changing the sequence so that lockInfoData is after isNative fixes the
> problem:
>
> final Object[] threadInfoItemValues = {
> threadInfo.getThreadId(),
> threadInfo.getThreadName(),
> threadInfo.getThreadState().name(),
> threadInfo.getBlockedTime(),
> threadInfo.getBlockedCount(),
> threadInfo.getWaitedTime(),
> threadInfo.getWaitedCount(),
> threadInfo.getLockName(),
> threadInfo.getLockOwnerId(),
> threadInfo.getLockOwnerName(),
> stackTraceData,
> threadInfo.isSuspended(),
> threadInfo.isInNative(),
> lockInfoData,
> lockedMonitorsData,
> lockedSyncsData,
> threadInfo.isDaemon(),
> threadInfo.getPriority(),
> };
>
> With both of this fixes in place I can finally get the self sampling
> in NetBeans to work on JDK 12.. (and 11)
>
> Thanks for looking into this
>
> -Sven
> --
> Sven Reimers
>
> * Senior Expert Software Architect
> * Java Champion
> * JUG Leader JUG Bodensee: http://www.jug-bodensee.de
> * Duke's Choice Award Winner 2009
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/serviceability-dev/attachments/20181021/b7a2487f/attachment.html>
More information about the serviceability-dev
mailing list