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

jdk8 aarch64_alpine-linux test jobs fail due to DETECTED_JDK_VERSION mismatch from available artifact #2934

Closed
smlambert opened this issue Jan 1, 2023 · 36 comments
Assignees

Comments

@smlambert
Copy link
Contributor

smlambert commented Jan 1, 2023

What are you trying to do?
Test jdk8 aarch64_alpine-linux
https://ci.adoptopenjdk.net/job/build-scripts/job/jobs/job/jdk8u/job/jdk8u-alpine-linux-aarch64-temurin/
This fails for both weekly and nightly testing.

07:26:36  make -f makeGen.mk AUTO_DETECT=true MODE=buildList TESTTARGET=sanity.functional TESTLIST=
07:26:36  make[1]: Entering directory '/home/jenkins/workspace/Test_openjdk8_hs_sanity.functional_aarch64_alpine-linux/aqa-tests/TKG'
07:26:36  /home/jenkins/workspace/Test_openjdk8_hs_sanity.functional_aarch64_alpine-linux/aqa-tests/TKG/envSettings.mk:32: *** DETECTED_JDK_VERSION value is 17, settled JDK_VERSION value is 8. JDK_VERSION value does not match. Please reset or unset JDK_VERSION.  Stop.
07:26:36  make[1]: Leaving directory '/home/jenkins/workspace/Test_openjdk8_hs_sanity.functional_aarch64_alpine-linux/aqa-tests/TKG'
07:26:36  make: *** [makefile:80: buildListGen] Error 2

Expected behaviour:
To be able to pick up the jdk8 binaries and run test jobs against them.

Observed behaviour:
When pulling jdk8 binaries, and unpack them, the jdk8 binaries unpack as jdk17 binaries.

Any other comments:
Same problem seen on related: adoptium/ci-jenkins-pipelines#508

All test jobs fail consistently, and these failures tank the Test job rating (published to Slack). We do not release jdk8 aarch64-alpine-linux formally, so also believe these should be moved to the evaluation pipeline (related: adoptium/ci-jenkins-pipelines#520).

Pulling the jdk binary directly from https://github.com/adoptium/temurin8-binaries/releases/download/jdk8u-2022-12-31-05-54-beta/OpenJDK8U-jdk_aarch64_alpine-linux_hotspot_2022-12-31-05-54.tar.gz and running a test in https://ci.adoptopenjdk.net/job/Grinder/6292 indicates that the binary is not unpacked to openjdkbinary/j2sdk-image/ folder in an expected location.

11:28:48  _ENCODE_FILE_NEW=UNTAGGED curl -OLJSks --user ****:**** https://github.com/adoptium/temurin8-binaries/releases/download/jdk8u-2022-12-31-05-54-beta/OpenJDK8U-jdk_aarch64_alpine-linux_hotspot_2022-12-31-05-54.tar.gz
11:28:54  Uncompressing file: OpenJDK8U-jdk_aarch64_alpine-linux_hotspot_2022-12-31-05-54.tar.gz ...
11:28:56  Run /home/jenkins/workspace/Grinder/openjdkbinary/j2sdk-image/bin/java -version
11:28:56  =JAVA VERSION OUTPUT BEGIN=
11:28:56  ./get.sh: line 632: /home/jenkins/workspace/Grinder/openjdkbinary/j2sdk-image/bin/java: No such file or directory
[Pipeline] }

Need to determine if this issue is a problem in test or build pipeline code, but also should raise a separate issue to remove jdk8 aarch64_alpine-linux from mainstream pipelines since its not a platform/version combo that we release.

@zdtsw
Copy link
Contributor

zdtsw commented Jan 2, 2023

try to reproduce this error:
running on alpine:latest docker container on my M1 macOS,
download tarball from https://github.com/adoptium/temurin8-binaries/releases/download/jdk8u-2022-12-31-05-54-beta/OpenJDK8U-jdk_aarch64_alpine-linux_hotspot_2022-12-31-05-54.tar.gz
unpacked and runs jdk8u362-b07/bin/java -version
got correct return version number

@zdtsw
Copy link
Contributor

zdtsw commented Jan 2, 2023

run grinder:

  1. re-run https://ci.adoptopenjdk.net/job/Grinder/629/console but with debug info from my branch:
 15:09:47  Uncompressing file: OpenJDK8U-jdk_aarch64_alpine-linux_hotspot_2022-12-31-05-54.tar.gz ...
15:09:47  Run /home/jenkins/workspace/Grinder/openjdkbinary/j2sdk-image/bin/java -version
15:09:47  -rwxr-xr-x 1 jenkins jenkins 8576 Dec 30 18:16 /home/jenkins/workspace/Grinder/openjdkbinary/j2sdk-image/bin/java
15:09:47  =JAVA VERSION OUTPUT BEGIN=
15:09:47  ./get.sh: line 633: /home/jenkins/workspace/Grinder/openjdkbinary/j2sdk-image/bin/java: No such file or directory

file does exist
2. re-run grinder but on a different jenkins agent: https://ci.adoptopenjdk.net/job/Grinder/6294/console

Uncompressing file: OpenJDK8U-jdk_aarch64_alpine-linux_hotspot_2022-12-31-05-54.tar.gz ...
15:27:58  Run /home/jenkins/workspace/Grinder/openjdkbinary/j2sdk-image/bin/java -version
15:27:58  -rwxr-xr-x    1 jenkins  jenkins       8576 Dec 30 18:16 /home/jenkins/workspace/Grinder/openjdkbinary/j2sdk-image/bin/java
15:27:58  =JAVA VERSION OUTPUT BEGIN=
15:27:58  openjdk version "17.0.6-beta" 2023-01-17
15:27:58  OpenJDK Runtime Environment Temurin-17.0.6+6-202212132332 (build 17.0.6-beta+6-202212132332)
15:27:58  OpenJDK 64-Bit Server VM Temurin-17.0.6+6-202212132332 (build 17.0.6-beta+6-202212132332, mixed mode, sharing)
15:27:58  =JAVA VERSION OUTPUT END=

no problem to run "java --version" => previous error of "file not exists" is node related
showing wrong java version => same as what we saw from nightly test.

@smlambert
Copy link
Contributor Author

smlambert commented Jan 2, 2023

hi @zdtsw - re: #2934, in your container, can you try unpacking a nightly/beta build (not a release build), and check the version? https://github.com/adoptium/temurin8-binaries/releases/download/jdk8u-2022-12-31-05-54-beta/OpenJDK8U-jdk_aarch64_alpine-linux_hotspot_2022-12-31-05-54.tar.gz

Wondering if it's a packaging problem, seems at least temporarily, that the artifacts labeled with '8' are actually '17'. (see also @sophia-guo 's notes on the x86_alpine-linux similar issue: adoptium/ci-jenkins-pipelines#508).

@zdtsw
Copy link
Contributor

zdtsw commented Jan 2, 2023

hi @zdtsw - re: #553 (comment), in your container, can you try unpacking a nightly/beta build (not a release build), and check the version? https://github.com/adoptium/temurin8-binaries/releases/download/jdk8u-2022-12-31-05-54-beta/OpenJDK8U-jdk_aarch64_alpine-linux_hotspot_2022-12-31-05-54.tar.gz

Wondering if it's a packaging problem, seems at least temporarily, that the artifacts labeled with '8' are actually '17'. (see also @sophia-guo 's notes on the x86_alpine-linux similar issue: adoptium/ci-jenkins-pipelines#508).

tried with https://github.com/adoptium/temurin8-binaries/releases/download/jdk8u-2022-12-31-05-54-beta/OpenJDK8U-jdk_aarch64_alpine-linux_hotspot_2022-12-31-05-54.tar.gz nightly build from 2 days ago,
still prints correct java version info 1.8.0_362-beta

@zdtsw
Copy link
Contributor

zdtsw commented Jan 3, 2023

i still cannot reproduce this locally:
keep the workspace by using flag KEEP_WORKSPACE to re-run in grinder on the jenkins agent which shows wrong result of "java -version" https://ci.adoptopenjdk.net/job/Grinder/6297/console
went to workspace and download openjdkbinary/OpenJDK8U-jdk_aarch64_alpine-linux-hostspot_2022-12-31-05-54.tar.gz
put the tarball into local alpine container and untar it then run jdk8u362-b07/bin/java -versiongot 1.8.0_362-beta
went to workspace and download openjdkbin/j2sdk-image/bin/java and put into same container and overwrite the previous 'jdk8u362-b07/bin/java' then run jdk8u362-b07/bin/java -version still works fine

@smlambert
Copy link
Contributor Author

I am looking at https://github.com/adoptium/aqa-tests/blob/master/get.sh#L221-L238 and wondering if there is some additional handling needed for the alpine-linux platforms (which do not quite follow the same naming pattern as others).
FYI @sophia-guo

@sophia-guo
Copy link

This should not be related with https://github.com/adoptium/aqa-tests/blob/master/get.sh#L221-L238. Nightly builds get SDK by upstream, which doesn't need the download by API. Also by console output we can see that file is correct Uncompressing file: OpenJDK8U-jdk_aarch64_alpine-linux_hotspot_2023-01-11-18-05.tar.gz. This happened since Nov 21th for both x86-64_alpine-linux and aarch64_alpine-linux . I suspect some thing wrong with jck build package or naming. Not sure if it's the reason for https://github.com/adoptium/jdk8u/issues/11. alpine 8 is different.

@smlambert
Copy link
Contributor Author

Thanks @sophia-guo for looking at the dates of when this issue first started (Nov 21st builds).

Listing the changes in repos from 21st to 23rd that would be likely candidates of where the issue was introduced:

@smlambert
Copy link
Contributor Author

Looking back in TRSS history, I do not think it began on Nov 21, x86-64_alpine-linux:

Listing the changes in repos from 23rd to 25th that would be likely candidates of where the issue was introduced:

  • ci-jenkins-pipelines (this repo) - changes

  • temurin-build - no changes

  • github-release-scripts - changes

  • aqa-tests - changes

  • TKG - no changes

@sophia-guo
Copy link

sophia-guo commented Jan 13, 2023

It might also be a machine issue or cleanws issue.

  1. It can not be reproduced locally jdk8 aarch64_alpine-linux test jobs fail due to DETECTED_JDK_VERSION mismatch from available artifact #2934 also it works in Eclispe adoptium https://ci.eclipse.org/temurin-compliance/job/Test_openjdk8_hs_sanity.jck_x86-64_alpine-linux/27/consoleFull
  2. All kept failed jobs are giving the same java-version.

jdk8
x86-64_alpine_linux - Aug, 2022 release

05:34:35 Run /home/jenkins/workspace/Test_openjdk8_hs_sanity.openjdk_x86-64_alpine-linux/openjdkbinary/j2sdk-image/bin/java -version
05:34:35 =JAVA VERSION OUTPUT BEGIN=
05:34:35 openjdk version "17.0.4.1" 2022-08-12
05:34:35 OpenJDK Runtime Environment Temurin-17.0.4.1+1 (build 17.0.4.1+1)
05:34:35 OpenJDK 64-Bit Server VM Temurin-17.0.4.1+1 (build 17.0.4.1+1, mixed mode, sharing)

aarch64_alpine-linux
13:26:04 Run /home/jenkins/workspace/Test_openjdk8_hs_sanity.openjdk_aarch64_alpine-linux/openjdkbinary/j2sdk-image/bin/java -version
13:26:04 =JAVA VERSION OUTPUT BEGIN=
13:26:04 openjdk version "17.0.6-beta" 2023-01-17
13:26:04 OpenJDK Runtime Environment Temurin-17.0.6+6-202212132332 (build 17.0.6-beta+6-202212132332)
13:26:04 OpenJDK 64-Bit Server VM Temurin-17.0.6+6-202212132332 (build 17.0.6-beta+6-202212132332, mixed mode, sharing)

Might worth to login the machine or container to see what's those special java are, are they default java ? Are those machines' configuration changed after Nov 21st? In adoptium/ci-jenkins-pipelines#508 it did mention tests jobs triggered by same jdk build have different behavior, smoke tests and sanity tests passed and then all following test jobs failed, which suggests might be machine changes at that time?

@sophia-guo
Copy link

sophia-guo commented Jan 17, 2023

As alpine is split out to its own repository we might leave and wait to see if this still happen when alpine is stable.

@smlambert
Copy link
Contributor Author

As per adoptium/aqa-tests#4258 (comment), we are able to run these pipelines without issue in https://ci.eclipse.org/temurin-compliance/job/AQA_Test_Pipeline/988/, which seems to cast suspicion on machine configuration.

Need to look at and compare configuration of public nodes versus the compliance nodes.

@sxa
Copy link
Member

sxa commented Feb 10, 2023

Looking at the log from https://ci.adoptopenjdk.net/job/Grinder/6620/console running on https://ci.adoptopenjdk.net/computer/test%2Ddocker%2Dalpine317%2Dx64%2D1/ it's running /home/jenkins/workspace/Grinder/openjdkbinary/j2sdk-image/bin/java -cp ./bin/TestKitGen.jar org.openj9.envInfo.EnvDetector which says Exception in thread "main" java.lang.UnsupportedClassVersionError: org/openj9/envInfo/EnvDetector has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 52.0 when I run it directly on the machine afterwards (It was run with KEEP_WORKSPACE, so it's unclear why it's not doing that in the jenkins job when it's explicitly specifying a path to the java runtime. The only thing I can think of that could make any difference is that the machine only has a jdk17 in /usr/lib/jvm - could that be causing ant to do something weird?

@sxa
Copy link
Member

sxa commented Feb 10, 2023

Test run executed correctly when the JDK used to run the jenkins agent was switched from jdk17 to jdk8 - that should not be affecting the use of JVM under test. (I've switched it back now since we need to be running 11+)

@sxa
Copy link
Member

sxa commented Feb 10, 2023

Also the TC agent that is running the tests successfully (See Grinder 3163) is using what is probably an Alpine supplied JDK11 to run the agent, which may or may not be relevant...

@sophia-guo
Copy link

I have double checked all the x64_alpline and aarch64_alpine tests jobs with jdk8, jdk11,jdk17, jdk19 and jdk20. This only happens to test jdk8. Feels like if jdk version is lower than 11 that even running with specified jdk it will fall back to default jenkins java agent ( if it's 17). However if the default jenkins java agent is 8 or 11 ( lower than 17) then the specified jdk will run even if it's jdk8. This is interesting.

@sophia-guo
Copy link

It also happens to test-docker-alpine313-aarch64-1. So that may not be related with the newer version of apline. As it happened around Nov 23rd it might help to figure out what configuration has been changed specific to all aplines jenkins agents.

@sxa
Copy link
Member

sxa commented Feb 14, 2023

It also happens to test-docker-alpine313-aarch64-1. So that may not be related with the newer version of apline. As it happened around Nov 23rd it might help to figure out what configuration has been changed specific to all aplines jenkins agents.

I'm not quite sure why you're focussing on Nov. 23rd other than that being the first time it was noticed. Was there a visible change on the alpine313-aarch64-1 system you mentioned at that time? We have been upgrading jenkins agents to JDK17 over the last few months as part of #2763 and this has been publicised in the infrastructure channel (most recently a couple of weeks ago) and in quite a few of our team calls.

It looks like alpine313-aarch64-1 was upgraded to JDK17 four days ago so presumably it was ok before then? If so, we know that the configuration change was the switch to using JDK17 for the agent

@sophia-guo
Copy link

sophia-guo commented Feb 14, 2023

#2934

@sxa
Copy link
Member

sxa commented Feb 14, 2023

@sophia-guo LD_LIBRARY_PATH=/usr/lib/jvm/jdk-17/lib/server:/usr/lib/jvm/jdk-17/lib:/usr/lib/jvm/jdk-17/../lib is being set in the environment, possibly from the JVM itself and therefore affecting all spawned processes. This is a possible reason for the behaviour we are seeing.

At this point I'd suggest trying to start up a JDK17 on an Alpine system which runs a Process exec call of some sort to fire up a shell and see if that gets the problematic LD_LIBRARY_PATH value.

@sxa
Copy link
Member

sxa commented Feb 14, 2023

I've only noticed this sort of thing as a problem in the past when I was debugging something on AIX.

@sophia-guo sophia-guo transferred this issue from adoptium/ci-jenkins-pipelines Feb 14, 2023
@sxa
Copy link
Member

sxa commented Feb 14, 2023

sxa/aqa-tests@f15a794 fixes it so that's definitely the source of the problem.

@sophia-guo
Copy link

Thanks @sxa !

The grinder https://ci.adoptopenjdk.net/view/Test_grinder/job/Grinder/6649/console reproduce the issue - tested jdk8 print jdk17.
Login in the machine running grinder tested jdk and print the correct java information

03f1b11b122c:/$ /home/jenkins/workspace/Grinder/openjdkbinary/j2sdk-image/bin/java -version
openjdk version "1.8.0_372-beta"
OpenJDK Runtime Environment (Temurin)(build 1.8.0_372-beta-202302131809-b02)
OpenJDK 64-Bit Server VM (Temurin)(build 25.372-b02, mixed mode)

Default java is 8

03f1b11b122c:/$ java -version
openjdk version "1.8.0_345"
OpenJDK Runtime Environment (IcedTea 3.24.0) (Alpine 8.345.01-r0)
OpenJDK 64-Bit Server VM (build 25.345-b01, mixed mode)
03f1b11b122c:/$ 

Other java

03f1b11b122c:/$ ls -l /usr/lib/jvm/
total 318228
-rw-r--r--    1 root     root     325857280 Dec 13 23:42 OpenJDK17U-jdk_aarch64_alpine-linux_hotspot_2022-12-13-23-30.tar
lrwxrwxrwx    1 root     root            14 Dec  7 12:30 default-jvm -> java-8-openjdk
drwxr-xr-x    1 root     root           132 Dec  7 12:30 java-1.8-openjdk
lrwxrwxrwx    1 root     root            16 Dec  7 12:30 java-8-openjdk -> java-1.8-openjdk
drwxr-xr-x    1 root     root            86 Dec 14 14:32 jdk17

@sxa
Copy link
Member

sxa commented Feb 14, 2023

Just realised I didn't include my link earlier - https://ci.adoptopenjdk.net/view/Test_grinder/job/Grinder/6647/console was the grinder with the patch I mentioned above - it still didn't run through properly (I haven't diagnosed why, but bear in mind my change would have been local to get.sh) but it did pass that version check.

@sophia-guo
Copy link

sophia-guo commented Feb 14, 2023

x64_alpine is similar login in the machine and run directly it works fine

8a931c282a28:~$  _testJ=/home/sophia/GrinderJDK8/Grinder/openjdkbinary/j2sdk-image/bin/java
8a931c282a28:~$ ${_testJ} -version
openjdk version "1.8.0_372-beta"
OpenJDK Runtime Environment (Temurin)(build 1.8.0_372-beta-202302131817-b02)
OpenJDK 64-Bit Server VM (Temurin)(build 25.372-b02, mixed mode)


8a931c282a28:/$ ls -l /usr/lib/jvm/
total 4
drwxr-xr-x    9 root     root          4096 Nov 23 16:59 jdk-17

Alpine jobs have the environment variables print out( printenv), didn't see other linux have those two environment print out:

 _=/usr/lib/jvm/jdk-17/bin/java
LD_LIBRARY_PATH=/usr/lib/jvm/jdk-17/lib/server:/usr/lib/jvm/jdk-17/lib:/usr/lib/jvm/jdk-17/../lib

We don't have the issue in Eclipse temurin. Alpine jobs in Eclispe temurin also have those two environment variables print out. Only difference is in Eclispe temurin those variables are 11 ( Though probably jenkins version is different too).

07:43:24  LD_LIBRARY_PATH=/usr/lib/jvm/java-11-openjdk/lib/server:/usr/lib/jvm/java-11-openjdk/lib:/usr/lib/jvm/java-11-openjdk/../lib
07:43:24  _=/usr/bin/java

@sxa mentioned if switch back to jdk8 as jenkins agent there will be no this issue. So suppose if change to 11 we will not have this issue too? This is only happen to jenkins agent use jdk17 on alpine?

@sxa555
Copy link

sxa555 commented Feb 14, 2023 via email

@smlambert
Copy link
Contributor Author

I believe she is referring to the Temurin-compliance Jenkins server.

@sophia-guo
Copy link

Yes, Eclipse Temurin --> Temurin-compliance

@sxa
Copy link
Member

sxa commented Feb 15, 2023

@sxa mentioned if switch back to jdk8 as jenkins agent there will be no this issue. So suppose if change to 11 we will not have this issue too? This is only happen to jenkins agent use jdk17 on alpine?

It needs to be tested, but I do not want to switch back from using JDK17 for the jenkins agent. While it works, it is not recommended to have the agents running at an earlier JDK version running on the server.

I suggest trying the experiment I mentioned previously - using a Runtime/Process object to start up a shell from the different Java runtimes and see if the JDKs are setting those values themselves in subprocesses and what effect they have on java versions running from there so we have all the relevant data (and possibly determine if it is a bug in how java is operating on certain versions!), and then determine how best to work around it in the AQA test suite, possibly with something based on my patch above.

@sophia-guo
Copy link

sophia-guo commented Feb 15, 2023

It needs to be tested, but I do not want to switch back from using JDK17 for the jenkins agent. While it works, it is not recommended to have the agents running at an earlier JDK version running on the server.

Yes, I didn't ask for switching back to jdk11 or else. Just give more information to help to narrow down the issue.

@smlambert
Copy link
Contributor Author

smlambert commented Feb 15, 2023

Summary of behaviour:

JDK_VERSION LD_LIBRARY_PATH set to 8 LD_LIBRARY_PATH set to 11 LD_LIBRARY_PATH set to 17 (azul and temurin) LD_LIBRARY_PATH unset
Temurin jdk8 link ✔️ link ✔️ link ✔️
Azul jdk8 - - link ✔️
jdk11 link ✔️ link link ✔️ ✔️
jdk17 link ✔️ ✔️

✔️ means it properly uses TEST_JDK_HOME as the java under test
❌ means it does NOT use TEST_JDK_HOME, but rather uses the java defined by LD_LIBRARY_PATH

@smlambert
Copy link
Contributor Author

smlambert commented Feb 15, 2023

when Java 8 runs with this path to 17 it opens jdk-17.0.6+10/lib/modules in Java 11, in the path, it does not, and it works.

Running lsof on java to see what files are open
LD_LIBRARY_PATH is /jdk/jdk-17.0.6+10/lib
Background is 169
Sleeping ...
PID   USER     TIME  COMMAND
    1 root      0:00 /bin/sh /jdk/runtests
  169 root      0:00 ./jdk8u362-b09/bin/java Sleep
  189 root      0:00 ps -ale
1       /bin/busybox    /dev/null
1       /bin/busybox    pipe:[484525]
1       /bin/busybox    pipe:[484526]
1       /bin/busybox    /jdk/runtests
169     /jdk/jdk8u362-b09/bin/java      /dev/null
169     /jdk/jdk8u362-b09/bin/java      pipe:[484525]
169     /jdk/jdk8u362-b09/bin/java      pipe:[484526]
169     /jdk/jdk8u362-b09/bin/java      /jdk/jdk-17.0.6+10/lib/modules
done
Running lsof on java to see what files are open
LD_LIBRARY_PATH is /jdk/jdk-11.0.18+10/lib
Background is 191
Sleeping ...
PID   USER     TIME  COMMAND
    1 root      0:00 /bin/sh /jdk/runtests
  191 root      0:00 ./jdk8u362-b09/bin/java Sleep
  227 root      0:00 ps -ale
1       /bin/busybox    /dev/null
1       /bin/busybox    pipe:[484525]
1       /bin/busybox    pipe:[484526]
1       /bin/busybox    /jdk/runtests
191     /jdk/jdk8u362-b09/bin/java      /dev/null
191     /jdk/jdk8u362-b09/bin/java      pipe:[484525]
191     /jdk/jdk8u362-b09/bin/java      pipe:[484526]
191     /jdk/jdk8u362-b09/bin/java      /jdk/jdk8u362-b09/jre/lib/rt.jar
191     /jdk/jdk8u362-b09/bin/java      /jdk/jdk8u362-b09/jre/lib/jfr.jar
done
Running lsof on java to see what files are open
LD_LIBRARY_PATH is
Background is 229
Sleeping ...
PID   USER     TIME  COMMAND
    1 root      0:00 /bin/sh /jdk/runtests
  229 root      0:00 ./jdk8u362-b09/bin/java Sleep
  265 root      0:00 ps -ale
1       /bin/busybox    /dev/null
1       /bin/busybox    pipe:[484525]
1       /bin/busybox    pipe:[484526]
1       /bin/busybox    /jdk/runtests
229     /jdk/jdk8u362-b09/bin/java      /dev/null
229     /jdk/jdk8u362-b09/bin/java      pipe:[484525]
229     /jdk/jdk8u362-b09/bin/java      pipe:[484526]
229     /jdk/jdk8u362-b09/bin/java      /jdk/jdk8u362-b09/jre/lib/rt.jar
229     /jdk/jdk8u362-b09/bin/java      /jdk/jdk8u362-b09/jre/lib/jfr.jar
done

What is the correct behaviour? Either use the LD_LIBRARY_PATH or not, but not inconsistent behaviour (between jdk11 and jdk17 on LD_LIBRARY_PATH).

@sxa
Copy link
Member

sxa commented Feb 16, 2023

The java executable is dynamically linked against libjli.so which appears to be what it's picking up (verified with ldd against the java executable as can be seen below). That file does NOT exist in the JDK11 lib directory (it's in lib/jli which isn't in the LD_LIBRARY_PATH in the previous examples) but does in JDK17 which would explain the difference in behaviour:

18a34c475bbb:~/sxa$ LD_LIBRARY_PATH=jdk-11.0.18+10-jre/lib ldd jdk8u362-b09-jre/bin/java
	/lib/ld-musl-x86_64.so.1 (0x7fb4df300000)
	libjli.so => jdk8u362-b09-jre/bin/../lib/amd64/jli/libjli.so (0x7fb4df2e1000)
	libc.musl-x86_64.so.1 => /lib/ld-musl-x86_64.so.1 (0x7fb4df300000)
18a34c475bbb:~/sxa$ LD_LIBRARY_PATH=jdk-17.0.6+10-jre/lib ldd jdk8u362-b09-jre/bin/java
	/lib/ld-musl-x86_64.so.1 (0x7f12bc9c9000)
	libjli.so => jdk-17.0.6+10-jre/lib/libjli.so (0x7f12bc9b2000)
	libc.musl-x86_64.so.1 => /lib/ld-musl-x86_64.so.1 (0x7f12bc9c9000)
	libz.so.1 => /lib/libz.so.1 (0x7f12bc998000)
18a34c475bbb:~/sxa$ ls -ld */lib/libjli.so
-rw-r--r--    1 jenkins  jenkins      77072 Jan 18 10:20 jdk-17.0.6+10-jre/lib/libjli.so
18a34c475bbb:~/sxa$ find . -name libjli.so
./jdk-17.0.6+10-jre/lib/libjli.so
./jdk8u362-b09-jre/lib/amd64/jli/libjli.so
./jdk-11.0.18+10-jre/lib/jli/libjli.so

As an additional check, here's what you get when you point LD_LIBRARY_PATH at the JDK11 lib/jli directory instead of just lib - same effect:

8a34c475bbb:~/sxa$ LD_LIBRARY_PATH=jdk-11.0.18+10-jre/lib/jli jdk8u362-b09-jre/bin/java -version
openjdk version "11.0.18" 2023-01-17
OpenJDK Runtime Environment Temurin-11.0.18+10 (build 11.0.18+10)
OpenJDK 64-Bit Server VM Temurin-11.0.18+10 (build 11.0.18+10, mixed mode)
18a34c475bbb:~/sxa$ 

@sophia-guo
Copy link

Another note is libjli.so exists in JDK17 lib directory doesn't affect jdk11, jdk17. Only jdk8 is affected.

/ # export LD_LIBRARY_PATH=/usr/lib/jvm/java-17-openjdk/lib
/ # java -version
openjdk version "17.0.7" 2023-04-18
OpenJDK Runtime Environment (build 17.0.7+7-alpine-r0)
OpenJDK 64-Bit Server VM (build 17.0.7+7-alpine-r0, mixed mode, sharing)
/ # ./jdk-17.0.6+9/bin/java -version
openjdk version "17.0.6" 2023-01-17
OpenJDK Runtime Environment Temurin-17.0.6+9 (build 17.0.6+9)
OpenJDK 64-Bit Server VM Temurin-17.0.6+9 (build 17.0.6+9, mixed mode, sharing)
/ # ./jdk-11.0.18+10/bin/java -version
openjdk version "11.0.18-beta" 2023-01-17
OpenJDK Runtime Environment Temurin-11.0.18+10-202302231626 (build 11.0.18-beta+10-202302231626)
OpenJDK 64-Bit Server VM Temurin-11.0.18+10-202302231626 (build 11.0.18-beta+10-202302231626, mixed mode)
/ # ./jdk8u362-b07/bin/java -version
openjdk version "17.0.7" 2023-04-18
OpenJDK Runtime Environment (build 17.0.7+7-alpine-r0)
OpenJDK 64-Bit Server VM (build 17.0.7+7-alpine-r0, mixed mode, sharing)

Suspect the reason is the https://bugs.openjdk.org/browse/JDK-8247589 only backport to jdk11 https://bugs.openjdk.org/browse/JDK-8284005. It is not backport to JDK8

This might explain why LD_LIBRARY_PATH is set and how it is set .

Might be helpful to confirm with Aleksei Voitylov to see if this is the behaviour is expected for jdk8 and if the backport could fix it?

@jiekang jiekang moved this from In Progress to Done in Adoptium 2Q 2023 Plan May 16, 2023
@smlambert
Copy link
Contributor Author

Thanks to @sophia-guo for putting Stewart's workaround in place to mitigate this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: Done
Development

No branches or pull requests

5 participants