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

My Jenkins agent getting disconnected every 7hours

      Hello all,
      I have installed the Jenkins v2.479.3 in windows, I have connected two windows slave machines which has same configuration as my master machine and same version of Java.

      Now, my problem is slaves are getting disconnected for every 7hours, even though jobs are running in it and getting connected back in few seconds.

       

      Please check the date modified for all the log files.

       

       

      I have connected the slaves through the batch command using web socket given in the slave page of Jenkins.

        1. connected_thru_bat_script.png
          connected_thru_bat_script.png
          115 kB
        2. image-2025-02-06-06-03-54-180.png
          image-2025-02-06-06-03-54-180.png
          7 kB
        3. log_files_slave_disconnect.png
          log_files_slave_disconnect.png
          114 kB
        4. slave.log.1
          7 kB
        5. version.png
          version.png
          8 kB

          [JENKINS-75235] My Jenkins agent getting disconnected every 7hours

          Neeraj added a comment -

          Did you notice anything triggering this disconnection? This seems like a network stability issue since it shown websocket errors. Did you try troubleshooting it from your side? Like connecting with another network ?

          Neeraj added a comment - Did you notice anything triggering this disconnection? This seems like a network stability issue since it shown websocket errors. Did you try troubleshooting it from your side? Like connecting with another network ?

          Barathvignesh added a comment -

          Hi Neeraj,

          Thanks! 

          I am facing this issue after migrating the Jenkins master to new windows machine. But i am not sure which is triggering the disconnection exactly for every 7hours and in some other slaves it is 5hours.

          This is the complete log of slave disconnection slave.log.1

          I had tried already with below methods,

          • If the issue is from Jenkins, i had tried installing other version.
          • Connecting the agent using windows service
          • Added no proxy to my env var.
          • Checked my Power options in my machine, it is in High Performance.

          Kindly let me know if i want to try different methods or how to troubleshoot the root cause of the issue.

          Barathvignesh added a comment - Hi Neeraj, Thanks!  I am facing this issue after migrating the Jenkins master to new windows machine. But i am not sure which is triggering the disconnection exactly for every 7hours and in some other slaves it is 5hours. This is the complete log of slave disconnection slave.log.1 I had tried already with below methods, If the issue is from Jenkins, i had tried installing other version. Connecting the agent using windows service Added no proxy to my env var. Checked my Power options in my machine, it is in High Performance. Kindly let me know if i want to try different methods or how to troubleshoot the root cause of the issue.

          Neeraj added a comment -

          Have you tried implementing it on a Linux machine? If not, would it be possible to do so and check if the issue persists? This could help narrow down the cause of the problem.

          Neeraj added a comment - Have you tried implementing it on a Linux machine? If not, would it be possible to do so and check if the issue persists? This could help narrow down the cause of the problem.

          Neeraj added a comment - - edited

          Also please checkout this issue from stackoverflow and check if this works : https://stackoverflow.com/questions/45433225/jenkins-windows-agent-connection-getting-terminated-with-java-nio-channels-close

           

          Please update after trying our all the solutions given in the source. One of the main reasons they say is due to the incompatability between the  Java Versions of master and slave.

          They also mentions about increasing the idle time. For instance, if a single command takes more than 60 seconds without no log output the load balancer will terminate the session ( If you are using aws along with an ELB)

           

          Neeraj added a comment - - edited Also please checkout this issue from stackoverflow and check if this works : https://stackoverflow.com/questions/45433225/jenkins-windows-agent-connection-getting-terminated-with-java-nio-channels-close   Please update after trying our all the solutions given in the source. One of the main reasons they say is due to the incompatability between the  Java Versions of master and slave. They also mentions about increasing the idle time. For instance, if a single command takes more than 60 seconds without no log output the load balancer will terminate the session ( If you are using aws along with an ELB)  

          Barathvignesh added a comment -

          Unfortunately, It is not possible to implement on Linux machine.

          Then, we are not using AWS machines, we do have physical windows.

          Tried methods:

          • Same version of Java in both master and slave
            openjdk version "17.0.9" 2023-10-17 LTS
            OpenJDK Runtime Environment Zulu17.46+20-SA (build 17.0.9+8-LTS)
            OpenJDK 64-Bit Server VM Zulu17.46+20-SA (build 17.0.9+8-LTS, mixed mode, sharing)
            
          • Power option is already High performance.
          • Slave configuration already,

          Barathvignesh added a comment - Unfortunately, It is not possible to implement on Linux machine. Then, we are not using AWS machines, we do have physical windows. Tried methods: Same version of Java in both master and slave openjdk version "17.0.9" 2023-10-17 LTS OpenJDK Runtime Environment Zulu17.46+20-SA (build 17.0.9+8-LTS) OpenJDK 64-Bit Server VM Zulu17.46+20-SA (build 17.0.9+8-LTS, mixed mode, sharing) Power option is already High performance. Slave configuration already,

          Neeraj added a comment - - edited

          Hey Barath,  sorry for the late reply. I spoke with the maintainer and these are the solutions he proposed:

          1. Network Stability:  
             - If you SSH into the agent machine manually, does it also disconnect after 7 hours?  
             - If yes, then it’s probably a network issue rather than a Jenkins-specific problem.  

          2. Agent Connection Type:  
             - Does the issue happen for both inbound agents and SSH (outbound) build agents?  
             - If only one type fails, that might point to where the problem is.  

          3. Version Mismatch:  
             - Are the remoting versions on the controller and agent the same?  
             - Are they running the same Java version?  
             - The Version Node Monitors plugin can help check this.  

           

          Can you please try SSH and check if it is disconnecting?

          Also please do checkout this documentation : https://plugins.jenkins.io/versioncolumn/

          Neeraj added a comment - - edited Hey Barath,  sorry for the late reply. I spoke with the maintainer and these are the solutions he proposed: 1. Network Stability:      - If you SSH into the agent machine manually, does it also disconnect after 7 hours?      - If yes, then it’s probably a network issue rather than a Jenkins-specific problem.   2. Agent Connection Type:      - Does the issue happen for both inbound agents and SSH (outbound) build agents?      - If only one type fails, that might point to where the problem is.   3. Version Mismatch:      - Are the remoting versions on the controller and agent the same?      - Are they running the same Java version?      - The Version Node Monitors plugin can help check this.     Can you please try SSH and check if it is disconnecting? Also please do checkout this documentation : https://plugins.jenkins.io/versioncolumn/

          Barathvignesh added a comment -

          I  have tried with the plugin, which matches the version

           

           

          Now, I am trying to connect agent using SSH and let you know soon!

          Barathvignesh added a comment - I  have tried with the plugin, which matches the version     Now, I am trying to connect agent using SSH and let you know soon!

            neergasm Neeraj
            barath_jk Barathvignesh
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: