Discussion:
OpenDataException thrown when constructing CompositeData for ThreadInfo
(too old to reply)
Sven Reimers
2018-10-22 00:38:00 UTC
Permalink
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
Mandy Chung
2018-10-22 06:26:33 UTC
Permalink
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
Post by Sven Reimers
Hi,
one more problem to go
After applying the proposed fix for the
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)
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
       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
Sven Reimers
2018-10-22 14:53:45 UTC
Permalink
Hi Mandy,
will try to get a sample to you.

Which format do you prefer?

Thanks for helping

-Sven
Post by Mandy Chung
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
Hi,
one more problem to go
After applying the proposed fix for the
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)
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
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
Mandy Chung
2018-10-22 16:00:00 UTC
Permalink
I assume it's a simple ThreadInfo then a simple text form would work; if
not, you can use the format NB use if you have the reader.

Mandy
Post by Sven Reimers
Hi Mandy,
will try to get a sample to you.
Which format do you prefer?
Thanks for helping
-Sven
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
Post by Sven Reimers
Hi,
one more problem to go
After applying the proposed fix for the
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)
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
       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
Mandy Chung
2018-10-23 05:34:05 UTC
Permalink
Hi Sven,

I created https://bugs.openjdk.java.net/browse/JDK-8212795 to track this
issue.   NB is using the internal API that is unused in JDK and hence no
test uncovers this regression.

I have a patch that passes a map of key to values to
CompositeDataSupport rather than passing two synchronized arrays which
is error prone.   Can you help verify if this patch properly fixes NB issue:
http://cr.openjdk.java.net/~mchung/jdk12/webrevs/8212795/webrev.00/

I will also work on a test in the meantime.

Mandy
Post by Sven Reimers
Hi,
one more problem to go
After applying the proposed fix for the
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)
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
       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
Loading...