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

Peformance issue at java.util.WeakHashMap.put(WeakHashMap.java:453)

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      I have recently see in an instance the following stacktrace repeated several times and consuming a full core of a processor. This indicates something wrong in either the plugin or directly in the Java implementation of java.util.WeakHashMap.put

      Doing a little bit of research found http://adambien.blog/roller/abien/entry/endless_loops_in_unsychronized_weakhashmap , which indicates we should synchronize the access to WeakHashMap should be synchornized.

      As per https://docs.oracle.com/javase/7/docs/api/java/util/WeakHashMap.html 

      Like most collection classes, this class is not synchronized. A synchronized WeakHashMap may be constructed using the Collections.synchronizedMap method.
      
      • Stacktrace
      "SSHLauncher.launch for '<MY_NODE>' node [#1]" #360017 prio=5 os_prio=0 tid=0x00007f91bc204000 nid=0x1cd20 runnable [0x00007f90bbd0c000]
         java.lang.Thread.State: RUNNABLE
          at java.util.WeakHashMap.put(WeakHashMap.java:453)
          at org.jenkinsci.plugins.workflow.FilePathUtils$Listener.addChannel(FilePathUtils.java:158)
          at org.jenkinsci.plugins.workflow.FilePathUtils$Listener.preOnline(FilePathUtils.java:147)
          at hudson.slaves.SlaveComputer.setChannel(SlaveComputer.java:540)
          at hudson.slaves.SlaveComputer.setChannel(SlaveComputer.java:381)
          at hudson.plugins.sshslaves.SSHLauncher.startSlave(SSHLauncher.java:979)
          at hudson.plugins.sshslaves.SSHLauncher.access$400(SSHLauncher.java:139)
          at hudson.plugins.sshslaves.SSHLauncher$2.call(SSHLauncher.java:728)
          at hudson.plugins.sshslaves.SSHLauncher$2.call(SSHLauncher.java:709)
          at java.util.concurrent.FutureTask.run(FutureTask.java:266)
          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
          at java.lang.Thread.run(Thread.java:745)
      
         Locked ownable synchronizers:
          - <0x00000003e64323a8> (a java.util.concurrent.ThreadPoolExecutor$Worker)
      

       

        Attachments

          Issue Links

            Activity

            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Félix Belzunce Arcos
            Path:
            src/main/java/org/jenkinsci/plugins/workflow/FilePathUtils.java
            http://jenkins-ci.org/commit/workflow-api-plugin/2f3eb3c65e3cdca0c47e484108db0078835bd494
            Log:
            JENKINS-47725 Make the access to WeakHashMap synchronized

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Félix Belzunce Arcos Path: src/main/java/org/jenkinsci/plugins/workflow/FilePathUtils.java http://jenkins-ci.org/commit/workflow-api-plugin/2f3eb3c65e3cdca0c47e484108db0078835bd494 Log: JENKINS-47725 Make the access to WeakHashMap synchronized
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Félix Belzunce Arcos
            Path:
            src/main/java/org/jenkinsci/plugins/workflow/FilePathUtils.java
            http://jenkins-ci.org/commit/workflow-api-plugin/6fd5902152f481747fef2ec43ef246d5c8a758df
            Log:
            JENKINS-47725 Delete sync comment

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Félix Belzunce Arcos Path: src/main/java/org/jenkinsci/plugins/workflow/FilePathUtils.java http://jenkins-ci.org/commit/workflow-api-plugin/6fd5902152f481747fef2ec43ef246d5c8a758df Log: JENKINS-47725 Delete sync comment
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Sam Van Oort
            Path:
            src/main/java/org/jenkinsci/plugins/workflow/FilePathUtils.java
            http://jenkins-ci.org/commit/workflow-api-plugin/76f501eb688095d032bc5b9e4c9a55d0aa6b4bdd
            Log:
            Merge pull request #58 from fbelzunc/JENKINS-47725

            [FIXED JENKINS-47725] Make the access to WeakHashMap synchronized

            Compare: https://github.com/jenkinsci/workflow-api-plugin/compare/1d1c6833fe1a...76f501eb6880

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Sam Van Oort Path: src/main/java/org/jenkinsci/plugins/workflow/FilePathUtils.java http://jenkins-ci.org/commit/workflow-api-plugin/76f501eb688095d032bc5b9e4c9a55d0aa6b4bdd Log: Merge pull request #58 from fbelzunc/ JENKINS-47725 [FIXED JENKINS-47725] Make the access to WeakHashMap synchronized Compare: https://github.com/jenkinsci/workflow-api-plugin/compare/1d1c6833fe1a...76f501eb6880

              People

              • Assignee:
                fbelzunc Félix Belzunce Arcos
                Reporter:
                fbelzunc Félix Belzunce Arcos
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: