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

Failed to read environment variable table error

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved (View Workflow)
    • Major
    • Resolution: Fixed
    • core
    • org.jvnet.winp.WinpException: Failed to read environment variable table error=299 at .\envvar-cmdline.cpp:201

    Description

      I have checked for this defect online but couldn't get a solution. The job doesn't terminate the job correctly. The Jenkins version is the latest one. Some more details are

      Environment - Windows 7
      Jenkins service is started with my user id and pasword.

      The error that I get is ERROR: Build step failed with exception
      org.jvnet.winp.WinpException: Failed to read environment variable table error=299 at .\envvar-cmdline.cpp:201
      at org.jvnet.winp.Native.getCmdLineAndEnvVars(Native Method)
      at org.jvnet.winp.WinProcess.parseCmdLineAndEnvVars(WinProcess.java:126)
      at org.jvnet.winp.WinProcess.getCommandLine(WinProcess.java:102)
      at org.jvnet.winp.WinProcess.killRecursively(WinProcess.java:66)
      at hudson.util.ProcessTree$Windows$1.killRecursively(ProcessTree.java:425)
      at hudson.util.ProcessTree.killAll(ProcessTree.java:141)
      at hudson.Proc$LocalProc.destroy(Proc.java:379)
      at hudson.Proc$LocalProc.join(Proc.java:352)
      at hudson.Launcher$ProcStarter.join(Launcher.java:389)
      at hudson.tasks.Ant.perform(Ant.java:217)
      at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
      at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:779)
      at hudson.model.Build$BuildExecution.build(Build.java:205)
      at hudson.model.Build$BuildExecution.doRun(Build.java:162)
      at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:537)
      at hudson.model.Run.execute(Run.java:1741)
      at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
      at hudson.model.ResourceController.execute(ResourceController.java:98)
      at hudson.model.Executor.run(Executor.java:408

      Attachments

        Issue Links

          Activity

            apellant mani sankar added a comment -

            I changed the default ant configuration in jenkins job to a custom installation and that worked. But this issue should not still appear if the default jenkins is used.

            apellant mani sankar added a comment - I changed the default ant configuration in jenkins job to a custom installation and that worked. But this issue should not still appear if the default jenkins is used.
            oleg_nenashev Oleg Nenashev added a comment -

            The issue still exists from what I see

            oleg_nenashev Oleg Nenashev added a comment - The issue still exists from what I see
            oleg_nenashev Oleg Nenashev added a comment -

            So JENKINS-8614 just worked around the issue in tests.
            From what I see, the shortcut is to just disable FINE logging for the class https://github.com/kohsuke/winp/blob/master/src/main/java/org/jvnet/winp/WinProcess.java#L66
            Working on a better solution

            oleg_nenashev Oleg Nenashev added a comment - So JENKINS-8614 just worked around the issue in tests. From what I see, the shortcut is to just disable FINE logging for the class https://github.com/kohsuke/winp/blob/master/src/main/java/org/jvnet/winp/WinProcess.java#L66 Working on a better solution
            oleg_nenashev Oleg Nenashev added a comment - - edited

            Disclaimer: the workaround above applies only to that particular stacktrace in the issue description, it does not help in the case of other failures, e.g.

            org.jvnet.winp.WinpException: Failed to read environment variable table error=299 at .\envvar-cmdline.cpp:201 
            at org.jvnet.winp.Native.getCmdLineAndEnvVars(Native Method) 
            at org.jvnet.winp.WinProcess.parseCmdLineAndEnvVars(WinProcess.java:126) 
            at org.jvnet.winp.WinProcess.getEnvironmentVariables(WinProcess.java:121) 
            at hudson.util.ProcessTree$Windows$1.getEnvironmentVariables(ProcessTree.java:452) 
            at hudson.util.ProcessTree$OSProcess.hasMatchingEnvVars(ProcessTree.java:276) 
            at hudson.util.ProcessTree$Windows.killAll(ProcessTree.java:478) 
            at hudson.Launcher$RemoteLauncher$KillTask.call(Launcher.java:965) 
            at hudson.Launcher$RemoteLauncher$KillTask.call(Launcher.java:956) 
            at hudson.remoting.UserRequest.perform(UserRequest.java:121) 
            at hudson.remoting.UserRequest.perform(UserRequest.java:49) 
            at hudson.remoting.Request$2.run(Request.java:325) 
            at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68) 
            at java.util.concurrent.FutureTask.run(Unknown Source) 
            at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) 
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) 
            at hudson.remoting.Engine$1$1.run(Engine.java:69) 
            at java.lang.Thread.run(Unknown Source)
            

            I will check if there is a better solution I could apply

            oleg_nenashev Oleg Nenashev added a comment - - edited Disclaimer: the workaround above applies only to that particular stacktrace in the issue description, it does not help in the case of other failures, e.g. org.jvnet.winp.WinpException: Failed to read environment variable table error=299 at .\envvar-cmdline.cpp:201 at org.jvnet.winp.Native.getCmdLineAndEnvVars(Native Method) at org.jvnet.winp.WinProcess.parseCmdLineAndEnvVars(WinProcess.java:126) at org.jvnet.winp.WinProcess.getEnvironmentVariables(WinProcess.java:121) at hudson.util.ProcessTree$Windows$1.getEnvironmentVariables(ProcessTree.java:452) at hudson.util.ProcessTree$OSProcess.hasMatchingEnvVars(ProcessTree.java:276) at hudson.util.ProcessTree$Windows.killAll(ProcessTree.java:478) at hudson.Launcher$RemoteLauncher$KillTask.call(Launcher.java:965) at hudson.Launcher$RemoteLauncher$KillTask.call(Launcher.java:956) at hudson.remoting.UserRequest.perform(UserRequest.java:121) at hudson.remoting.UserRequest.perform(UserRequest.java:49) at hudson.remoting.Request$2.run(Request.java:325) at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at hudson.remoting.Engine$1$1.run(Engine.java:69) at java.lang.Thread.run(Unknown Source) I will check if there is a better solution I could apply
            oleg_nenashev Oleg Nenashev added a comment -

            I am currently working on the fix. I wish I could just take the implementation from processhacker2 "https://github.com/processhacker2/processhacker2/blob/69d9dcd2c79d52ce987cc8f0150f639426eb67f9/phlib/native.c#L867-L990", but it cannot be done since the code there is GNU GPL. Will consider alternatives

            oleg_nenashev Oleg Nenashev added a comment - I am currently working on the fix. I wish I could just take the implementation from processhacker2 "https://github.com/processhacker2/processhacker2/blob/69d9dcd2c79d52ce987cc8f0150f639426eb67f9/phlib/native.c#L867-L990", but it cannot be done since the code there is GNU GPL. Will consider alternatives
            oleg_nenashev Oleg Nenashev added a comment -

            Partial fix in WinP, which reduces the issue frequency: https://github.com/kohsuke/winp/pull/34

            oleg_nenashev Oleg Nenashev added a comment - Partial fix in WinP, which reduces the issue frequency: https://github.com/kohsuke/winp/pull/34
            lattiflo Dustin Bortner added a comment - - edited

            I had the exact error and call stack described in this JIRA issue. The solution for me was to disable Git Credential Manager as as described in the following: https://support.cloudbees.com/hc/en-us/articles/221046888-Build-Hang-or-Fail-with-Git-for-Windows

            It took me hours to find that article, so I hope this helps someone. I know CloudBees is involved in the new development for Jenkins, so there should be consolidation or cross-linking of such issue reports and solutions. It was a surprising solution, since I last updated Git for Windows a long time ago and the Jenkins pipeline ran fine until today.

            lattiflo Dustin Bortner added a comment - - edited I had the exact error and call stack described in this JIRA issue. The solution for me was to disable Git Credential Manager as as described in the following: https://support.cloudbees.com/hc/en-us/articles/221046888-Build-Hang-or-Fail-with-Git-for-Windows It took me hours to find that article, so I hope this helps someone. I know CloudBees is involved in the new development for Jenkins, so there should be consolidation or cross-linking of such issue reports and solutions. It was a surprising solution, since I last updated Git for Windows a long time ago and the Jenkins pipeline ran fine until today.
            oleg_nenashev Oleg Nenashev added a comment -

            Hi Dustin. Are you sure you had exactly the same as in the ticket (winp, error 299)? I will try to reproduce, but I do not see a direct relation

            oleg_nenashev Oleg Nenashev added a comment - Hi Dustin. Are you sure you had exactly the same as in the ticket (winp, error 299)? I will try to reproduce, but I do not see a direct relation
            oleg_nenashev Oleg Nenashev added a comment -

            WinP 1.25 improves diagnostics of the issues happening when accessing processes in the native part: https://github.com/kohsuke/winp/blob/master/CHANGELOG.md#125 . It will also prevent the reported issue when Jenkins does not actually need environment variables.

             

            Created  JENKINS-44368 to update the core

            oleg_nenashev Oleg Nenashev added a comment - WinP 1.25 improves diagnostics of the issues happening when accessing processes in the native part: https://github.com/kohsuke/winp/blob/master/CHANGELOG.md#125  . It will also prevent the reported issue when Jenkins does not actually need environment variables.   Created  JENKINS-44368  to update the core

            Code changed in jenkins
            User: Oleg Nenashev
            Path:
            core/pom.xml
            http://jenkins-ci.org/commit/jenkins/6f9a833f9236b33406843cba57b765036ad4b334
            Log:
            JENKINS-44368 - Update WinP to 1.25 in order to improve diagnostics of issues like JENKINS-30782

            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Oleg Nenashev Path: core/pom.xml http://jenkins-ci.org/commit/jenkins/6f9a833f9236b33406843cba57b765036ad4b334 Log: JENKINS-44368 - Update WinP to 1.25 in order to improve diagnostics of issues like JENKINS-30782

            Code changed in jenkins
            User: Oleg Nenashev
            Path:
            core/pom.xml
            http://jenkins-ci.org/commit/jenkins/bfd1f088e3ffa40260501fd2dbd9c196aad6be40
            Log:
            Merge pull request #2893 from oleg-nenashev/winp/1.25

            JENKINS-44368 - Update WinP to 1.25 in order to improve diagnostics of issues like JENKINS-30782

            Compare: https://github.com/jenkinsci/jenkins/compare/a27b73993d26...bfd1f088e3ff

            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Oleg Nenashev Path: core/pom.xml http://jenkins-ci.org/commit/jenkins/bfd1f088e3ffa40260501fd2dbd9c196aad6be40 Log: Merge pull request #2893 from oleg-nenashev/winp/1.25 JENKINS-44368 - Update WinP to 1.25 in order to improve diagnostics of issues like JENKINS-30782 Compare: https://github.com/jenkinsci/jenkins/compare/a27b73993d26...bfd1f088e3ff
            oleg_nenashev Oleg Nenashev added a comment -

            Starting from 2.62 there is improved diagnostics in the library.

            If you still see the issue, please try this version and report the results

            oleg_nenashev Oleg Nenashev added a comment - Starting from 2.62 there is improved diagnostics in the library. If you still see the issue, please try this version and report the results
            oleg_nenashev Oleg Nenashev added a comment -

            I am closing this issue because WinP 1.25 offers some fixes and extra diagnostics. I you still experience the issue on newer versions, please reopen the issue

            oleg_nenashev Oleg Nenashev added a comment - I am closing this issue because WinP 1.25 offers some fixes and extra diagnostics. I you still experience the issue on newer versions, please reopen the issue

            People

              oleg_nenashev Oleg Nenashev
              apellant mani sankar
              Votes:
              3 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: