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

SSH CLI -v (console output) option causes high master CPU utilization

      I trigger a lot of builds remotely using SSH based client. We use the "-s -v -w -r 5" command line options.

      When -v is enabled, the SSH command thread running in the master uses a LOT of CPU. As in a full CPU core. When -v is not enabled this thread does not use any CPU.

        1. Threads - SSH CLI without -v.png
          Threads - SSH CLI without -v.png
          227 kB
        2. Threads - SSH CLI with -v.png
          Threads - SSH CLI with -v.png
          213 kB
        3. V-CPU-support(1).zip
          41 kB
        4. V-CPU-support(2).zip
          41 kB
        5. V-CPU-support(3).zip
          41 kB
        6. V-CPU-support(4).zip
          41 kB
        7. V-CPU-support(5).zip
          41 kB
        8. V-NOCPU-support(1).zip
          42 kB
        9. V-NOCPU-support(2).zip
          42 kB
        10. V-NOCPU-support(3).zip
          42 kB
        11. V-NOCPU-support(4).zip
          42 kB

          [JENKINS-20965] SSH CLI -v (console output) option causes high master CPU utilization

          I could not find another issue report for this problem.

          Walter Kacynski added a comment - I could not find another issue report for this problem.

          After looking at the stack trace a little more digging and I noticed that the Run.writeWholeLogTo was reading and writing the logs as much as possible even if nothing has changed in the logs. As a solution I added a Thread.sleep for 1 second which should prevent high CPU usage. See pull request: https://github.com/jenkinsci/jenkins/pull/1137.

          Steven Christou added a comment - After looking at the stack trace a little more digging and I noticed that the Run.writeWholeLogTo was reading and writing the logs as much as possible even if nothing has changed in the logs. As a solution I added a Thread.sleep for 1 second which should prevent high CPU usage. See pull request: https://github.com/jenkinsci/jenkins/pull/1137 .

          Code changed in jenkins
          User: christ66
          Path:
          core/src/main/java/hudson/model/Run.java
          http://jenkins-ci.org/commit/jenkins/82e94e5e738c988c36181d8c0ff6b9ffed846bcc
          Log:
          [FIXED JENKINS-20965] Run.writeWholeLogTo causes high CPU usage.
          Wait one second before writing to log files. Switched to while loop to
          prevent extra one second delay.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: christ66 Path: core/src/main/java/hudson/model/Run.java http://jenkins-ci.org/commit/jenkins/82e94e5e738c988c36181d8c0ff6b9ffed846bcc Log: [FIXED JENKINS-20965] Run.writeWholeLogTo causes high CPU usage. Wait one second before writing to log files. Switched to while loop to prevent extra one second delay.

          Code changed in jenkins
          User: Jesse Glick
          Path:
          core/src/main/java/hudson/model/Run.java
          http://jenkins-ci.org/commit/jenkins/5d91ed77f7402133fd7c9e77b1a6676c6695ec5a
          Log:
          Merge branch 'JENKINS-20965' of github.com:christ66/jenkins

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: core/src/main/java/hudson/model/Run.java http://jenkins-ci.org/commit/jenkins/5d91ed77f7402133fd7c9e77b1a6676c6695ec5a Log: Merge branch ' JENKINS-20965 ' of github.com:christ66/jenkins

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: changelog.html http://jenkins-ci.org/commit/jenkins/0d77f1795cf97a5e7dbd43f066ab5f97753b464b Log: JENKINS-20965 Noting merge of #1137. Compare: https://github.com/jenkinsci/jenkins/compare/761af2d2dbd2...0d77f1795cf9

          dogfood added a comment -

          Integrated in jenkins_main_trunk #3192
          [FIXED JENKINS-20965] Run.writeWholeLogTo causes high CPU usage. (Revision 82e94e5e738c988c36181d8c0ff6b9ffed846bcc)
          JENKINS-20965 Noting merge of #1137. (Revision 0d77f1795cf97a5e7dbd43f066ab5f97753b464b)

          Result = SUCCESS
          schristou88 : 82e94e5e738c988c36181d8c0ff6b9ffed846bcc
          Files :

          • core/src/main/java/hudson/model/Run.java

          Jesse Glick : 0d77f1795cf97a5e7dbd43f066ab5f97753b464b
          Files :

          • changelog.html

          dogfood added a comment - Integrated in jenkins_main_trunk #3192 [FIXED JENKINS-20965] Run.writeWholeLogTo causes high CPU usage. (Revision 82e94e5e738c988c36181d8c0ff6b9ffed846bcc) JENKINS-20965 Noting merge of #1137. (Revision 0d77f1795cf97a5e7dbd43f066ab5f97753b464b) Result = SUCCESS schristou88 : 82e94e5e738c988c36181d8c0ff6b9ffed846bcc Files : core/src/main/java/hudson/model/Run.java Jesse Glick : 0d77f1795cf97a5e7dbd43f066ab5f97753b464b Files : changelog.html

          Jesse Glick added a comment -

          @walterk82 any particular reason you assigned this to yourself? Steven did the fix.

          Jesse Glick added a comment - @walterk82 any particular reason you assigned this to yourself? Steven did the fix.

          @jglick Nope, I was the reporter so I just closed it.

          Walter Kacynski added a comment - @jglick Nope, I was the reporter so I just closed it.

          Jesse Glick added a comment -

          Somehow you assigned it to yourself in the process.

          Not sure if we really use the “closed” status in JIRA for anything. Generally once a bug is resolved, it is left that way forever.

          Jesse Glick added a comment - Somehow you assigned it to yourself in the process. Not sure if we really use the “closed” status in JIRA for anything. Generally once a bug is resolved, it is left that way forever.

            walterk82 Walter Kacynski
            walterk82 Walter Kacynski
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: