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

“Could not initialize class ProcessLiveness$LibC” running sh on Windows

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Minor Minor
    • durable-task-plugin
    • Jenkins 2.32.2
      Linux master, Windows slave
      Pipeline 2.5
      Pipeline Groovy 2.27
      Pipeline Job 2.10
      Pipeline Nodes and Processes 2.9
      Pipeline Stage 2.2

      I have two Windows slaves. When I run pipeline jobs on these slaves I get tons of error messages

      Cannot contact Windows7: java.io.IOException: Remote call on Channel to /172.17.xxx.xxx failed
      

      Yet the job finishes successfully. A minimal example to reproduce is

      node('windows') {
          stage('Test') {
              sh '''
                  for ((i=0; i < 100; i++)); do
                      echo $i
                      sleep 1
                  done
              '''
          }
      }
      

      Executing the same shell script via a freestyle job on the same Windows slave works without any error messages therefore it's very likely that this is a bug in the pipeline implementation.
      Restarting slaves and master doesn't change anything. I also couldn't find any more information in log files (or I am looking at the wrong place)

          [JENKINS-42405] “Could not initialize class ProcessLiveness$LibC” running sh on Windows

          Joe Fowler added a comment -

          Thanks Ivan.... I downgraded that plugin form 2.10 to 2.8, and it has fixed the problem in my case as well. 

          Joe Fowler added a comment - Thanks Ivan.... I downgraded that plugin form 2.10 to 2.8, and it has fixed the problem in my case as well. 

          I can confirm that a dependency to the "Pipeline: Nodes and Processes" plugin introduced the error, and a downgrade from version 2.10 to 2.8 removed the error message;
          Cannot contact <slave>: java.io.IOException: Remote call on Channel to /<ip> failed

          One plugin which is dependent on version 2.10 of this plugin is BlueOcean 1.0.0-b25

          Anders Holmblad added a comment - I can confirm that a dependency to the "Pipeline: Nodes and Processes" plugin introduced the error, and a downgrade from version 2.10 to 2.8 removed the error message; Cannot contact <slave>: java.io.IOException: Remote call on Channel to /<ip> failed One plugin which is dependent on version 2.10 of this plugin is BlueOcean 1.0.0-b25

          Jesse Glick added a comment -

          Not really a regression; the problem was always there, but until recently not reported unless you happened to have enabled a FINE logger in DurableTaskStep.

          The problem here is that you trying to run the sh step on Windows. It is only tested on Linux. Use bat. Probably sh could be supported under some configurations, but this would require some further development to disable features which will not run in a non-POSIX system, including the process liveness check, as well as an automated test environment capable of running basic scenarios and detecting regressions.

          Jesse Glick added a comment - Not really a regression; the problem was always there, but until recently not reported unless you happened to have enabled a FINE logger in DurableTaskStep . The problem here is that you trying to run the sh step on Windows. It is only tested on Linux. Use bat . Probably sh could be supported under some configurations, but this would require some further development to disable features which will not run in a non-POSIX system, including the process liveness check, as well as an automated test environment capable of running basic scenarios and detecting regressions.

          Well, everything works perfectly with Freestyle jobs under Windows. This essentially means, executing shell (bash) scripts under Windows isn't supported with pipelines? And I guess I cannot execute shell scripts with the bat command? Using batch files isn't an option.

          Thorsten Meinl added a comment - Well, everything works perfectly with Freestyle jobs under Windows. This essentially means, executing shell (bash) scripts under Windows isn't supported with pipelines? And I guess I cannot execute shell scripts with the bat command? Using batch files isn't an option.

          This error is present on linux nodes as well...

           

          Wynand van Wyk added a comment - This error is present on linux nodes as well...  

          The main reason for the update of the "Pipeline Nodes and Processes" plugin to version 2.9 was to include a dependency to the "Durable task" plugin to version 1.13, to solve an issue with Environment variables.

          It is a bit ironic then that the second main issue solved in the "Durable task" plugin v1.13 was;
          "JENKINS-40225 Replace backslashes when on Cygwin to allow sh to be used.", given the information that Pipeline is not supposed to support the shell on Windows

          Anders Holmblad added a comment - The main reason for the update of the "Pipeline Nodes and Processes" plugin to version 2.9 was to include a dependency to the "Durable task" plugin to version 1.13, to solve an issue with Environment variables. It is a bit ironic then that the second main issue solved in the "Durable task" plugin v1.13 was; " JENKINS-40225 Replace backslashes when on Cygwin to allow sh to be used.", given the information that Pipeline is not supposed to support the shell on Windows

          Joe Fowler added a comment -

          Installing Blue Ocean, which of course needed to update "Pipeline: Nodes and Processes", and of course the problem has returned..   This is on Linux, not Windows.   Still no resolution to this problem, other than to downgrade, which is really not an option for me any longer. 

          Joe Fowler added a comment - Installing Blue Ocean, which of course needed to update "Pipeline: Nodes and Processes", and of course the problem has returned..   This is on Linux, not Windows.   Still no resolution to this problem, other than to downgrade, which is really not an option for me any longer. 

          Oleg Nenashev added a comment -

          There is an ongoing fix for JENKINS-38682, which should resolve this issue as well. https://github.com/jenkinsci/durable-task-plugin/pull/43

          Oleg Nenashev added a comment - There is an ongoing fix for JENKINS-38682 , which should resolve this issue as well.  https://github.com/jenkinsci/durable-task-plugin/pull/43

          James Nord added a comment -

          Well, everything works perfectly with Freestyle jobs under Windows.

          No one actually ferd back - but the reason is that this is 2 different beasts. the sh step in a pipeline will survive a disconnect of the agent (ie start a long running sh step and then restart your master, or pull the network cable on your agent and then reconnect it) . Pipelines support durability so the sh step will continue to run and when the master-agent comms are restored the pipeline will pickup the scripts process, in a freestyle build doing this will cause your build will fail.

          This essentially means, executing shell (bash) scripts under Windows isn't supported with pipelines? And I guess I cannot execute shell scripts with the bat command? Using batch files isn't an option.

          you can call shell scripts from a bat. if you write the shell script to a file then use bat "sh thescript.sh".

          James Nord added a comment - Well, everything works perfectly with Freestyle jobs under Windows. No one actually ferd back - but the reason is that this is 2 different beasts. the sh step in a pipeline will survive a disconnect of the agent (ie start a long running sh step and then restart your master, or pull the network cable on your agent and then reconnect it) . Pipelines support durability so the sh step will continue to run and when the master-agent comms are restored the pipeline will pickup the scripts process, in a freestyle build doing this will cause your build will fail. This essentially means, executing shell (bash) scripts under Windows isn't supported with pipelines? And I guess I cannot execute shell scripts with the bat command? Using batch files isn't an option. you can call shell scripts from a bat. if you write the shell script to a file then use bat "sh thescript.sh" .

          Jesse Glick added a comment -

          Should have been solved—or, at least, changed!—by JENKINS-47791.

          Jesse Glick added a comment - Should have been solved—or, at least, changed!—by  JENKINS-47791 .

            Unassigned Unassigned
            sithmein Thorsten Meinl
            Votes:
            8 Vote for this issue
            Watchers:
            14 Start watching this issue

              Created:
              Updated:
              Resolved: