• Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Critical Critical
    • core
    • None
    • [INFO] Maven Version: 3.0.1
      [INFO] JDK Version: 1.6.0_18 normalized as: 1.6.0-18
      [INFO] OS Info: Arch: x86 Family: windows Name: windows 7 Version: 6.1

      The ProcessTreeTest gets a list of all processes (on windows) and has the pid=0 as the base of it
      user has admin rights - tested with and without elevated privs)

      When getEnvironment() is called in the test it causes an exception to be thrown.

      Adding an explict check to ignore the Sytem Idle process can return yet another random process that the user may or may not have access to.

      In my case it is returning PID=820 which is svchost.exe running as "LOCAL SERVICE"
      in the non elevated admin case you see the following error

        org.jvnet.winp.WinpException: Failed to open process error=5 at .\envvar-cmdline.cpp:53
           at org.jvnet.winp.Native.getCmdLineAndEnvVars(Native Method)
      

      for the elevated case you see the following:

        org.jvnet.winp.WinpException: Failed to read PEB error=299 at .\envvar-cmdline.cpp:68
      	at org.jvnet.winp.Native.getCmdLineAndEnvVars(Native Method)
      

      in either case the unit test fails.

          [JENKINS-8614] ProcessTreeTest fails on Windows

          mbaker000 added a comment -

          I also see this issue when running ProcessTreeTest.testRemoting():

          [INFO] Maven Version: 2.1.0
          [INFO] JDK Version: 1.6.0_21 normalized as: 1.6.0-21
          [INFO] OS Info: Arch: x86 Family: windows Name: windows vista Version: 6.0
          .
          .
          .
          org.jvnet.winp.WinpException: Failed to open process error=87 at .\envvar-cmdline.cpp:53
          	at org.jvnet.winp.Native.getCmdLineAndEnvVars(Native Method)
          	at org.jvnet.winp.WinProcess.parseCmdLineAndEnvVars(WinProcess.java:114)
          	at org.jvnet.winp.WinProcess.getEnvironmentVariables(WinProcess.java:109)
          	at hudson.util.ProcessTree$Windows$1.getEnvironmentVariables(ProcessTree.java:419)
          	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
          	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
          	at hudson.remoting.RemoteInvocationHandler$RPCRequest.perform(RemoteInvocationHandler.java:274)
          	at hudson.remoting.RemoteInvocationHandler$RPCRequest.call(RemoteInvocationHandler.java:255)
          	at hudson.remoting.RemoteInvocationHandler$RPCRequest.call(RemoteInvocationHandler.java:215)
          	at hudson.remoting.UserRequest.perform(UserRequest.java:114)
          	at hudson.remoting.UserRequest.perform(UserRequest.java:48)
          	at hudson.remoting.Request$2.run(Request.java:270)
          	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
          	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
          	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
          	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
          	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
          	at java.lang.Thread.run(Thread.java:619)

          I actually don't know why it reads my architecture as x86 when I have Vista 64-bit installed, but whatever. I probably didn't install the 64-bit Java stuff.

          mbaker000 added a comment - I also see this issue when running ProcessTreeTest.testRemoting() : [INFO] Maven Version: 2.1.0 [INFO] JDK Version: 1.6.0_21 normalized as: 1.6.0-21 [INFO] OS Info: Arch: x86 Family: windows Name: windows vista Version: 6.0 . . . org.jvnet.winp.WinpException: Failed to open process error=87 at .\envvar-cmdline.cpp:53 at org.jvnet.winp.Native.getCmdLineAndEnvVars(Native Method) at org.jvnet.winp.WinProcess.parseCmdLineAndEnvVars(WinProcess.java:114) at org.jvnet.winp.WinProcess.getEnvironmentVariables(WinProcess.java:109) at hudson.util.ProcessTree$Windows$1.getEnvironmentVariables(ProcessTree.java:419) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at hudson.remoting.RemoteInvocationHandler$RPCRequest.perform(RemoteInvocationHandler.java:274) at hudson.remoting.RemoteInvocationHandler$RPCRequest.call(RemoteInvocationHandler.java:255) at hudson.remoting.RemoteInvocationHandler$RPCRequest.call(RemoteInvocationHandler.java:215) at hudson.remoting.UserRequest.perform(UserRequest.java:114) at hudson.remoting.UserRequest.perform(UserRequest.java:48) at hudson.remoting.Request$2.run(Request.java:270) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at java.util.concurrent.FutureTask.run(FutureTask.java:138) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:619) I actually don't know why it reads my architecture as x86 when I have Vista 64-bit installed, but whatever. I probably didn't install the 64-bit Java stuff.

          I think the test should be modified to retrieve the information about the current JVM, not the random process, which will prevent this problem.

          Kohsuke Kawaguchi added a comment - I think the test should be modified to retrieve the information about the current JVM, not the random process, which will prevent this problem.

          In the elevated case, the error is probably due to http://java.net/jira/browse/WINP-10
          This is not limited to system processes and this has direct impact on the ability of Jenkins to kill remaining processes after a build. On win7 and winserver 2008R2, winp fails to get the env of some processes launched by the slave node itself, because of this, and in turn does not kill those 'leaking' subprocesses.
          I locally fixed winp with the suggestion in WINP-10, and it indeed solves the error 299.

          Frederic Pesquet added a comment - In the elevated case, the error is probably due to http://java.net/jira/browse/WINP-10 This is not limited to system processes and this has direct impact on the ability of Jenkins to kill remaining processes after a build. On win7 and winserver 2008R2, winp fails to get the env of some processes launched by the slave node itself, because of this, and in turn does not kill those 'leaking' subprocesses. I locally fixed winp with the suggestion in WINP-10, and it indeed solves the error 299.

          Alex Earl added a comment -

          This is still an issue, what can we do to get a fix for this?

          Alex Earl added a comment - This is still an issue, what can we do to get a fix for this?

          Code changed in jenkins
          User: Limin Wang
          Path:
          core/src/main/java/hudson/util/ProcessTree.java
          http://jenkins-ci.org/commit/jenkins/97c28e0a516a1647c3621838fb0629368c7b5873
          Log:
          Fixed JENKINS-8614 ProcessTreeTest fails on Windows

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Limin Wang Path: core/src/main/java/hudson/util/ProcessTree.java http://jenkins-ci.org/commit/jenkins/97c28e0a516a1647c3621838fb0629368c7b5873 Log: Fixed JENKINS-8614 ProcessTreeTest fails on Windows

          Code changed in jenkins
          User: limin wang
          Path:
          core/src/main/java/hudson/util/ProcessTree.java
          http://jenkins-ci.org/commit/jenkins/4709490334c2affd6b82270449daff7a6cb1e5e1
          Log:
          [Fixed JENKINS-8614] ProcessTreeTest fails on Windows
          Add exception handler for getEnvironmentVariables().

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: limin wang Path: core/src/main/java/hudson/util/ProcessTree.java http://jenkins-ci.org/commit/jenkins/4709490334c2affd6b82270449daff7a6cb1e5e1 Log: [Fixed JENKINS-8614] ProcessTreeTest fails on Windows Add exception handler for getEnvironmentVariables().

          Code changed in jenkins
          User: limin wang
          Path:
          core/src/main/java/hudson/util/ProcessTree.java
          http://jenkins-ci.org/commit/jenkins/cdc18ec56987204535c9919ea385c555d3d66863
          Log:
          fixed JENKINS-8614 ProcessTreeTest fails on Windows

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: limin wang Path: core/src/main/java/hudson/util/ProcessTree.java http://jenkins-ci.org/commit/jenkins/cdc18ec56987204535c9919ea385c555d3d66863 Log: fixed JENKINS-8614 ProcessTreeTest fails on Windows

          Code changed in jenkins
          User: Jesse Glick
          Path:
          core/src/main/java/hudson/util/ProcessTree.java
          http://jenkins-ci.org/commit/jenkins/91000fa5699c5fc7b48fcb061be9ded980aa8639
          Log:
          Merge pull request #752 from lmwang/master

          [FIXED JENKINS-8614] ProcessTreeTest fails on Windows

          Compare: https://github.com/jenkinsci/jenkins/compare/b99a794c6ed2...91000fa5699c

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: core/src/main/java/hudson/util/ProcessTree.java http://jenkins-ci.org/commit/jenkins/91000fa5699c5fc7b48fcb061be9ded980aa8639 Log: Merge pull request #752 from lmwang/master [FIXED JENKINS-8614] ProcessTreeTest fails on Windows Compare: https://github.com/jenkinsci/jenkins/compare/b99a794c6ed2...91000fa5699c

          dogfood added a comment -

          Integrated in jenkins_main_trunk #2444
          Fixed JENKINS-8614 ProcessTreeTest fails on Windows (Revision 97c28e0a516a1647c3621838fb0629368c7b5873)
          [Fixed JENKINS-8614] ProcessTreeTest fails on Windows (Revision 4709490334c2affd6b82270449daff7a6cb1e5e1)
          fixed JENKINS-8614 ProcessTreeTest fails on Windows (Revision cdc18ec56987204535c9919ea385c555d3d66863)

          Result = SUCCESS
          wang_limin : 97c28e0a516a1647c3621838fb0629368c7b5873
          Files :

          • core/src/main/java/hudson/util/ProcessTree.java

          wang_limin : 4709490334c2affd6b82270449daff7a6cb1e5e1
          Files :

          • core/src/main/java/hudson/util/ProcessTree.java

          wang_limin : cdc18ec56987204535c9919ea385c555d3d66863
          Files :

          • core/src/main/java/hudson/util/ProcessTree.java

          dogfood added a comment - Integrated in jenkins_main_trunk #2444 Fixed JENKINS-8614 ProcessTreeTest fails on Windows (Revision 97c28e0a516a1647c3621838fb0629368c7b5873) [Fixed JENKINS-8614] ProcessTreeTest fails on Windows (Revision 4709490334c2affd6b82270449daff7a6cb1e5e1) fixed JENKINS-8614 ProcessTreeTest fails on Windows (Revision cdc18ec56987204535c9919ea385c555d3d66863) Result = SUCCESS wang_limin : 97c28e0a516a1647c3621838fb0629368c7b5873 Files : core/src/main/java/hudson/util/ProcessTree.java wang_limin : 4709490334c2affd6b82270449daff7a6cb1e5e1 Files : core/src/main/java/hudson/util/ProcessTree.java wang_limin : cdc18ec56987204535c9919ea385c555d3d66863 Files : core/src/main/java/hudson/util/ProcessTree.java

            Unassigned Unassigned
            teilo James Nord
            Votes:
            5 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: