Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-73496

Amazon EC2 plugin error while opening created build agent config from Jenkins console UI

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Major Major
    • ec2-plugin
    • None
    • Amazon Linux

      After launching EC2 build agent, on Jenkins server side, under logs/slaves/<agent name>/slave.log, there is an error with stack as below. I noticed this because I want to modify the new agent idle time to debug, and it returns jenkins error (angry butlers) 

      Here is the stack:

      -------------------------------------------------
      Communication Protocol: Standard in/out
      This is a Unix agent
      ERROR: Unexpected error in launching an agent. This is probably a bug in Jenkins
      Also:   hudson.remoting.Channel$CallSiteStackTrace: Remote call to EC2 (ec2-xxxxxx) - Build Agent (i-xxxxxxxxxxxxx)
      at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1787)
      at hudson.remoting.UserRequest$ExceptionResponse.retrieve(UserRequest.java:356)
      at hudson.remoting.Channel.call(Channel.java:1003)
      at hudson.FilePath.act(FilePath.java:1317)
      at org.jenkinsci.plugins.envinject.EnvInjectComputerListener.onOnline(EnvInjectComputerListener.java:144)
      at hudson.slaves.SlaveComputer.setChannel(SlaveComputer.java:751)
      at hudson.slaves.SlaveComputer.setChannel(SlaveComputer.java:441)
      at hudson.plugins.ec2.ssh.EC2UnixLauncher.launchScript(EC2UnixLauncher.java:284)
      at hudson.plugins.ec2.EC2ComputerLauncher.launch(EC2ComputerLauncher.java:48)
      at hudson.slaves.SlaveComputer.lambda$_connect$0(SlaveComputer.java:297)
      at jenkins.util.ContextResettingExecutorService$2.call(ContextResettingExecutorService.java:46)
      at jenkins.security.ImpersonatingExecutorService$2.call(ImpersonatingExecutorService.java:80)
      java.lang.reflect.InaccessibleObjectException: Unable to make private native java.lang.reflect.Field[] java.lang.Class.getDeclaredFields0(boolean) accessible: module java.base does not "opens java.lang" to unnamed module @18f91981
      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 org.jenkinsci.plugins.envinject.service.EnvInjectMasterEnvVarsSetter.getModifiers(EnvInjectMasterEnvVarsSetter.java:29)
      at org.jenkinsci.plugins.envinject.service.EnvInjectMasterEnvVarsSetter.call(EnvInjectMasterEnvVarsSetter.java:55)
      at org.jenkinsci.plugins.envinject.service.EnvInjectMasterEnvVarsSetter.call(EnvInjectMasterEnvVarsSetter.java:19)
      at hudson.remoting.UserRequest.perform(UserRequest.java:211)
      at hudson.remoting.UserRequest.perform(UserRequest.java:54)
      at hudson.remoting.Request$2.run(Request.java:377)
      at hudson.remoting.InterceptingExecutorService.lambda$wrap$0(InterceptingExecutorService.java:78)
      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:840)
      Agent successfully connected and online

          [JENKINS-73496] Amazon EC2 plugin error while opening created build agent config from Jenkins console UI

          Markus Winter added a comment -

          At the end you see the line "Agent successfully connected and online" so the agent is working fineI think.

          The problem comes from the envinject plugin and is unrelated to ec2 plugin.

          You should try to configure the agent so that is uses the following arguments in the java call (these are arguments for the jvm, not the agent jar)

          --add-opens java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED

          Markus Winter added a comment - At the end you see the line "Agent successfully connected and online" so the agent is working fineI think. The problem comes from the envinject plugin and is unrelated to ec2 plugin. You should try to configure the agent so that is uses the following arguments in the java call (these are arguments for the jvm, not the agent jar) --add-opens java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED

          Markus Winter added a comment -

          When you can't open the agent config, you will need to look in the Jenkins log and not the agent log

          Markus Winter added a comment - When you can't open the agent config, you will need to look in the Jenkins log and not the agent log

          W added a comment -

          Thanks for your quick response.

          The build agents are working fine. However, in some cases, I need to modify the individual agent but I can no longer do it (this worked before and stopped working since upgrade sometime last November)

          I already had the jvm Options as above. Do you have any other suggestions? 

          W added a comment - Thanks for your quick response. The build agents are working fine. However, in some cases, I need to modify the individual agent but I can no longer do it (this worked before and stopped working since upgrade sometime last November) I already had the jvm Options as above. Do you have any other suggestions? 

          W added a comment -

          Here is the Jenkins server log exception stack 

          -----------------

          Launching remoting agent (via Trilead SSH2 Connection): java --add-opens java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED -jar /tmp/remoting.jar -workDir /var/lib/jenkins
          Jul 22, 2024 10:42:22 PM WARNING org.eclipse.jetty.server.handler.ContextHandler$Context log
          Error while serving https://xxxxx.com/computer/EC2%20%28ec2%2DEC2Agent%29%20%2D%20Build%20Agent%20%28i%2D02585f0d0615a0e40%29/configSubmit org.kohsuke.stapler.NoStaplerConstructorException: There's no @DataBoundConstructor on any constructor of class java.lang.Boolean at org.kohsuke.stapler.ClassDescriptor.loadConstructorParamNames(ClassDescriptor.java:276) at org.kohsuke.stapler.RequestImpl.instantiate(RequestImpl.java:871) at org.kohsuke.stapler.RequestImpl$TypePair.convertJSON(RequestImpl.java:775) Caused: java.lang.IllegalArgumentException: Failed to instantiate class java.lang.Boolean from {"metadataEndpointEnabled":true,"metadataTokensRequired":true,"metadataHopsLimit":"2"} at org.kohsuke.stapler.RequestImpl$TypePair.convertJSON(RequestImpl.java:778) at org.kohsuke.stapler.RequestImpl.bindJSON(RequestImpl.java:558) at org.kohsuke.stapler.RequestImpl.instantiate(RequestImpl.java:884) Caused: java.lang.IllegalArgumentException: Failed to convert the metadataSupported parameter of the constructor public hudson.plugins.ec2.EC2OndemandSlave(java.lang.String,java.lang.String,java.lang.String,java.lang.String,int,java.lang.String,hudson.model.Node$Mode,java.lang.String,java.lang.String,java.util.List,java.lang.String,java.lang.String,java.lang.String,boolean,java.lang.String,java.lang.String,java.lang.String,java.util.List,java.lang.String,int,hudson.plugins.ec2.AMITypeData,hudson.plugins.ec2.ConnectionStrategy,int,hudson.plugins.ec2.Tenancy,java.lang.Boolean,java.lang.Boolean,java.lang.Integer,java.lang.Boolean) throws hudson.model.Descriptor$FormException,java.io.IOException at org.kohsuke.stapler.RequestImpl.instantiate(RequestImpl.java:886) at org.kohsuke.stapler.RequestImpl$TypePair.convertJSON(RequestImpl.java:775)

          W added a comment - Here is the Jenkins server log exception stack  ----------------- Launching remoting agent (via Trilead SSH2 Connection): java --add-opens java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED -jar /tmp/remoting.jar -workDir /var/lib/jenkins Jul 22, 2024 10:42:22 PM WARNING org.eclipse.jetty.server.handler.ContextHandler$Context log Error while serving https://xxxxx.com/computer/EC2%20%28ec2%2DEC2Agent%29%20%2D%20Build%20Agent%20%28i%2D02585f0d0615a0e40%29/configSubmit org.kohsuke.stapler.NoStaplerConstructorException: There's no @DataBoundConstructor on any constructor of class java.lang.Boolean at org.kohsuke.stapler.ClassDescriptor.loadConstructorParamNames(ClassDescriptor.java:276) at org.kohsuke.stapler.RequestImpl.instantiate(RequestImpl.java:871) at org.kohsuke.stapler.RequestImpl$TypePair.convertJSON(RequestImpl.java:775) Caused: java.lang.IllegalArgumentException: Failed to instantiate class java.lang.Boolean from {"metadataEndpointEnabled":true,"metadataTokensRequired":true,"metadataHopsLimit":"2"} at org.kohsuke.stapler.RequestImpl$TypePair.convertJSON(RequestImpl.java:778) at org.kohsuke.stapler.RequestImpl.bindJSON(RequestImpl.java:558) at org.kohsuke.stapler.RequestImpl.instantiate(RequestImpl.java:884) Caused: java.lang.IllegalArgumentException: Failed to convert the metadataSupported parameter of the constructor public hudson.plugins.ec2.EC2OndemandSlave(java.lang.String,java.lang.String,java.lang.String,java.lang.String,int,java.lang.String,hudson.model.Node$Mode,java.lang.String,java.lang.String,java.util.List,java.lang.String,java.lang.String,java.lang.String,boolean,java.lang.String,java.lang.String,java.lang.String,java.util.List,java.lang.String,int,hudson.plugins.ec2.AMITypeData,hudson.plugins.ec2.ConnectionStrategy,int,hudson.plugins.ec2.Tenancy,java.lang.Boolean,java.lang.Boolean,java.lang.Integer,java.lang.Boolean) throws hudson.model.Descriptor$FormException,java.io.IOException at org.kohsuke.stapler.RequestImpl.instantiate(RequestImpl.java:886) at org.kohsuke.stapler.RequestImpl$TypePair.convertJSON(RequestImpl.java:775)

          W added a comment -

          I found another post with the same issue. There has been no reply yet. Here is the link:
          https://stackoverflow.com/questions/78721585/jenkins-failing-to-update-existing-ec2-worker-node-configuration

          W added a comment - I found another post with the same issue. There has been no reply yet. Here is the link: https://stackoverflow.com/questions/78721585/jenkins-failing-to-update-existing-ec2-worker-node-configuration

          Basil Crow added a comment -

          Duplicates JENKINS-60891.

          Basil Crow added a comment - Duplicates JENKINS-60891 .

            Unassigned Unassigned
            wye W
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: