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

Windows Agents getting disconnected after jenkins restart

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Critical Critical
    • ec2-plugin
    • None

      Jenkins 2.346.1

      EC2 plugin version - 2.0.1 

      Windows Agents are hanging at the following after Jenkins restart
      Sep 07, 2022 12:08:47 AM hudson.plugins.ec2.EC2Cloud
      INFO: Copying remoting.jar to: c:/windows/temp

      We tried debugging, but logs didn't indicate anything. This happens 100% of the time and only to windows agents.

      After deleting the Agent and recreating new one, it is able to connect to the master. Please note that Windows agents are hanging after Jenkins restart and they cannot reattach.

      We haven't noticed same issue happening for Linux agents.

      Agent config:
      <hudson.plugins.ec2.EC2Slave plugin="ec2@2.0.1">
      <name>EC2 (EC2 Agent) - WinAgent (i-xxxxxxxxx)</name>
      <remoteFS>C:\jenkins</remoteFS>
      <numExecutors>1</numExecutors>
      <mode>EXCLUSIVE</mode>
      <retentionStrategy class="hudson.plugins.ec2.EC2RetentionStrategy">
      <nextCheckAfter>-1</nextCheckAfter>
      <idleTerminationMinutes>180</idleTerminationMinutes>
      </retentionStrategy>
      <launcher class="hudson.plugins.ec2.ssh.EC2UnixLauncher"/>
      <label>windows-buildnode</label>
      <nodeProperties/>
      <instanceId>i-xxxxxxxxx</instanceId>
      <initScript/>
      <tmpDir>c:/windows/temp</tmpDir>
      <remoteAdmin>admin</remoteAdmin>
      <templateDescription>WinAgent</templateDescription>
      <javaPath>java</javaPath>
      <jvmopts/>
      <stopOnTerminate>false</stopOnTerminate>
      <idleTerminationMinutes>180</idleTerminationMinutes>
      <isConnected>false</isConnected>
      <tags class="linked-list">
      <hudson.plugins.ec2.EC2Tag>
      <name>jenkins_slave_type</name>
      <value>demand_WinAgent</value>
      </hudson.plugins.ec2.EC2Tag>
      <hudson.plugins.ec2.EC2Tag>
      <name>Name</name>
      <value>Jenkins-WinAgent</value>
      </hudson.plugins.ec2.EC2Tag>
      <hudson.plugins.ec2.EC2Tag>
      <name>jenkins_server_url</name>
      <value>https://jenkins-master.example.com/jenkins/</value>
      </hudson.plugins.ec2.EC2Tag>
      </tags>
      <cloudName>ec2-EC2 Agent</cloudName>
      <amiType class="hudson.plugins.ec2.UnixData">
      <rootCommandPrefix/>
      <slaveCommandPrefix/>
      <slaveCommandSuffix/>
      <sshPort>22</sshPort>
      <bootDelay/>
      </amiType>
      <maxTotalUses>-1</maxTotalUses>
      <tenancy>Default</tenancy>
      <metadataEndpointEnabled>true</metadataEndpointEnabled>
      <metadataTokensRequired>false</metadataTokensRequired>
      <metadataHopsLimit>1</metadataHopsLimit>
      <launchTimeout>2147483647</launchTimeout>
      </hudson.plugins.ec2.EC2Slave>

       

      Logs from the Agent:

      Sep 07, 2022 12:10:53 AM hudson.remoting.SynchronousCommandTransport$ReaderThread run
      INFO: I/O error in channel channel
      java.io.IOException: Unexpected termination of the channel
          at hudson.remoting.SynchronousCommandTransport$ReaderThread.run(SynchronousCommandTransport.java:75)
      Caused by: java.io.EOFException
          at java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2681)
          at java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputStream.java:3156)
          at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:862)
          at java.io.ObjectInputStream.<init>(ObjectInputStream.java:358)
          at hudson.remoting.ObjectInputStreamEx.<init>(ObjectInputStreamEx.java:49)
          at hudson.remoting.Command.readFrom(Command.java:142)
          at hudson.remoting.Command.readFrom(Command.java:128)
          at hudson.remoting.AbstractSynchronousByteArrayCommandTransport.read(AbstractSynchronousByteArrayCommandTransport.java:35)
          at hudson.remoting.SynchronousCommandTransport$ReaderThread.run(SynchronousCommandTransport.java:61)

      Any help will be highly appreciated.

      Thanks in advance!

          [JENKINS-69540] Windows Agents getting disconnected after jenkins restart

          Todor Ivanov added a comment -

          [root@ip-xxxxxxxx EC2 (EC2 Agent) - WinAgent (i-xxxxxxxx)]# ls -la
          total 44
          drwxr-x---  2 tomcat tomcat  6144 Sep  7 00:08 .
          drwxr-xr-x 69 tomcat tomcat 14336 Sep  7 07:04 ..
          rw-r----  1 tomcat tomcat  2102 Sep  7 00:08 slave.log
          rw-r----  1 tomcat tomcat 21478 Sep  6 23:57 slave.log.1

          This is the agent log before the jenkins master restart (slave.log.1):

          INFO: Copying remoting.jar to: c:/windows/temp
          Sep 06, 2022 11:57:06 PM hudson.plugins.ec2.EC2Cloud
          INFO: Launching remoting agent (via Trilead SSH2 Connection):  java  -jar c:/windows/temp/remoting.jar -workDir C:\jenkins
          <===[JENKINS REMOTING CAPACITY]===>Remoting version: 4.13.2
          Launcher: EC2UnixLauncher
          Communication Protocol: Standard in/out
          This is a Windows agent
          Agent successfully connected and online

           

          This is agent log after jenkins master restart (slave.log):

          Sep 07, 2022 12:08:47 AM hudson.plugins.ec2.EC2Cloud
          INFO: Copying remoting.jar to: c:/windows/temp

           

          Todor Ivanov added a comment - [root@ip-xxxxxxxx EC2 (EC2 Agent) - WinAgent (i-xxxxxxxx)] # ls -la total 44 drwxr-x---  2 tomcat tomcat  6144 Sep  7 00:08 . drwxr-xr-x 69 tomcat tomcat 14336 Sep  7 07:04 .. rw-r ----  1 tomcat tomcat  2102 Sep  7 00:08 slave.log rw-r ----  1 tomcat tomcat 21478 Sep  6 23:57 slave.log.1 This is the agent log before the jenkins master restart (slave.log.1): INFO: Copying remoting.jar to: c:/windows/temp Sep 06, 2022 11:57:06 PM hudson.plugins.ec2.EC2Cloud INFO: Launching remoting agent (via Trilead SSH2 Connection):  java  -jar c:/windows/temp/remoting.jar -workDir C:\jenkins <=== [JENKINS REMOTING CAPACITY] ===>Remoting version: 4.13.2 Launcher: EC2UnixLauncher Communication Protocol: Standard in/out This is a Windows agent Agent successfully connected and online   This is agent log after jenkins master restart (slave.log): Sep 07, 2022 12:08:47 AM hudson.plugins.ec2.EC2Cloud INFO: Copying remoting.jar to: c:/windows/temp  

            thoulen FABRIZIO MANFREDI
            todori438 Todor Ivanov
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: