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

EC2 Plugin terminates windows instance right after connecting when using ssh.

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Blocker
    • Resolution: Not A Defect
    • ec2-plugin
    • None
    • EC2 Plugin 1.46.1
      Jenkins 2.187

    Description

      collapseBuild Executor Status
      Oct 07, 2019 10:54:25 AM hudson.plugins.ec2.EC2Cloud
      INFO: Launching instance: i-0b3686cd8938dd562
      Oct 07, 2019 10:54:25 AM hudson.plugins.ec2.EC2Cloud
      INFO: bootstrap()
      Oct 07, 2019 10:54:25 AM hudson.plugins.ec2.EC2Cloud
      INFO: Getting keypair...
      Oct 07, 2019 10:54:25 AM hudson.plugins.ec2.EC2Cloud
      INFO: Using private key jenkins-builder (SHA-1 fingerprint f3:b6:14:0d:dd:ef:5e:4a:30:e8:3e:47:6f:30:46:f4:b6:dc:8a:b0)
      Oct 07, 2019 10:54:25 AM hudson.plugins.ec2.EC2Cloud
      INFO: Authenticating as cluj
      Oct 07, 2019 10:54:25 AM hudson.plugins.ec2.EC2Cloud
      INFO: Connecting to 10.230.0.233 on port 22, with timeout 10000.
      Oct 07, 2019 10:54:35 AM hudson.plugins.ec2.EC2Cloud
      INFO: Failed to connect via ssh: The kexTimeout (10000 ms) expired.
      Oct 07, 2019 10:54:35 AM hudson.plugins.ec2.EC2Cloud
      INFO: Waiting for SSH to come up. Sleeping 5.
      Oct 07, 2019 10:54:40 AM hudson.plugins.ec2.EC2Cloud
      INFO: Connecting to 10.230.0.233 on port 22, with timeout 10000.
      Oct 07, 2019 10:54:50 AM hudson.plugins.ec2.EC2Cloud
      INFO: Failed to connect via ssh: The kexTimeout (10000 ms) expired.
      Oct 07, 2019 10:54:50 AM hudson.plugins.ec2.EC2Cloud
      INFO: Waiting for SSH to come up. Sleeping 5.
      Oct 07, 2019 10:54:55 AM hudson.plugins.ec2.EC2Cloud
      INFO: Connecting to 10.230.0.233 on port 22, with timeout 10000.
      Oct 07, 2019 10:55:05 AM hudson.plugins.ec2.EC2Cloud
      INFO: Failed to connect via ssh: The kexTimeout (10000 ms) expired.
      Oct 07, 2019 10:55:05 AM hudson.plugins.ec2.EC2Cloud
      INFO: Waiting for SSH to come up. Sleeping 5.
      Oct 07, 2019 10:55:10 AM hudson.plugins.ec2.EC2Cloud
      INFO: Connecting to 10.230.0.233 on port 22, with timeout 10000.
      Oct 07, 2019 10:55:20 AM hudson.plugins.ec2.EC2Cloud
      INFO: Failed to connect via ssh: The kexTimeout (10000 ms) expired.
      Oct 07, 2019 10:55:20 AM hudson.plugins.ec2.EC2Cloud
      INFO: Waiting for SSH to come up. Sleeping 5.
      Oct 07, 2019 10:55:25 AM hudson.plugins.ec2.EC2Cloud
      INFO: Connecting to 10.230.0.233 on port 22, with timeout 10000.
      Oct 07, 2019 10:55:27 AM hudson.plugins.ec2.EC2Cloud
      INFO: Connected via SSH.
      Oct 07, 2019 10:55:27 AM hudson.plugins.ec2.EC2Cloud
      INFO: connect fresh as root
      Oct 07, 2019 10:55:28 AM hudson.plugins.ec2.EC2Cloud
      INFO: Connecting to 10.230.0.233 on port 22, with timeout 10000.
      Oct 07, 2019 10:55:28 AM hudson.plugins.ec2.EC2Cloud
      INFO: Connected via SSH.
      Oct 07, 2019 10:55:29 AM hudson.plugins.ec2.EC2Cloud
      INFO: Creating tmp directory (/tmp) if it does not exist
      The syntax of the command is incorrect.
      Oct 07, 2019 10:55:29 AM hudson.plugins.ec2.EC2Cloud
      INFO: Verifying: java -fullversion
      java full version "1.8.0_131-b11"
      Oct 07, 2019 10:55:31 AM hudson.plugins.ec2.EC2Cloud
      INFO: Verifying: which scp
      /usr/bin/scp
      Oct 07, 2019 10:55:32 AM hudson.plugins.ec2.EC2Cloud
      INFO: Copying remoting.jar to: /tmp
      Oct 07, 2019 10:55:33 AM hudson.plugins.ec2.EC2Cloud
      INFO: Launching remoting agent (via Trilead SSH2 Connection):  java  -jar /tmp/remoting.jar -workDir C:\Users\cluj
      HTTP ERROR 404Problem accessing /computer/EC2%20(Itiviti%20AWS)%20-%20Windows%20Jenkins%20node%20autoconnecting%20to%20deb-jenkins-prd%20using%20Swarm%20plugin%20(i-0b3686cd8938dd562)/logText/progressiveHtml. Reason:    Not Found
      Powered by Jetty:// 9.4.z-SNAPSHOT
      

      When trying to set up the connection between AWS & Jenkins windows nodes via ssh, the node gets immediately terminated after connecting via ssh. Please find attached the Jenkins AWS Configuration.

       

       

      EDIT

      **I've downgraded to version 1.43 and the node is not terminated anymore, but I get:

      INFO: Waiting for SSH to come up. Sleeping 5.
      INFO: Waiting for SSH to come up. Sleeping 5.
      Oct 08, 2019 6:55:11 AM hudson.plugins.ec2.EC2Cloud
      INFO: Connecting to 10.230.0.193 on port 22, with timeout 10000.
      Oct 08, 2019 6:55:12 AM hudson.plugins.ec2.EC2Cloud
      INFO: Connected via SSH.
      Oct 08, 2019 6:55:12 AM hudson.plugins.ec2.EC2Cloud
      INFO: connect fresh as root
      Oct 08, 2019 6:55:12 AM hudson.plugins.ec2.EC2Cloud
      INFO: Connecting to 10.230.0.193 on port 22, with timeout 10000.
      Oct 08, 2019 6:55:13 AM hudson.plugins.ec2.EC2Cloud
      INFO: Connected via SSH.
      Oct 08, 2019 6:55:14 AM hudson.plugins.ec2.EC2Cloud
      INFO: Creating tmp directory (/tmp) if it does not existThe syntax of the command is incorrect.
      Oct 08, 2019 6:55:14 AM hudson.plugins.ec2.EC2Cloud
      INFO: Verifying: java -fullversionjava full version "1.8.0_131-b11"
      Oct 08, 2019 6:55:17 AM hudson.plugins.ec2.EC2CloudINFO: Verifying: which scp/usr/bin/scp
      Oct 08, 2019 6:55:19 AM hudson.plugins.ec2.EC2Cloud
      INFO: Copying slave.jar to: /tmp
      Oct 08, 2019 6:55:20 AM hudson.plugins.ec2.EC2Cloud
      INFO: Launching slave agent (via SSH client process): ssh -o StrictHostKeyChecking=no -i /tmp/ec2_527682778172280023.pem cluj@10.230.0.193 -p 22  java  -jar /tmp/slave.jar[10/08/19 06:55:20] Launching agent$ ssh -o StrictHostKeyChecking=no -i /tmp/ec2_527682778172280023.pem cluj@10.230.0.193 -p 22  java  -jar /tmp/slave.jarWarning: Permanently added '10.230.0.193' (ECDSA) to the list of known hosts.
      Error: Unable to access jarfile /tmp/slave.jar
      ERROR: Unable to launch the agent for EC2 (Itiviti AWS) - AWS Windows Node (i-0d24e1b4cc97b791d)
      java.io.EOFException: unexpected stream termination at hudson.remoting.ChannelBuilder.negotiate(ChannelBuilder.java:415) at hudson.remoting.ChannelBuilder.build(ChannelBuilder.java:360) at hudson.slaves.SlaveComputer.setChannel(SlaveComputer.java:431) at hudson.slaves.CommandLauncher.launch(CommandLauncher.java:153) at hudson.plugins.ec2.ssh.EC2UnixLauncher.launchScript(EC2UnixLauncher.java:234) at hudson.plugins.ec2.EC2ComputerLauncher.launch(EC2ComputerLauncher.java:48) at hudson.slaves.SlaveComputer$1.call(SlaveComputer.java:294) at jenkins.util.ContextResettingExecutorService$2.call(ContextResettingExecutorService.java:46) at jenkins.security.ImpersonatingExecutorService$2.call(ImpersonatingExecutorService.java:71) 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)
      ERROR: Process terminated with exit code 1
      

       

      Attachments

        1. Capture3.PNG
          Capture3.PNG
          39 kB
        2. Capture2.PNG
          Capture2.PNG
          48 kB
        3. Capture.PNG
          Capture.PNG
          37 kB

        Activity

          According to https://issues.jenkins-ci.org/browse/JENKINS-58193 the issue was released in 1.44.2, but it is reproducible with version 1.46.1

          gcimpoies George Cimpoies added a comment - According to  https://issues.jenkins-ci.org/browse/JENKINS-58193  the issue was released in 1.44.2, but it is reproducible with version 1.46.1

          Your node is a windows node but you seem to have unix paths everywhere.

          You are also accessing the node via ssh.

          Assuming you do want to access it via ssh you need to set the temp directory to be a windows path. The default temp directory is a unix path, that is where i think your issue lies.

          This is unrelated to 58193

          raihaan Raihaan Shouhell added a comment - Your node is a windows node but you seem to have unix paths everywhere. You are also accessing the node via ssh. Assuming you do want to access it via ssh you need to set the temp directory to be a windows path. The default temp directory is a unix path, that is where i think your issue lies. This is unrelated to 58193

          gcimpoies is this still an issue? To me this is working as intended.

          raihaan Raihaan Shouhell added a comment - gcimpoies is this still an issue? To me this is working as intended.

          raihaan works perfectly after overriding the temp directory. I'll close the issue. Just out of curiosity, is there any other option to force the plugin to connect to a windows node through ssh, other than setting the ami type to unix? (even though the ami is actually windows). Thanks!

          gcimpoies George Cimpoies added a comment - raihaan works perfectly after overriding the temp directory. I'll close the issue. Just out of curiosity, is there any other option to force the plugin to connect to a windows node through ssh, other than setting the ami type to unix? (even though the ami is actually windows). Thanks!

          At present no because SSH is not that common

          raihaan Raihaan Shouhell added a comment - At present no because SSH is not that common

          People

            thoulen FABRIZIO MANFREDI
            gcimpoies George Cimpoies
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: