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

hudson.util.ProcessTree$windows.killAll() is slow on windows

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • core
    • None
    • 2.372

      after every build the processtree killer will kick off.

      on my reasonably powererful windows laptop with lots of stuff open this can take 700+ms

      This impacts every unit test and has been the cause of having to disable some tests on windows - which is not great.

      The code needs to be improved.

      One way to do this is to pass the list of environment variables to check down to C++ and only return the pids for them rather then every pid - which is then parsed and put into a map (which consumes over half of the time)

      I have ~490 processes running,

          [JENKINS-67681] hudson.util.ProcessTree$windows.killAll() is slow on windows

          James Nord created issue -
          James Nord made changes -
          Description Original: after every build the processtree killer will kick off.

          on my reasonably powererful windows laptop with lots of stuff open this can take 700+ms

          This impacts every unit test and has been the cause of having to disable some tests on windows - which is not great.

          The code needs to be improved.

          One way to do this is to pass the list of environment variables to check down to C++ and only return the pids for them rather then every pid - which is then parsed and put into a map (which consumes over half of the time)

           !image-2022-01-26-15-29-32-660.png|thumbnail!
          New: after every build the processtree killer will kick off.

          on my reasonably powererful windows laptop with lots of stuff open this can take 700+ms

          This impacts every unit test and has been the cause of having to disable some tests on windows - which is not great.

          The code needs to be improved.

          One way to do this is to pass the list of environment variables to check down to C++ and only return the pids for them rather then every pid - which is then parsed and put into a map (which consumes over half of the time)

           !image-2022-01-26-15-29-32-660.png|thumbnail!

          I have ~490 processes running,
          James Nord made changes -
          Summary Original: hudson.utul.ProcessTree$windows.killAll() is slow on windows New: hudson.util.ProcessTree$windows.killAll() is slow on windows

          James Nord added a comment -

          a crude JMH benchmark backs up that the native code is not so much the problem but the parsing of the long string afterwards.

          the native call and parsing is using ~2.2ms per call , the native call only is using approx 0.1ms

          I have currently 370+ processes that need to be enumerated to see if they need to be killed for each build. so that is the approximate 700ms per build that the unit test kicks off (and it kicks off a lot of them).

          James Nord added a comment - a crude JMH benchmark backs up that the native code is not so much the problem but the parsing of the long string afterwards. the native call and parsing is using ~2.2ms per call , the native call only is using approx 0.1ms I have currently 370+ processes that need to be enumerated to see if they need to be killed for each build. so that is the approximate 700ms per build that the unit test kicks off (and it kicks off a lot of them).
          James Nord made changes -
          Assignee New: James Nord [ teilo ]
          James Nord made changes -
          Status Original: Open [ 1 ] New: In Progress [ 3 ]
          James Nord made changes -
          Status Original: In Progress [ 3 ] New: Open [ 1 ]
          James Nord made changes -
          Status Original: Open [ 1 ] New: In Progress [ 3 ]
          James Nord made changes -
          Remote Link New: This issue links to "upstream PR (Web Link)" [ 27376 ]
          James Nord made changes -
          Status Original: In Progress [ 3 ] New: In Review [ 10005 ]

            teilo James Nord
            teilo James Nord
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: