Skip to content

Bazel Java tests fail on ubuntu2204 with JDK 17 #19850

@meteorcloudy

Description

@meteorcloudy

Description of the bug:

In https://bazel-review.googlesource.com/c/bazel/+/220425, I'm trying to drop ubuntu 1804 since it's EOL and add ubuntu 2204.

However some Java tests are failing with

1) smoke(com.google.devtools.build.lib.skyframe.serialization.FileSymlinkExceptionCodecTest)
java.lang.IllegalStateException: java.lang.reflect.InvocationTargetException
	at com.google.devtools.build.lib.skyframe.serialization.AutoRegistry.create(AutoRegistry.java:98)
	at com.google.common.base.Suppliers$NonSerializableMemoizingSupplier.get(Suppliers.java:181)
	at com.google.devtools.build.lib.skyframe.serialization.AutoRegistry.get(AutoRegistry.java:80)
	at com.google.devtools.build.lib.skyframe.serialization.testutils.SerializationTester.createObjectCodecs(SerializationTester.java:163)
	at com.google.devtools.build.lib.skyframe.serialization.testutils.SerializationTester.runTests(SerializationTester.java:134)
	at com.google.devtools.build.lib.skyframe.serialization.testutils.SerializationTester.runTests(SerializationTester.java:143)
	at com.google.devtools.build.lib.skyframe.serialization.FileSymlinkExceptionCodecTest.smoke(FileSymlinkExceptionCodecTest.java:51)
	... 25 trimmed
Caused by: java.lang.reflect.InvocationTargetException
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480)
	at com.google.devtools.build.lib.skyframe.serialization.CodecScanner.processLikelyCodec(CodecScanner.java:82)
	at com.google.devtools.build.lib.skyframe.serialization.CodecScanner.initializeCodecRegistry(CodecScanner.java:59)
	at com.google.devtools.build.lib.skyframe.serialization.AutoRegistry.create(AutoRegistry.java:86)
	... 32 more
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make private java.lang.Object java.lang.invoke.SerializedLambda.readResolve() throws java.io.ObjectStreamException accessible: module java.base does not "opens java.lang.invoke" to unnamed module @62bd2070
	at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354)
	at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297)
	at java.base/java.lang.reflect.Method.checkCanSetAccessible(Method.java:199)
	at java.base/java.lang.reflect.Method.setAccessible(Method.java:193)
	at com.google.devtools.build.lib.skyframe.serialization.LambdaCodec.<init>(LambdaCodec.java:45)
	... 40 more

See more at https://buildkite.com/bazel/google-bazel-presubmit/builds/72890

The major difference is that on ubuntu 2204, we have JDK 17 installed, the docker image is gcr.io/bazel-public/ubuntu2204-java17

Which category does this issue belong to?

Java Rules

What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

docker run -it gcr.io/bazel-public/ubuntu2204-java17

# clone bazel repo

bazel test //src/test/java/com/google/devtools/build/lib/skyframe/serialization:FileSymlinkExceptionCodecTest

Which operating system are you running Bazel on?

No response

What is the output of bazel info release?

No response

If bazel info release returns development version or (@non-git), tell us how you built Bazel.

No response

What's the output of git remote get-url origin; git rev-parse master; git rev-parse HEAD ?

No response

Is this a regression? If yes, please try to identify the Bazel commit where the bug was introduced.

No response

Have you found anything relevant by searching the web?

No response

Any other information, logs, or outputs that you want to share?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2We'll consider working on this in future. (Assignee optional)team-Rules-JavaIssues for Java rulestype: buguntriaged

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions