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

Support transition to debug interpreter on restore #18833

Merged
merged 1 commit into from
Mar 11, 2024

Conversation

singh264
Copy link
Contributor

@singh264 singh264 commented Jan 26, 2024

Support transition to debug interpreter on restore when
the transition is requested with an env var file or an
options file.

Issue: #17642
Co-authored-by: Tobi Ajila [email protected]
Signed-off-by: Amarpreet Singh [email protected]

@singh264
Copy link
Contributor Author

singh264 commented Jan 26, 2024

@tajila requesting your input on the following questions:

  1. How can the current interpreter be exited properly before entering the debug interpreter?
  2. Is there any setup missing that should be added for c_cInterpreter in debugInterpreterTransition?
  3. Should jvmCheckpointHooks enter the debug interpreter when a debug option is provided?

When indicateAsyncMessagePending is not included in javaCheckAsyncMessages, I observe that:

  • The checkpoint thread does not enter the debug interpreter for jvmCheckpointHooks.
  • The restored java threads enter the debug interpreter.

@tajila
Copy link
Contributor

tajila commented Feb 21, 2024

How can the current interpreter be exited properly before entering the debug interpreter?

We've recently added some code in the interpreter entry that checks the bytecodeloop on re-enter exits. See #18903

The way to trigger this is to call VM_VMHelpers::requestInterpreterReentry(targetThread) on each thread. This encapsulates all the requirements that I had given you. So you dont need to worry about any async or interpreter changes anymore

@singh264 singh264 marked this pull request as ready for review February 26, 2024 18:45
@singh264 singh264 marked this pull request as draft February 26, 2024 18:45
@singh264 singh264 force-pushed the openj9_issues_17642 branch 2 times, most recently from f0ee639 to 9b12df0 Compare February 26, 2024 18:53
@singh264
Copy link
Contributor Author

@tajila requesting your review.

@singh264 singh264 marked this pull request as ready for review February 26, 2024 18:55
Copy link
Contributor

@tajila tajila left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you'll need to do a manual test in gdb to verify that we actually enter the debug interpreter.

The following step will be to remove the criu interpreter, but we will need the JIT changes to be completed first.

runtime/vm/CRIUHelpers.cpp Outdated Show resolved Hide resolved
runtime/vm/CRIUHelpers.cpp Outdated Show resolved Hide resolved
@singh264 singh264 force-pushed the openj9_issues_17642 branch 2 times, most recently from 007e6ac to 5acaf0b Compare February 28, 2024 14:38
@singh264
Copy link
Contributor Author

you'll need to do a manual test in gdb to verify that we actually enter the debug interpreter.

The native callstack for code that is at Thread.sleep after restore indicates that we enter the debug interpreter.

Thread 2 (Thread 0x7f37b9d01700 (LWP 1189748)):
#0  0x00007f37b9d277d1 in pthread_cond_timedwait@@GLIBC_2.3.2 () from /lib/x86_64-linux-gnu/libpthread.so.0
#1  0x00007f37b998eb69 in omrthread_sleep_interruptable (millis=millis@entry=120000, nanos=nanos@entry=0) at /root/openj9_issues_17642/openj9-openjdk-jdk21/omr/thread/common/omrthread.c:2382
#2  0x00007f37b9a3053c in timeCompensationHelper (vmThread=vmThread@entry=0x1aa00, threadHelperType=threadHelperType@entry=4 '\004', monitor=monitor@entry=0x0, millis=millis@entry=120000, nanos=nanos@entry=0) at /root/openj9_issues_17642/openj9-openjdk-jdk21/openj9/runtime/vm/threadhelp.cpp:448
#3  0x00007f37b9a30a7c in threadSleepImpl (vmThread=0x1aa00, millis=120000, nanos=0) at /root/openj9_issues_17642/openj9-openjdk-jdk21/openj9/runtime/vm/threadhelp.cpp:171
#4  0x00007f37b9aafe30 in VM_DebugBytecodeInterpreterCompressed::inlThreadSleep (_pc=<synthetic pointer>: 0x3 <error: Cannot access memory at address 0x3>, _sp=<synthetic pointer>: <optimized out>, this=0x7f37b9d002d0) at /root/openj9_issues_17642/openj9-openjdk-jdk21/openj9/runtime/vm/BytecodeInterpreter.hpp:4994
#5  VM_DebugBytecodeInterpreterCompressed::run (this=this@entry=0x7f37b9d00800, vmThread=<optimized out>) at /root/openj9_issues_17642/openj9-openjdk-jdk21/openj9/runtime/vm/BytecodeInterpreter.hpp:11066
#6  0x00007f37b9a99af5 in debugBytecodeLoopCompressed (currentThread=<optimized out>) at /root/openj9_issues_17642/openj9-openjdk-jdk21/openj9/runtime/vm/BytecodeInterpreter.inc:112
#7  0x00007f37b9b60c12 in c_cInterpreter () at /root/openj9_issues_17642/openj9-openjdk-jdk21/build/linux-x86_64-server-release/vm/runtime/vm/xcinterp.s:158
#8  0x00007f37b99cadb3 in runCallInMethod (env=0x1aa00, receiver=<optimized out>, clazz=0x147540, methodID=0x7c015a33, args=0x7f37b9d00d88) at /root/openj9_issues_17642/openj9-openjdk-jdk21/openj9/runtime/vm/callin.cpp:1174
#9  0x00007f37b99edd9d in gpProtectedRunCallInMethod (entryArg=0x7f37b9d00d40) at /root/openj9_issues_17642/openj9-openjdk-jdk21/openj9/runtime/vm/jnicsup.cpp:300
#10 0x00007f37b97de251 in omrsig_protect (portLibrary=0x7f37b9c7d420 <j9portLibrary>, fn=0x7f37b9b6bf70 <signalProtectAndRunGlue>, fn_arg=0x7f37b9d00d00, handler=0x7f37b99ea9f0 <structuredSignalHandler>, handler_arg=0x1aa00, flags=506, result=0x7f37b9d00cf8) at /root/openj9_issues_17642/openj9-openjdk-jdk21/omr/port/unix/omrsignal.c:425
#11 0x00007f37b9b6c010 in gpProtectAndRun (function=0x7f37b99edd60 <gpProtectedRunCallInMethod(void*)>, env=0x1aa00, args=0x7f37b9d00d40) at /root/openj9_issues_17642/openj9-openjdk-jdk21/openj9/runtime/util/jniprotect.c:78
#12 0x00007f37b99ef862 in gpCheckCallin (env=0x1aa00, receiver=receiver@entry=0x0, cls=<optimized out>, methodID=<optimized out>, args=args@entry=0x7f37b9d00d88) at /root/openj9_issues_17642/openj9-openjdk-jdk21/openj9/runtime/vm/jnicsup.cpp:488
#13 0x00007f37b99ed6b4 in callStaticVoidMethod (env=<optimized out>, cls=<optimized out>, methodID=<optimized out>) at /root/openj9_issues_17642/openj9-openjdk-jdk21/openj9/runtime/vm/jnicgen.c:384
#14 0x00007f37b9f5ed92 in JavaMain (_args=<optimized out>) at src/java.base/share/native/libjli/java.c:628
#15 0x00007f37b9f61e3d in ThreadJavaMain (args=<optimized out>) at src/java.base/unix/native/libjli/java_md.c:699
#16 0x00007f37b9d20609 in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
#17 0x00007f37b9e7c353 in clone () from /lib/x86_64-linux-gnu/libc.so.6

@singh264
Copy link
Contributor Author

singh264 commented Feb 28, 2024

The line endings check failed due to ERROR: Error fetching remote repo 'origin'.

@singh264
Copy link
Contributor Author

@tajila re-requesting your review.

runtime/vm/CRIUHelpers.cpp Outdated Show resolved Hide resolved
@singh264
Copy link
Contributor Author

@tajila re-requesting your review.

runtime/vm/CRIUHelpers.cpp Outdated Show resolved Hide resolved
@singh264 singh264 force-pushed the openj9_issues_17642 branch 2 times, most recently from ea75288 to 7032157 Compare March 5, 2024 17:11
@singh264
Copy link
Contributor Author

singh264 commented Mar 5, 2024

@tajila re-requesting your review.

Support transition to debug interpreter on restore when
the transition is requested with an env var file or an
options file.

Issue: eclipse-openj9#17642
Co-authored-by: Tobi Ajila <[email protected]>
Signed-off-by: Amarpreet Singh <[email protected]>
@tajila
Copy link
Contributor

tajila commented Mar 5, 2024

jenkins test sanity alinux jdk21

@tajila
Copy link
Contributor

tajila commented Mar 5, 2024

jenkins test sanity xlinux jdk17

@tajila
Copy link
Contributor

tajila commented Mar 5, 2024

jenkins test sanity win jdk8

@singh264
Copy link
Contributor Author

singh264 commented Mar 6, 2024

jenkins test sanity xlinux jdk17

The x86-64 linux build failure seems to be due to machine setup during criu restore.

17:10:16   [OUT] initiate restore
17:10:16   [OUT] pie: 31483: Error (criu/pie/restorer.c:1839): prctl failed @1839 with -1
17:10:16   [OUT] pie: 31483: Error (criu/pie/restorer.c:1840): prctl failed @1840 with -1
17:10:16   [OUT] pie: 31483: Error (criu/pie/restorer.c:1841): prctl failed @1841 with -1
17:10:16   [OUT] pie: 31483: Error (criu/pie/restorer.c:1842): prctl failed @1842 with -1
17:10:16   [OUT] pie: 31483: Error (criu/pie/restorer.c:1843): prctl failed @1843 with -1
17:10:16   [OUT] pie: 31483: Error (criu/pie/restorer.c:1844): prctl failed @1844 with -1
17:10:16   [OUT] pie: 31483: Error (criu/pie/restorer.c:1845): prctl failed @1845 with -1
17:10:16   [OUT] pie: 31483: Error (criu/pie/restorer.c:1846): prctl failed @1846 with -1
17:10:16   [OUT] pie: 31483: Error (criu/pie/restorer.c:1847): prctl failed @1847 with -1
17:10:16   [OUT] pie: 31483: Error (criu/pie/restorer.c:1848): prctl failed @1848 with -1
17:10:16   [OUT] pie: 31483: Error (criu/pie/restorer.c:1849): prctl failed @1849 with -1
17:10:16   [OUT] pie: 31483: Error (criu/pie/restorer.c:1850): prctl failed @1850 with -1
17:10:16   [OUT] pie: 31483: Error (criu/pie/restorer.c:777): prctl failed @777 with -1
17:10:16   [OUT] pie: 31483: Error (criu/pie/restorer.c:779): Can't restore EXE link (-1)
17:10:16   [OUT] pie: 31483: Error (criu/pie/restorer.c:2102): Restorer fail 31483
17:10:16   [OUT] Error (criu/cr-restore.c:2547): Restoring FAILED.
17:10:16   [OUT] Removed test output files
17:10:16   [OUT] finished script

@tajila tajila merged commit dba65ba into eclipse-openj9:master Mar 11, 2024
7 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants