docker-agent icon indicating copy to clipboard operation
docker-agent copied to clipboard

Jenkins agents with Jdk17 error: hudson.remoting.ProxyException: java.lang.reflect.InaccessibleObjectException: Unable to make field private final java.util.Comparator java.util.TreeMap.comparator accessible: module java.base does not "opens java.util" to unnamed module @1c1618cf

Open prudhvigodithi opened this issue 4 years ago • 27 comments

Version report

Using jenkins master: 2.249.2 Jenkins remoting version: 4.10 Connection Protocol: websocket Java version: openjdk version "17" 2021-09-14 OpenJDK Runtime Environment Temurin-17+35 (build 17+35) OpenJDK 64-Bit Server VM Temurin-17+35 (build 17+35, mixed mode)

Jenkins agent log:
WARNING: A terminally deprecated method in java.lang.System has been called
WARNING: System::setSecurityManager has been called by hudson.remoting.jnlp.Main (file:/usr/share/jenkins/agent.jar)
WARNING: Please consider reporting this to the maintainers of hudson.remoting.jnlp.Main
WARNING: System::setSecurityManager will be removed in a future release
Oct 12, 2021 10:29:48 AM hudson.remoting.jnlp.Main createEngine
INFO: Setting up agent: ditest-jdk17-medium-2m1ph
Oct 12, 2021 10:29:48 AM hudson.remoting.jnlp.Main$CuiListener <init>
INFO: Jenkins agent is running in headless mode.
Oct 12, 2021 10:29:48 AM hudson.remoting.Engine startEngine
INFO: Using Remoting version: 4.10
Oct 12, 2021 10:29:48 AM org.jenkinsci.remoting.engine.WorkDirManager initializeWorkDir
INFO: Using /home/jenkins/remoting as a remoting work directory
Oct 12, 2021 10:29:48 AM org.jenkinsci.remoting.engine.WorkDirManager setupLogging
INFO: Both error and output logs will be printed to /home/jenkins/remoting
Oct 12, 2021 10:29:49 AM hudson.remoting.jnlp.Main$CuiListener status
INFO: WebSocket connection open
Oct 12, 2021 10:29:49 AM hudson.remoting.jnlp.Main$CuiListener status
INFO: Connected
Oct 12, 2021 10:30:02 AM org.csanchez.jenkins.plugins.kubernetes.KubernetesSlave$SlaveDisconnector call
INFO: Disabled slave engine reconnects.
Oct 12, 2021 10:30:02 AM hudson.remoting.jnlp.Main$CuiListener status
INFO: Write side closed
Oct 12, 2021 10:30:02 AM hudson.remoting.jnlp.Main$CuiListener status
INFO: Read side closed
Oct 12, 2021 10:30:02 AM hudson.remoting.jnlp.Main$CuiListener status
INFO: Terminated
Oct 12, 2021 10:30:02 AM hudson.remoting.jnlp.Main$CuiListener status
INFO: Read side closed


Jenkins build exit log:
hudson.remoting.ProxyException: java.lang.reflect.InaccessibleObjectException: Unable to make field private final java.util.Comparator java.util.TreeMap.comparator accessible: module java.base does not "opens java.util" to unnamed module @1c1618cf
	at java.lang.reflect.AccessibleObject.checkCanSetAccessible(Unknown Source)
	at java.lang.reflect.AccessibleObject.checkCanSetAccessible(Unknown Source)
	at java.lang.reflect.Field.checkCanSetAccessible(Unknown Source)
	at java.lang.reflect.Field.setAccessible(Unknown Source)
	at com.thoughtworks.xstream.core.util.Fields.locate(Fields.java:39)
	at com.thoughtworks.xstream.converters.collections.TreeMapConverter.<clinit>(TreeMapConverter.java:50)
Also:   hudson.remoting.Channel$CallSiteStackTrace: Remote call to ditest-jdk17-medium-2m1ph
		at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1800)
		at hudson.remoting.UserRequest$ExceptionResponse.retrieve(UserRequest.java:357)
		at hudson.remoting.Channel.call(Channel.java:1001)
		at hudson.FilePath.act(FilePath.java:1070)
		at hudson.FilePath.act(FilePath.java:1059)
		at org.jenkinsci.plugins.gitclient.Git.getClient(Git.java:121)
		at hudson.plugins.git.GitSCM.createClient(GitSCM.java:902)
		at hudson.plugins.git.GitSCM.createClient(GitSCM.java:833)
		at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1286)
		at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:125)
		at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:93)
		at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:80)
		at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
		at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
		at java.util.concurrent.FutureTask.run(FutureTask.java:266)
		at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
		at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
		at java.lang.Thread.run(Thread.java:748)
Caused: hudson.remoting.ProxyException: java.lang.ExceptionInInitializerError
	at com.thoughtworks.xstream.XStream.setupConverters(XStream.java:811)
	at com.thoughtworks.xstream.XStream.<init>(XStream.java:574)
	at com.thoughtworks.xstream.XStream.<init>(XStream.java:496)
	at com.thoughtworks.xstream.XStream.<init>(XStream.java:465)
	at com.thoughtworks.xstream.XStream.<init>(XStream.java:411)
	at com.thoughtworks.xstream.XStream.<init>(XStream.java:378)
	at hudson.util.XStream2.<init>(XStream2.java:113)
	at hudson.ProxyConfiguration.<clinit>(ProxyConfiguration.java:392)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Unknown Source)
	at jdk.proxy4.$Proxy11.<clinit>(Unknown Source)
	at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
	at jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
	at java.lang.reflect.Constructor.newInstanceWithCaller(Unknown Source)
	at java.lang.reflect.Constructor.newInstance(Unknown Source)
	at java.lang.reflect.Proxy.newProxyInstance(Unknown Source)
	at java.lang.reflect.Proxy.newProxyInstance(Unknown Source)
	at hudson.remoting.RemoteInvocationHandler.wrap(RemoteInvocationHandler.java:169)
	at hudson.remoting.Channel.export(Channel.java:813)
	at hudson.remoting.Channel.export(Channel.java:776)
	at org.jenkinsci.plugins.gitclient.LegacyCompatibleGitAPIImpl.writeReplace(LegacyCompatibleGitAPIImpl.java:204)
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at java.io.ObjectStreamClass.invokeWriteReplace(Unknown Source)
	at java.io.ObjectOutputStream.writeObject0(Unknown Source)
	at java.io.ObjectOutputStream.writeObject(Unknown Source)
	at hudson.remoting.UserRequest._serialize(UserRequest.java:263)
	at hudson.remoting.UserRequest.serialize(UserRequest.java:272)
	at hudson.remoting.UserRequest.perform(UserRequest.java:222)
	at hudson.remoting.UserRequest.perform(UserRequest.java:54)
	at hudson.remoting.Request$2.run(Request.java:376)
	at hudson.remoting.InterceptingExecutorService.lambda$wrap$0(InterceptingExecutorService.java:78)
	at java.util.concurrent.FutureTask.run(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at hudson.remoting.Engine$1.lambda$newThread$0(Engine.java:122)
	at java.lang.Thread.run(Unknown Source)
Finished: FAILURE
  • What Operating System are you using (both controller, and any agents involved in the problem)?
using Docker image jenkins/agent:latest-jdk17-preview which has Debain OS

Reproduction steps

  • Using the Default agent as jenkins/agent:latest-jdk17-preview with entrypoint from https://github.com/jenkinsci/docker-inbound-agent.
  • Using this as entrypoint https://github.com/jenkinsci/docker-inbound-agent/blob/master/jenkins-agent to the agent caused the above error, somehow I see the compatibility with the new jdk17 version.
  • Starting the agent using jenkins kubernetes plugin, below are the logs: WARNING: A terminally deprecated method in java.lang.System has been called WARNING: System::setSecurityManager has been called by hudson.remoting.jnlp.Main (file:/usr/share/jenkins/agent.jar) WARNING: Please consider reporting this to the maintainers of hudson.remoting.jnlp.Main WARNING: System::setSecurityManager will be removed in a future release

Expected result:
Expected to work normal to start the agent and continue to run the build without the error hudson.remoting.ProxyException: java.lang.reflect.InaccessibleObjectException: Unable to make field private final java.util.Comparator java.util.TreeMap.comparator accessible: module java.base does not "opens java.util" to unnamed module @1c1618cf

Actual result:
Job Exits with a failure result as Caused: hudson.remoting.ProxyException: java.lang.ExceptionInInitializerError

prudhvigodithi avatar Oct 12 '21 14:10 prudhvigodithi

Sure it'll need something like: https://github.com/jenkinsci/docker/blob/master/jenkins.sh#L37-L44

I had that initially but then I removed it as I wasn't able to trigger any of these issues.

Feel like contributing a fix?

timja avatar Oct 12 '21 15:10 timja

Hey @timja, thanks for reaching back, you mean to try adding those flags to this entry point https://github.com/jenkinsci/docker-inbound-agent/blob/master/jenkins-agent and test the agent again if works create a PR adding those flags for jdk17 entry point? ( https://github.com/jenkinsci/docker-inbound-agent/blob/master/jenkins-agent) Thank you

prudhvigodithi avatar Oct 12 '21 15:10 prudhvigodithi

Yes, bearing in mind that the entrypoint here uses sh whereas jenkins.sh uses bash

timja avatar Oct 12 '21 15:10 timja

Thanks @timja I have tested with those FUTURE_OPTS flags somehow I still get the error, below I have pasted the error log.

Connection Command

exec /opt/jdk/bin/java --add-opens java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.util.concurrent=ALL-UNNAMED  -cp /usr/share/jenkins/agent.jar hudson.remoting.jnlp.Main -headless  -url https://jenkins.test.aws/test/ -workDir /home/jenkins -webSocket   35cee8f9dfebe735b48c8d2a420f609005847607c60c test-jdk17-medium-g8bdm 

Error log

WARNING: System::setSecurityManager has been called by hudson.remoting.jnlp.Main (file:/usr/share/jenkins/agent.jar)
WARNING: Please consider reporting this to the maintainers of hudson.remoting.jnlp.Main
WARNING: System::setSecurityManager will be removed in a future release
Oct 12, 2021 12:31:03 PM hudson.remoting.jnlp.Main createEngine
INFO: Setting up agent: ditest-jdk17-medium-g8bdm
Oct 12, 2021 12:31:03 PM hudson.remoting.jnlp.Main$CuiListener <init>
INFO: Jenkins agent is running in headless mode.
Oct 12, 2021 12:31:03 PM hudson.remoting.Engine startEngine
INFO: Using Remoting version: 4.10
Oct 12, 2021 12:31:03 PM org.jenkinsci.remoting.engine.WorkDirManager initializeWorkDir
INFO: Using /home/jenkins/remoting as a remoting work directory
Oct 12, 2021 12:31:03 PM org.jenkinsci.remoting.engine.WorkDirManager setupLogging
INFO: Both error and output logs will be printed to /home/jenkins/remoting
Oct 12, 2021 12:31:04 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: WebSocket connection open
Oct 12, 2021 12:31:04 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: Connected
Oct 12, 2021 12:31:22 PM jenkins.model.Jenkins <clinit>
SEVERE: Failed to load Jenkins.class
java.lang.ExceptionInInitializerError
	at com.thoughtworks.xstream.XStream.setupConverters(XStream.java:824)
	at com.thoughtworks.xstream.XStream.<init>(XStream.java:574)
	at com.thoughtworks.xstream.XStream.<init>(XStream.java:496)
	at com.thoughtworks.xstream.XStream.<init>(XStream.java:465)
	at com.thoughtworks.xstream.XStream.<init>(XStream.java:411)
	at com.thoughtworks.xstream.XStream.<init>(XStream.java:378)
	at hudson.util.XStream2.<init>(XStream2.java:113)
	at jenkins.model.Jenkins.<clinit>(Jenkins.java:5379)
	at jenkins.agents.AgentComputerUtil.getChannelToMaster(AgentComputerUtil.java:48)
	at hudson.util.ProcessTree.get(ProcessTree.java:432)
	at hudson.Launcher$RemoteLauncher$KillTask.call(Launcher.java:1164)
	at hudson.Launcher$RemoteLauncher$KillTask.call(Launcher.java:1155)
	at hudson.remoting.UserRequest.perform(UserRequest.java:211)
	at hudson.remoting.UserRequest.perform(UserRequest.java:54)
	at hudson.remoting.Request$2.run(Request.java:376)
	at hudson.remoting.InterceptingExecutorService.lambda$wrap$0(InterceptingExecutorService.java:78)
	at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at hudson.remoting.Engine$1.lambda$newThread$0(Engine.java:122)
	at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field protected java.lang.reflect.InvocationHandler java.lang.reflect.Proxy.h accessible: module java.base does not "opens java.lang.reflect" to unnamed module @429de50b
	at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(Unknown Source)
	at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(Unknown Source)
	at java.base/java.lang.reflect.Field.checkCanSetAccessible(Unknown Source)
	at java.base/java.lang.reflect.Field.setAccessible(Unknown Source)
	at com.thoughtworks.xstream.core.util.Fields.locate(Fields.java:39)
	at com.thoughtworks.xstream.converters.extended.DynamicProxyConverter.<clinit>(DynamicProxyConverter.java:42)
	... 21 more

Oct 12, 2021 12:31:22 PM hudson.remoting.UserRequest perform
WARNING: LinkageError while performing UserRequest:hudson.Launcher$RemoteLauncher$KillTask@1f076ac1
java.lang.ExceptionInInitializerError
	at com.thoughtworks.xstream.XStream.setupConverters(XStream.java:824)
	at com.thoughtworks.xstream.XStream.<init>(XStream.java:574)
	at com.thoughtworks.xstream.XStream.<init>(XStream.java:496)
	at com.thoughtworks.xstream.XStream.<init>(XStream.java:465)
	at com.thoughtworks.xstream.XStream.<init>(XStream.java:411)
	at com.thoughtworks.xstream.XStream.<init>(XStream.java:378)
	at hudson.util.XStream2.<init>(XStream2.java:113)
	at jenkins.model.Jenkins.<clinit>(Jenkins.java:5379)
	at jenkins.agents.AgentComputerUtil.getChannelToMaster(AgentComputerUtil.java:48)
	at hudson.util.ProcessTree.get(ProcessTree.java:432)
	at hudson.Launcher$RemoteLauncher$KillTask.call(Launcher.java:1164)
	at hudson.Launcher$RemoteLauncher$KillTask.call(Launcher.java:1155)
	at hudson.remoting.UserRequest.perform(UserRequest.java:211)
	at hudson.remoting.UserRequest.perform(UserRequest.java:54)
	at hudson.remoting.Request$2.run(Request.java:376)
	at hudson.remoting.InterceptingExecutorService.lambda$wrap$0(InterceptingExecutorService.java:78)
	at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at hudson.remoting.Engine$1.lambda$newThread$0(Engine.java:122)
	at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field protected java.lang.reflect.InvocationHandler java.lang.reflect.Proxy.h accessible: module java.base does not "opens java.lang.reflect" to unnamed module @429de50b
	at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(Unknown Source)
	at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(Unknown Source)
	at java.base/java.lang.reflect.Field.checkCanSetAccessible(Unknown Source)
	at java.base/java.lang.reflect.Field.setAccessible(Unknown Source)
	at com.thoughtworks.xstream.core.util.Fields.locate(Fields.java:39)
	at com.thoughtworks.xstream.converters.extended.DynamicProxyConverter.<clinit>(DynamicProxyConverter.java:42)
	... 21 more

Oct 12, 2021 12:31:22 PM org.csanchez.jenkins.plugins.kubernetes.KubernetesSlave$SlaveDisconnector call
INFO: Disabled slave engine reconnects.
Oct 12, 2021 12:31:22 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: Write side closed
Oct 12, 2021 12:31:22 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: Read side closed
Oct 12, 2021 12:31:22 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: Terminated
Oct 12, 2021 12:31:22 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: Read side closed

prudhvigodithi avatar Oct 12 '21 16:10 prudhvigodithi

According to the error you need to add java.lang.reflect to the modules list

timja avatar Oct 12 '21 17:10 timja

Hey @timja I have added the following OPTS "--add-opens java.base/java.lang.reflect=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.util.concurrent=ALL-UNNAMED

I still got an error Error log Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make protected java.lang.String java.text.AttributedCharacterIterator$Attribute.getName() accessible: module java.base does not "opens java.text" to unnamed module @79a9f151

@timja you mentioned you had this initially but then removed later, did you manage to fix error without these FUTURE_OPTS="--add-opens java.base/java.lang.reflect=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.util.concurrent=ALL-UNNAMED

prudhvigodithi avatar Oct 12 '21 18:10 prudhvigodithi

Next error is java.text

initially I copied the options from jenkinsci/docker but then I tested without and found that basic steps worked fine without it

timja avatar Oct 12 '21 18:10 timja

Ya just added the following, running some tests

--add-opens java.base/java.text=ALL-UNNAMED --add-opens java.desktop/java.awt.font=ALL-UNNAMED --add-opens java.base/java.lang.reflect=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.util.concurrent=ALL-UNNAMED

prudhvigodithi avatar Oct 12 '21 18:10 prudhvigodithi

What made you add java.awt.font?

timja avatar Oct 12 '21 18:10 timja

just removed the java.awt.font, not including in my tests, added it as I copy the --add-opens from the existing app.

prudhvigodithi avatar Oct 12 '21 18:10 prudhvigodithi

yes it requires --add-opens java.desktop/java.awt.font=ALL-UNNAMED Error log:

java.lang.reflect.InaccessibleObjectException: Unable to make field private static final java.util.Map java.awt.font.TextAttribute.instanceMap accessible: module java.desktop does not "opens java.awt.font" to unnamed module @6f6b13c6
	at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354)

prudhvigodithi avatar Oct 12 '21 18:10 prudhvigodithi

You got a bigger stacktrace for it?

timja avatar Oct 12 '21 18:10 timja

Hey @timja sorry for late reply, below I have shared the error log

FATAL: java.lang.ExceptionInInitializerError
hudson.remoting.ProxyException: java.lang.reflect.InaccessibleObjectException: Unable to make field private static final java.util.Map java.awt.font.TextAttribute.instanceMap accessible: module java.desktop does not "opens java.awt.font" to unnamed module @6f6b13c6
	at java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354)
	at java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297)
	at java.lang.reflect.Field.checkCanSetAccessible(Field.java:178)
	at java.lang.reflect.Field.setAccessible(Field.java:172)
	at com.thoughtworks.xstream.core.util.Fields.locate(Fields.java:39)
	at com.thoughtworks.xstream.converters.reflection.AbstractAttributedCharacterIteratorAttributeConverter.readResolve(AbstractAttributedCharacterIteratorAttributeConverter.java:106)
	at com.thoughtworks.xstream.converters.reflection.AbstractAttributedCharacterIteratorAttributeConverter.<init>(AbstractAttributedCharacterIteratorAttributeConverter.java:65)
	at com.thoughtworks.xstream.converters.extended.TextAttributeConverter.<init>(TextAttributeConverter.java:33)
	at com.thoughtworks.xstream.converters.extended.FontConverter.<init>(FontConverter.java:56)
	at com.thoughtworks.xstream.XStream.setupConverters(XStream.java:830)
	at com.thoughtworks.xstream.XStream.<init>(XStream.java:574)
	at com.thoughtworks.xstream.XStream.<init>(XStream.java:496)
	at com.thoughtworks.xstream.XStream.<init>(XStream.java:465)
	at com.thoughtworks.xstream.XStream.<init>(XStream.java:411)
	at com.thoughtworks.xstream.XStream.<init>(XStream.java:378)
	at hudson.util.XStream2.<init>(XStream2.java:113)
	at jenkins.model.Jenkins.<clinit>(Jenkins.java:5379)
Also:   hudson.remoting.Channel$CallSiteStackTrace: Remote call to ditest-jdk17-medium-4w1q2
		at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1800)
		at hudson.remoting.UserRequest$ExceptionResponse.retrieve(UserRequest.java:357)
		at hudson.remoting.Channel.call(Channel.java:1001)
		at hudson.Launcher$RemoteLauncher.kill(Launcher.java:1147)
		at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:510)
		at hudson.model.Run.execute(Run.java:1894)
		at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
		at hudson.model.ResourceController.execute(ResourceController.java:97)
		at hudson.model.Executor.run(Executor.java:428)
Caused: hudson.remoting.ProxyException: java.lang.ExceptionInInitializerError
	at jenkins.agents.AgentComputerUtil.getChannelToMaster(AgentComputerUtil.java:48)
	at hudson.util.ProcessTree.get(ProcessTree.java:432)
	at hudson.Launcher$RemoteLauncher$KillTask.call(Launcher.java:1164)
	at hudson.Launcher$RemoteLauncher$KillTask.call(Launcher.java:1155)
	at hudson.remoting.UserRequest.perform(UserRequest.java:211)
	at hudson.remoting.UserRequest.perform(UserRequest.java:54)
	at hudson.remoting.Request$2.run(Request.java:376)
	at hudson.remoting.InterceptingExecutorService.lambda$wrap$0(InterceptingExecutorService.java:78)
	at java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at hudson.remoting.Engine$1.lambda$newThread$0(Engine.java:122)
	at java.lang.Thread.run(Thread.java:833)

prudhvigodithi avatar Oct 15 '21 11:10 prudhvigodithi

Interesting, we can likely work around that in Jenkins core by removing that converter which we don't need, but it can be added to the add-opens for for

timja avatar Oct 15 '21 11:10 timja

True So moving forward @timja for users to use jdk17 should I add a PR for https://github.com/jenkinsci/docker-inbound-agent/blob/master/jenkins-agent or will it be added in Jenkins core with the next version?

prudhvigodithi avatar Oct 15 '21 11:10 prudhvigodithi

Add a PR for here for now please

timja avatar Oct 15 '21 11:10 timja

@timja sure, here do you suggest to add it for jdk17 docker image or create a new entry point file?

prudhvigodithi avatar Oct 15 '21 11:10 prudhvigodithi

same way as in jenkinsci/docker entrypoint, set an environment variable in the dockerfile

https://github.com/jenkinsci/docker/blob/master/17/debian/bullseye/hotspot/Dockerfile#L105

then https://github.com/jenkinsci/docker/blob/master/jenkins.sh#L38

(remembering that script is bash, while this is using sh)

timja avatar Oct 15 '21 12:10 timja

Does anyone have steps to reproduce this issue from scratch? I was thinking about moving the --add-opens lines from https://github.com/jenkinsci/docker-inbound-agent/blob/516b518fc78066d7f6ea271b548e32eb7e6db4fc/jenkins-agent#L133-L139 to an <Add-Opens> entry in Remoting's MANIFEST.MF (as in jenkinsci/jenkins#6356), so first I wanted to reproduce the stack trace mentioned in this issue when there are no --add-opens directives. But I was unable to reproduce the original problem on the latest Jenkins weekly (Jenkins 2.338, Remoting 4.13, XStream 1.4.19) when running controller and agent on Java 17 (OpenJDK) both with and without WebSocket mode without any --add-opens directives or custom entries in MANIFEST.MF. I was able to run a Pipeline job to completion on the agent and was even able to successfully run new hudson.util.XStream2() in the agent's script console. If we do still need these directives, it would be nice to know how to reproduce the stack trace mentioned in this bug. Then I can test that the stack trace occurs without any --add-opens directives, does not occur with --add-opens on the CLI, and does not occur with <Add-Opens> in Remoting's MANIFEST.MF.

basil avatar Mar 10 '22 21:03 basil

I tried to reproduce this and wasn't able to. =/

@bob-rohan do you have an example you could share from here? https://github.com/jenkinsci/docker-inbound-agent/pull/252

timja avatar Mar 11 '22 08:03 timja

I don't @timja , I not longer have access for the client where this work was done. I'll reach out see if someone could pick this up

bob-rohan avatar Mar 11 '22 09:03 bob-rohan

So maybe we should conclude that these --add-opens directives aren't needed anymore and remove them? Though that could cause a regression if they are needed. Alternatively, we could convert them to <Add-Opens> in MANIFEST.MF in Remoting, which would clean up the code, but I would have no way to easily test this. Or we could maintain the status quo, but I think that is the worst option.

basil avatar Mar 11 '22 15:03 basil

we could remove for now and see if someone can provide a way to reproduce if we hit it.

timja avatar Mar 11 '22 16:03 timja

One YOLO PR coming up.

basil avatar Mar 11 '22 16:03 basil

I recently upgraded my Jenkins from 2.346.2 on Java 11 to 2.346.2 on Java 17, and I'm getting the same issue:

java.lang.reflect.InaccessibleObjectException: Unable to make field private static final long java.util.concurrent.atomic.AtomicBoolean.serialVersionUID accessible: module java.base does not "opens java.util.concurrent.atomic" to unnamed module @327af41b 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.Field.checkCanSetAccessible(Field.java:178) at java.base/java.lang.reflect.Field.setAccessible(Field.java:172) at com.thoughtworks.xstream.converters.reflection.FieldDictionary.buildDictionaryEntryForClass(FieldDictionary.java:176) at com.thoughtworks.xstream.converters.reflection.FieldDictionary.buildMap(FieldDictionary.java:142) at com.thoughtworks.xstream.converters.reflection.FieldDictionary.fieldsFor(FieldDictionary.java:80) at com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.visitSerializableFields(PureJavaReflectionProvider.java:167) at hudson.util.RobustReflectionConverter.doMarshal(RobustReflectionConverter.java:206) at hudson.util.RobustReflectionConverter.marshal(RobustReflectionConverter.java:163) at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:68) at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:59) at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:83) at hudson.util.RobustReflectionConverter.marshallField(RobustReflectionConverter.java:283) at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:270)Caused: java.lang.RuntimeException: Failed to serialize io.jenkins.docker.DockerTransientNode#acceptingTasks for class io.jenkins.docker.DockerTransientNode at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:274) at hudson.util.RobustReflectionConverter$2.visit(RobustReflectionConverter.java:241) at com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.visitSerializableFields(PureJavaReflectionProvider.java:174) at hudson.util.RobustReflectionConverter.doMarshal(RobustReflectionConverter.java:226) at hudson.util.RobustReflectionConverter.marshal(RobustReflectionConverter.java:163) at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:68) at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:59) at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:44) at com.thoughtworks.xstream.core.TreeMarshaller.start(TreeMarshaller.java:83) at com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.marshal(AbstractTreeMarshallingStrategy.java:37) at com.thoughtworks.xstream.XStream.marshal(XStream.java:1266) at com.thoughtworks.xstream.XStream.marshal(XStream.java:1255) at com.thoughtworks.xstream.XStream.toXML(XStream.java:1228) at hudson.XmlFile.write(XmlFile.java:213)Caused: java.io.IOException at hudson.XmlFile.write(XmlFile.java:220) at jenkins.model.Nodes.persistNode(Nodes.java:183) at jenkins.model.Nodes.addNode(Nodes.java:148) at jenkins.model.Jenkins.addNode(Jenkins.java:2208) at io.jenkins.docker.connector.DockerComputerConnector.ensureNodeIsKnown(DockerComputerConnector.java:133) at io.jenkins.docker.connector.DockerComputerJNLPConnector.beforeContainerStarted(DockerComputerJNLPConnector.java:214) at com.nirima.jenkins.plugins.docker.DockerTemplate.doProvisionNode(DockerTemplate.java:737) at com.nirima.jenkins.plugins.docker.DockerTemplate.provisionNode(DockerTemplate.java:677) at com.nirima.jenkins.plugins.docker.DockerCloud$1.run(DockerCloud.java:376) at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28) at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:68) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) at java.base/java.lang.Thread.run(Thread.java:833)

shawngmc avatar Jul 27 '22 23:07 shawngmc

@shawngmc That stack trace seems to come from the controller, so I have no idea why you are posting it on an issue in the docker-agent repository.

basil avatar Jul 27 '22 23:07 basil

@shawngmc That stack trace seems to come from the controller, so I have no idea why you are posting it on an issue in the docker-agent repository.

Argh - you're right. That is from the controller. I think I simply copied/pasted into the wrong GitHub tab; pretty sure I meant to paste into https://github.com/jenkinsci/docker-plugin/issues/905

Getting Jenkins itself, the docker plugin, and a docker jenkins worker image all talking together happily is... painful.

shawngmc avatar Jul 27 '22 23:07 shawngmc

Ping on this issue: is it still reproduceable or shall we close it?

dduportal avatar Nov 12 '22 16:11 dduportal

This ticket was filed in the wrong repository and was fixed in https://github.com/jenkinsci/jenkins/pull/7270.

basil avatar Nov 12 '22 17:11 basil