Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[JDK19] JVMTI framepop02.java#id1 and singlestep01 Segfault #16229

Closed
babsingh opened this issue Oct 31, 2022 · 4 comments · Fixed by #16323
Closed

[JDK19] JVMTI framepop02.java#id1 and singlestep01 Segfault #16229

babsingh opened this issue Oct 31, 2022 · 4 comments · Fixed by #16323
Assignees
Labels
comp:jvmti comp:vm jdk19 project:loom Used to track Project Loom related work
Milestone

Comments

@babsingh
Copy link
Contributor

babsingh commented Oct 31, 2022

framepop02/framepop02.java#id1 and SingleStep/singlestep01 pass with the RI. These tests are related to Project Loom. The test failures will only be seen in JDK19+.

Related: #16187.

Issue

There is a recursive infinite loop. The test registers a JVMTI event callback for MethodEntry, and invokes jvmtiGetThreadInfo from the MethodEntry event callback. jvmtiGetThreadInfo loads the java/lang/Thread$Constants class for the virtual thread path. While loading this class, the MethodEntry event callback is invoked again. Then, we are stuck in an infinite loop: MethodEntry event callback -> jvmtiGetThreadInfo -> MethodEntry event callback -> jvmtiGetThreadInfo.

A similar recursive infinite loop is seen in SingleStep/singlestep01: SingleStep event callback -> jvmtiGetThreadInfo -> SingleStep event callback -> jvmtiGetThreadInfo.

To resolve this issue, I tried adding java/lang/Thread$Constants to the requiredClasses array in jclcinit.c. But java/lang/Thread$Constants has a static init block which fails to successfully execute at startup: Thread.java#L3037-L3065.

Test CMD

# FramePop/framepop02
make test TEST="jtreg:test/hotspot/jtreg/serviceability/jvmti/events/FramePop/framepop02" JTREG="JAVA_OPTIONS=--enable-preview -Dvm.continuations=true;VERBOSE=all"

# SingleStep/singlestep01
make test TEST="jtreg:test/hotspot/jtreg/serviceability/jvmti/events/SingleStep/singlestep01/singlestep01.java" JTREG="JAVA_OPTIONS=--enable-preview -Dvm.continuations=true;VERBOSE=all"

Test Output

Builder: java.lang.ThreadBuilders$VirtualThreadBuilder@9ffc73c6
Segmentation fault (core dumped)

GDB Native Stack

#1246 MethodEntry (jvmti=jvmti@entry=0x7ffbc80a5b88, jni=jni@entry=0x26c300, thr=0x288860, method=method@entry=0x7ffb38009710)
    at test/hotspot/jtreg/serviceability/jvmti/events/FramePop/framepop02/libframepop02.cpp:181
#1247 0x00007ffbc50d7ad2 in jvmtiHookMethodEnter (hook=hook@entry=0x7ffbc8018580, eventNum=eventNum@entry=23, eventData=eventData@entry=0x7ffbaa4edf70, userData=userData@entry=0x7ffbc80a5b88)
--Type <RET> for more, q to quit, c to continue without paging--
    at /root/openj9-openjdk-jdk/openj9/runtime/jvmti/jvmtiHook.c:334
#1248 0x00007ffbcc36936e in J9HookDispatch (hookInterface=0x7ffbc8018580, taggedEventNum=<optimized out>, eventData=0x7ffbaa4edf70) at /root/openj9-openjdk-jdk/omr/util/hookable/hookable.cpp:235
#1249 0x00007ffbcc865f4d in VM_DebugBytecodeInterpreterCompressed::reportMethodEnter (_pc=<synthetic pointer>: <optimized out>, _sp=<synthetic pointer>: <optimized out>, this=0x7ffbaa4ee1e0)
    at /root/openj9-openjdk-jdk/openj9/runtime/vm/BytecodeInterpreter.hpp:1635
#1250 VM_DebugBytecodeInterpreterCompressed::run (this=this@entry=0x7ffbaa4ee1e0, vmThread=<optimized out>) at /root/openj9-openjdk-jdk/openj9/runtime/vm/BytecodeInterpreter.hpp:10304
#1251 0x00007ffbcc864835 in debugBytecodeLoopCompressed (currentThread=<optimized out>) at /root/openj9-openjdk-jdk/openj9/runtime/vm/BytecodeInterpreter.inc:112
#1252 0x00007ffbcc8cbfc2 in c_cInterpreter () at /root/openj9-openjdk-jdk/build/linux-x86_64-server-release/vm/runtime/vm/xcinterp.s:158
#1253 0x00007ffbcc7a411d in sendLoadClass (currentThread=0x7ffbaa4ee320, currentThread@entry=0x26c300, classLoaderObject=0xc15e07e8, classNameObject=0xffe5ce28)
    at /root/openj9-openjdk-jdk/openj9/runtime/vm/callin.cpp:467
#1254 0x00007ffbcc7afc7d in callLoadClass (classNotFoundException=<synthetic pointer>, classLoader=0x7ffbc80a18b8, classNameLength=26, className=0x7ffbc510ab12 "java/lang/Thread$Constants",
    vmThread=0x26c300) at /root/openj9-openjdk-jdk/openj9/runtime/vm/classsupport.c:703
#1255 arbitratedLoadClass (classNotFoundException=<synthetic pointer>, classLoader=0x7ffbc80a18b8, classNameLength=26, className=0x7ffbc510ab12 "java/lang/Thread$Constants", vmThread=0x26c300)
    at /root/openj9-openjdk-jdk/openj9/runtime/vm/classsupport.c:904
#1256 loadNonArrayClass (exception=<synthetic pointer>, options=1, classLoader=0x7ffbc80a18b8, classNameLength=26, className=0x7ffbc510ab12 "java/lang/Thread$Constants", j9module=0x0, vmThread=0x26c300)
    at /root/openj9-openjdk-jdk/openj9/runtime/vm/classsupport.c:1103
#1257 internalFindClassInModule (vmThread=vmThread@entry=0x26c300, j9module=j9module@entry=0x0, className=0x7ffbc510ab12 "java/lang/Thread$Constants", classNameLength=classNameLength@entry=26,
    classLoader=classLoader@entry=0x7ffbc80a18b8, options=options@entry=1) at /root/openj9-openjdk-jdk/openj9/runtime/vm/classsupport.c:1148
#1258 0x00007ffbcc7b2503 in internalFindClassUTF8 (vmThread=vmThread@entry=0x26c300, className=<optimized out>, classNameLength=classNameLength@entry=26, classLoader=classLoader@entry=0x7ffbc80a18b8,
    options=options@entry=1) at /root/openj9-openjdk-jdk/openj9/runtime/vm/classsupport.c:1125
#1259 0x00007ffbcc7d67f5 in findClass (env=0x26c300, name=0x7ffbc510ab12 "java/lang/Thread$Constants") at /root/openj9-openjdk-jdk/openj9/runtime/vm/jnimisc.cpp:520
#1260 0x00007ffbcc7cc180 in gpCheckFindClass (env=<optimized out>, name=<optimized out>) at /root/openj9-openjdk-jdk/openj9/runtime/vm/jnicsup.cpp:335
#1261 0x00007ffbc50e913d in jvmtiGetThreadInfo (env=<optimized out>, thread=0x288910, info_ptr=0x7ffbaa4ee720) at /root/openj9-openjdk-jdk/openj9/runtime/jvmti/jvmtiThread.c:533
#1262 0x00007ffba81e1788 in _jvmtiEnv::GetThreadInfo (info_ptr=0x7ffbaa4ee720, thread=0x288910, this=0x7ffbc80a5b88) at build/linux-x86_64-server-release/support/modules_include/java.base/jvmti.h:1189
#1263 isTestThread (thr=0x288910, jvmti=0x7ffbc80a5b88, jni=0x26c300) at test/hotspot/jtreg/serviceability/jvmti/events/FramePop/framepop02/libframepop02.cpp:75
#1264 MethodEntry (jvmti=jvmti@entry=0x7ffbc80a5b88, jni=jni@entry=0x26c300, thr=0x288910, method=method@entry=0x7ffb38009710)
    at test/hotspot/jtreg/serviceability/jvmti/events/FramePop/framepop02/libframepop02.cpp:181
#1265 0x00007ffbc50d7ad2 in jvmtiHookMethodEnter (hook=hook@entry=0x7ffbc8018580, eventNum=eventNum@entry=23, eventData=eventData@entry=0x7ffbaa4eeb30, userData=userData@entry=0x7ffbc80a5b88)
    at /root/openj9-openjdk-jdk/openj9/runtime/jvmti/jvmtiHook.c:334
#1266 0x00007ffbcc36936e in J9HookDispatch (hookInterface=0x7ffbc8018580, taggedEventNum=<optimized out>, eventData=0x7ffbaa4eeb30) at /root/openj9-openjdk-jdk/omr/util/hookable/hookable.cpp:235
#1267 0x00007ffbcc865f4d in VM_DebugBytecodeInterpreterCompressed::reportMethodEnter (_pc=<synthetic pointer>: <optimized out>, _sp=<synthetic pointer>: <optimized out>, this=0x7ffbaa4eeda0)
    at /root/openj9-openjdk-jdk/openj9/runtime/vm/BytecodeInterpreter.hpp:1635
