Skip to content

Fix crash under -Xaot: #22166

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

Merged
merged 1 commit into from
Jul 8, 2025
Merged

Fix crash under -Xaot: #22166

merged 1 commit into from
Jul 8, 2025

Conversation

dsouzai
Copy link
Contributor

@dsouzai dsouzai commented Jun 30, 2025

When running with -Xjit: (i.e., not -Xjit but -Xjit: which has the colon followed by an empty string), the JVM prints out an error message and terminates. However, when running with -Xaot: the error message is printed out but then the JVM crashes. This happens because there is a call to codert_onload between initializing the compiler args for -Xjit and -Xaot.

This PR fixes this by invoking codert_onload after initializing both -Xjit and -Xaot. This is ok because the initization does not actually process the options. Rather, it sets the value of a pointer to point to the compiler args. Thus, calling codert_onload after initializing both is safe because the initialization does not depend on any initialization that codert_onload performs.

Fixes #20601

When running with -Xjit: (i.e., not -Xjit but -Xjit: which has the
colon followed by an empty string), the JVM prints out an error
message and terminates. However, when running with -Xaot: the error
message is printed out but then the JVM crashes. This happens because
there is a call to codert_onload between initializing the compiler args
for -Xjit and -Xaot.

This commit fixes this by invoking codert_onload after initializing both
-Xjit and -Xaot. This is ok because the initization does not actually
process the options. Rather, it sets the value of a pointer to point to
the compiler args. Thus, calling codert_onload after initializing both
is safe because the initialization does not depend on any initialization
that codert_onload performs.

Signed-off-by: Irwin D'Souza <[email protected]>
@dsouzai
Copy link
Contributor Author

dsouzai commented Jun 30, 2025

@hzongaro could you review/merge?

@hzongaro hzongaro self-assigned this Jul 4, 2025
Copy link
Member

@hzongaro hzongaro left a comment

Choose a reason for hiding this comment

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

Looks good. Thanks!

@hzongaro
Copy link
Member

hzongaro commented Jul 5, 2025

I'm not sure what will happen if I run sanity.functional once with and once without aot. Giving it whirl. . . .

Jenkins test sanity.functional,sanity.functional+aot all jdk8,jdk17,jdk21

@hzongaro
Copy link
Member

hzongaro commented Jul 6, 2025

It looks like some testing was aborted. Restarting those runs:

Jenkins test sanity.functional+aot zlinux,win,win32 jdk8

@hzongaro
Copy link
Member

hzongaro commented Jul 6, 2025

Jenkins test sanity.functional+aot aix,plinux jdk17,jdk21

@hzongaro
Copy link
Member

hzongaro commented Jul 6, 2025

Jenkins test sanity.functional+aot zlinux jdk21

@dsouzai
Copy link
Contributor Author

dsouzai commented Jul 7, 2025

alinux and xmac failures are crashes in jfr tests, but they are run with -Xint, so the forceAOT option set in the TR_OptionsAOT env var does not take into effect.

Two of the aix failures are due to #17396

One aix failure is due to #21601

The last aix failure is

[2025-07-06T22:09:53.588Z] +++ j9vm.test.threadinterrupt.scenario7Test: +++
[2025-07-06T22:09:53.588Z] command: /home/jenkins/workspace/Test_openjdk21_j9_sanity.functional_ppc64_aix_Personal_testList_0/jdkbinary/j2sdk-image/bin/java -Xshareclasses:name=test_aot -Xscmx400M -Xscmaxaot256m  -Xjit -Xgcpolicy:gencon -Xnocompressedrefs  -Xdump -Xms64m -Xmx64m -classpath /home/jenkins/workspace/Test_openjdk21_j9_sanity.functional_ppc64_aix_Personal_testList_0/aqa-tests/TKG/../../jvmtest/functional/VM_Test/VM_Test.jar:/home/jenkins/workspace/Test_openjdk21_j9_sanity.functional_ppc64_aix_Personal_testList_0/../../testDependency/lib/asm-all.jar j9vm.test.threadinterrupt.scenario7Test 
[2025-07-06T22:09:53.588Z] 
[2025-07-06T22:09:53.846Z] main  waiting
[2025-07-06T22:09:58.021Z] inter syncing on a
[2025-07-06T22:09:58.021Z] inter synced on a
[2025-07-06T22:09:58.021Z] inter notifying main
[2025-07-06T22:09:58.021Z] inter done notifying a
[2025-07-06T22:09:58.021Z] inter interrupting main
[2025-07-06T22:09:58.021Z] inter done interrupting main
[2025-07-06T22:09:58.021Z] noti syncing on a
[2025-07-06T22:09:58.021Z] noti synced on a
[2025-07-06T22:09:58.021Z] noti waiting on a
[2025-07-06T22:09:58.585Z] main  done waiting
[2025-07-06T22:09:58.585Z] SUCCESS
[2025-07-06T22:09:59.150Z] Thread[#32,Thread-0,5,main] (interrupter) is done
[2025-07-07T06:59:27.547Z] Cancelling nested steps due to timeout
[2025-07-07T06:59:27.575Z] Sending interrupt signal to process
[2025-07-07T06:59:28.014Z] non-zero exit value: 143
[2025-07-07T06:59:28.014Z] *** Test FAILED *** (j9vm.test.threadinterrupt.scenario7Test)

I can't find an existing issue, but given that there is no -Xaot flag set on this test, I don't think this change is responsible for this.

@hzongaro
Copy link
Member

hzongaro commented Jul 8, 2025

Thanks for investigating the failures, @dsouzai! As the failures all appear to be unrelated to this change, and the change itself appears to be relatively safe, I will go ahead and merge.

@hzongaro hzongaro merged commit e370a06 into eclipse-openj9:master Jul 8, 2025
45 of 51 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Running java -Xaot: causes abort
2 participants