Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
6.0M1, 5.0M13
-
None
-
None
-
Microsoft Windows Server 2008 (32bit) [Version 6.0.6001]
Description
GetTag(), a JVMTI function, returns JVMTI_ERROR_INVALID_OBJECT when it is invoked for the return_value of MethodExit handler. I'm sorry not to provide a short program that reproduces this problem, but here's the description. My program, so-called an agent, attached to java.exe through JVMTI listens to MethodExit (and several other) events. The MethodExit handler looks like the following:
static void JNICALL
handle_methodexit(jvmtiEnv *jvmti, JNIEnv *env, jthread thread, jmethodID method, jboolean was_popped_by_exception, jvalue return_value)
{
if (!was_popped_by_exception) {
// analyze the signature of the "method" to figure out the type of the returning value
if the returning value is of Object type {
if (return_value.l)
}
}
}
GetTag() works fine for the first event, but it returns an error at the second event. One thing I am little bit suspicious is that "return_value.l" of the second event is totally different than that of the first event.
- 1st event: 0012F3AC
- 2nd event: 13AA05F0
Given that jobject is a pointer, that huge difference may mean that one of them may point a wrong address, although I'm not sure. The second event was raised when loadClass (Ljava/lang/String;Z)Ljava/lang/Class; of Ljava/lang/ClassLoader; returns. This problem occurs both in 5 and 6.
My agent was compiled using Microsoft Visual Studio 2010 in C++. For this kind of error, I know that the first thing I need to suspect is my own program, as my program can corrupt the heap and cause DRLVM to fail. I cannot guarantee that my program is memory error-free, but it seems fine because my agent didn't introduce any memory-related errors when it was attached to Sun Java 6. Currently, I stopped using Sun Java 6 because its JVMTI has another problem.