Profiling cause jvmti errors

1,360 views
Skip to first unread message

charlyghislain

unread,
Jan 26, 2011, 9:28:21 AM1/26/11
to kryonet-users
Hi,

I'm using kryonet in a small arcade network game, it works very well!
I managed to implement a quake3-like network model with half-life-like
imposed local latency. I'm quite satisfied with the results so far.

However, as i want to optimize the game simulation code, i tried
attaching the netbeans profiler to the project, but it always ends up
with those errors:

Profiler Agent Error: Redefinition failed for classes:
com.esotericsoftware.kryonet.FrameworkMessage$RegisterTCPFieldAccess
Profiler Agent Error: with message: Redefinition failed with error 62
Check JVMTI documentation for this error code.
Debug: writing class file:
com.esotericsoftware.kryonet.FrameworkMessage$RegisterTCPFieldAccess,
into file: com.esotericsoftware.kryonet.FrameworkMessage
$RegisterTCPFieldAccess.class
Profiler Agent Error: Redefinition failed for classes:
com.esotericsoftware.kryonet.FrameworkMessage$RegisterUDPFieldAccess
Profiler Agent Error: with message: Redefinition failed with error 62
Check JVMTI documentation for this error code.
Debug: writing class file:
com.esotericsoftware.kryonet.FrameworkMessage$RegisterUDPFieldAccess,
into file: com.esotericsoftware.kryonet.FrameworkMessage
$RegisterUDPFieldAccess.class
Profiler Agent Error: Redefinition failed for classes:
com.esotericsoftware.kryonet.FrameworkMessage$PingFieldAccess
Profiler Agent Error: with message: Redefinition failed with error 62
Check JVMTI documentation for this error code.
Debug: writing class file:
com.esotericsoftware.kryonet.FrameworkMessage$PingFieldAccess, into
file: com.esotericsoftware.kryonet.FrameworkMessage
$PingFieldAccess.class
Profiler Agent Error: Redefinition failed for classes:
shared.command.PlayerCommandFieldAccess
Profiler Agent Error: with message: Redefinition failed with error 62
Check JVMTI documentation for this error code.
Debug: writing class file: shared.command.PlayerCommandFieldAccess,
into file: shared.command.PlayerCommandFieldAccess.class

Documentation at http://download.oracle.com/javase/6/docs/platform/jvmti/jvmti.html#ErrorSection
stipulate
JVMTI_ERROR_FAILS_VERIFICATION (62)
The class bytes fail verification.

I tried excluding kryo classes and local classes registered with kryo,
but those errors still happen.
I saw on another thread you managed profiling using eclipse. I didn't
try that yet, but i thought you migh have an idea of whats going on.

Thank you!

Charly

Nate

unread,
Jan 28, 2011, 2:10:37 AM1/28/11
to kryone...@googlegroups.com
Hi Charly,

Sounds cool, would love to see it when it is done.

I was able to repro the same error by attaching jvisualvm to my app running in Eclipse. As a workaround, start your VM with:
-Xverify:none
This allows profiling to work without error.

I found that when I take specific actions in my reasonably complex app that execution freezes momentarily and I get a bunch of these in the log for various classes:

*** Profiler engine warning: target VM cannot load class to instrument com.example.XxxFieldAccess
*** probably it has been unloaded recently
*** Profiler engine warning: class com.example.XxxFieldAccess that should be instrumented is not loaded by target VM
*** Requested classloader: null, its index = 70
*** Profiler engine warning: target VM cannot load class to instrument com.example.XxxFieldAccess
*** probably it has been unloaded recently

Not sure what the deal is. It seems VisualVM doesn't like the bytecode generation done in ReflectASM. Since ReflectASM is working well and there is a workaround for the JVMTI error, I hesitate to mess with it further. It is somewhat difficult to test ReflectASM in various classloader configurations, many (all?) of which the current code currently handles. However, if we ever do mess with ReflectASM, I have since learned it would be cleaner to use ObjectWeb ASM's GeneratorAdapter (which can handle boxing) rather than MethodVisitor.

-Nate



--
You received this message because you are subscribed to the "kryonet-users" group.
http://groups.google.com/group/kryonet-users

Reply all
Reply to author
Forward
0 new messages