#1268 VM_DebugBytecodeInterpreterCompressed::run (this=this@entry=0x7ffbaa4eeda0, vmThread=<optimized out>) at /root/openj9-openjdk-jdk/openj9/runtime/vm/BytecodeInterpreter.hpp:10304
#1269 0x00007ffbcc864835 in debugBytecodeLoopCompressed (currentThread=<optimized out>) at /root/openj9-openjdk-jdk/openj9/runtime/vm/BytecodeInterpreter.inc:112
#1270 0x00007ffbcc8cbfc2 in c_cInterpreter () at /root/openj9-openjdk-jdk/build/linux-x86_64-server-release/vm/runtime/vm/xcinterp.s:158
#1271 0x00007ffbcc7a411d in sendLoadClass (currentThread=0x7ffbaa4eeee0, currentThread@entry=0x26c300, classLoaderObject=0xc15e07e8, classNameObject=0xffe5cdc8)
    at /root/openj9-openjdk-jdk/openj9/runtime/vm/callin.cpp:467
#1272 0x00007ffbcc7afc7d in callLoadClass (classNotFoundException=<synthetic pointer>, classLoader=0x7ffbc80a18b8, classNameLength=26, className=0x7ffbc510ab12 "java/lang/Thread$Constants",
    vmThread=0x26c300) at /root/openj9-openjdk-jdk/openj9/runtime/vm/classsupport.c:703
#1273 arbitratedLoadClass (classNotFoundException=<synthetic pointer>, classLoader=0x7ffbc80a18b8, classNameLength=26, className=0x7ffbc510ab12 "java/lang/Thread$Constants", vmThread=0x26c300)
    at /root/openj9-openjdk-jdk/openj9/runtime/vm/classsupport.c:904
#1274 loadNonArrayClass (exception=<synthetic pointer>, options=1, classLoader=0x7ffbc80a18b8, classNameLength=26, className=0x7ffbc510ab12 "java/lang/Thread$Constants", j9module=0x0, vmThread=0x26c300)
    at /root/openj9-openjdk-jdk/openj9/runtime/vm/classsupport.c:1103
#1275 internalFindClassInModule (vmThread=vmThread@entry=0x26c300, j9module=j9module@entry=0x0, className=0x7ffbc510ab12 "java/lang/Thread$Constants", classNameLength=classNameLength@entry=26,
    classLoader=classLoader@entry=0x7ffbc80a18b8, options=options@entry=1) at /root/openj9-openjdk-jdk/openj9/runtime/vm/classsupport.c:1148
#1276 0x00007ffbcc7b2503 in internalFindClassUTF8 (vmThread=vmThread@entry=0x26c300, className=<optimized out>, classNameLength=classNameLength@entry=26, classLoader=classLoader@entry=0x7ffbc80a18b8,
    options=options@entry=1) at /root/openj9-openjdk-jdk/openj9/runtime/vm/classsupport.c:1125
#1277 0x00007ffbcc7d67f5 in findClass (env=0x26c300, name=0x7ffbc510ab12 "java/lang/Thread$Constants") at /root/openj9-openjdk-jdk/openj9/runtime/vm/jnimisc.cpp:520
#1278 0x00007ffbcc7cc180 in gpCheckFindClass (env=<optimized out>, name=<optimized out>) at /root/openj9-openjdk-jdk/openj9/runtime/vm/jnicsup.cpp:335
#1279 0x00007ffbc50e913d in jvmtiGetThreadInfo (env=<optimized out>, thread=0x2889c0, info_ptr=0x7ffbaa4ef2e0) at /root/openj9-openjdk-jdk/openj9/runtime/jvmti/jvmtiThread.c:533
#1280 0x00007ffba81e1788 in _jvmtiEnv::GetThreadInfo (info_ptr=0x7ffbaa4ef2e0, thread=0x2889c0, this=0x7ffbc80a5b88) at build/linux-x86_64-server-release/support/modules_include/java.base/jvmti.h:1189
#1281 isTestThread (thr=0x2889c0, jvmti=0x7ffbc80a5b88, jni=0x26c300) at test/hotspot/jtreg/serviceability/jvmti/events/FramePop/framepop02/libframepop02.cpp:75
#1282 MethodEntry (jvmti=jvmti@entry=0x7ffbc80a5b88, jni=jni@entry=0x26c300, thr=0x2889c0, method=method@entry=0x7ffb38009710)
@babsingh babsingh added this to the Java 19 milestone Oct 31, 2022
@babsingh babsingh changed the title JVMTI Serviceability framepop02/framepop02.java#id1 Segfaults [JDK19] JVMTI Serviceability framepop02.java#id1 Segfaults Oct 31, 2022
@babsingh babsingh changed the title [JDK19] JVMTI Serviceability framepop02.java#id1 Segfaults [JDK19] JVMTI Serviceability framepop02.java#id1 and singlestep01 Segfaults Oct 31, 2022
@babsingh babsingh changed the title [JDK19] JVMTI Serviceability framepop02.java#id1 and singlestep01 Segfaults [JDK19] JVMTI Serviceability framepop02.java#id1 and singlestep01 Segfault Oct 31, 2022
@babsingh babsingh changed the title [JDK19] JVMTI Serviceability framepop02.java#id1 and singlestep01 Segfault [JDK19] JVMTI framepop02.java#id1 and singlestep01 Segfault Oct 31, 2022
@pshipton pshipton added the jdk19 label Nov 1, 2022
@tajila tajila added the project:loom Used to track Project Loom related work label Nov 1, 2022
@fengxue-IS
Copy link
Contributor

is it possible for us to put an exclusion from MethodEntry event for all inner classes of j.l.Thread?

@babsingh
Copy link
Contributor Author

babsingh commented Nov 3, 2022

is it possible for us to put an exclusion from MethodEntry event for all inner classes of j.l.Thread?

Not sure. But this failure will be seen with all JVMTI event callbacks since all can invoke jvmtiGetThreadInfo and end up loading java/lang/Thread$Constants.

@tajila
Copy link
Contributor

tajila commented Nov 10, 2022

@babsingh Do you think this will be resolved within 2 weeks?

@babsingh
Copy link
Contributor Author

Do you think this will be resolved within 2 weeks?

@tajila Yes, it will be resolved by the end of next week.

babsingh added a commit to babsingh/openj9 that referenced this issue Nov 15, 2022
Set J9JavaVM->vthreadGroup in stdinit.c::standardInit to remove the
recursive dependency with JVMTI event callbacks, which causes an
infinite loop.

Closes: eclipse-openj9#16229

Signed-off-by: Babneet Singh <sbabneet@ca.ibm.com>
babsingh added a commit to babsingh/aqa-tests that referenced this issue Nov 21, 2022
eclipse-openj9/openj9#16212 was fixed by
1. eclipse-openj9/openj9#16290
2. eclipse-openj9/openj9#16293

eclipse-openj9/openj9#16275 is a duplicate of
eclipse-openj9/openj9#16212.

eclipse-openj9/openj9#16229 was fixed by eclipse-openj9/openj9#16323.

FramePop/framepop02 fails with another issue, which is reported in
eclipse-openj9/openj9#16346.

Signed-off-by: Babneet Singh <sbabneet@ca.ibm.com>
babsingh added a commit to babsingh/aqa-tests that referenced this issue Nov 21, 2022
eclipse-openj9/openj9#16212 was fixed by
1. eclipse-openj9/openj9#16290; and
2. eclipse-openj9/openj9#16293.

eclipse-openj9/openj9#16275 is a duplicate of
eclipse-openj9/openj9#16212.

eclipse-openj9/openj9#16229 was fixed by eclipse-openj9/openj9#16323.

FramePop/framepop02 fails with another issue, which is reported in
eclipse-openj9/openj9#16346.

Signed-off-by: Babneet Singh <sbabneet@ca.ibm.com>
Mesbah-Alam pushed a commit to adoptium/aqa-tests that referenced this issue Nov 22, 2022
eclipse-openj9/openj9#16212 was fixed by
1. eclipse-openj9/openj9#16290; and
2. eclipse-openj9/openj9#16293.

eclipse-openj9/openj9#16275 is a duplicate of
eclipse-openj9/openj9#16212.

eclipse-openj9/openj9#16229 was fixed by eclipse-openj9/openj9#16323.

FramePop/framepop02 fails with another issue, which is reported in
eclipse-openj9/openj9#16346.

Signed-off-by: Babneet Singh <sbabneet@ca.ibm.com>

Signed-off-by: Babneet Singh <sbabneet@ca.ibm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp:jvmti comp:vm jdk19 project:loom Used to track Project Loom related work
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants