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

Execute shell FATAL: command execution failed

      When use "Extended Choice Parameter plug-in" together with "JSON parameter type",
      I'll hit the error below for "Exeucte Shell" in "Promotion process / Action".

      When use "Extended Choice Parameter plug-in" together with "Basic Parameter Types",
      then everything is ok.

      Below is the JSON groovy script I'm using:

      import org.boon.Boon;
      
      def jsonEditorOptions = Boon.fromJson(/{
      disable_edit_json: true,
      disable_properties: true,
      no_additional_properties: false,
      disable_collapse: true,
      disable_array_add: false,
      disable_array_delete: false,
      disable_array_reorder: true,
      theme: "bootstrap2",
      iconlib:"bootstrap3",
      
      schema: {
      "type": "object",
      "title": "Coverage Report Generator",
      "properties": {
      	"Report Description": {
      		"type": "string",
      		"propertyOrder": 1,
      		"default": "Description",
      	},
      
      	"Build File": {
      		"type": "string",
      		"propertyOrder": 2,
      		"media" : { "binaryEncoding": "base64" },
      		"options" : { "include_filename": true },
      	},
      
      	"Coverage File": {
      		"type": "string",
      		"propertyOrder": 3,
      		"media" : { "binaryEncoding": "base64" },
      		"options" : { "include_filename": true },
      	},
      
      	"Diff File": {
      		"type": "string",
      		"propertyOrder": 4,
      		"media" : { "binaryEncoding": "base64" },
      		"options" : { "include_filename": true },
      	},
      
      	"Extra Coverage Files": {
      		"type": "array",
      		"propertyOrder": 5,
      		"title": "Extra Coverage Files",
      		"format": "table",
      		"uniqueItems": true,
      		"items": {
      			"type": "object",
      			"title": "Coverage Files",
      			"properties": {
      				"File": {
      					"type": "string",
      					"propertyOrder": 1,
      					"media" : { "binaryEncoding": "base64" },
      					"options" : { "include_filename": true },
      				}
      			}
      		}
      	},
      }
      startval: [ ]
      }/);
      
      return jsonEditorOptions;
      

      Under "Promotion process / Actions",
      I add an action "Execute shell" with commands below:

      #!/bin/bash
      echo "test!!!"
      

      And promotion job is always failed with:

      [Test_Coverage_Report] $ /bin/bash -xe /tmp/hudson4980267768844983951.sh
      FATAL: command execution failed
      java.io.IOException: Cannot run program "/bin/bash" (in directory "/home/devops/jenkins_slave/workspace/ReviewBoard/Test_Coverage_Report"): error=7, Argument list too long
      	at java.lang.ProcessBuilder.start(ProcessBuilder.java:1047)
      	at hudson.Proc$LocalProc.<init>(Proc.java:244)
      	at hudson.Proc$LocalProc.<init>(Proc.java:216)
      	at hudson.Launcher$LocalLauncher.launch(Launcher.java:815)
      	at hudson.Launcher$ProcStarter.start(Launcher.java:381)
      	at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:1148)
      	at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:1113)
      	at hudson.remoting.UserRequest.perform(UserRequest.java:120)
      	at hudson.remoting.UserRequest.perform(UserRequest.java:48)
      	at hudson.remoting.Request$2.run(Request.java:326)
      	at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:262)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      	at java.lang.Thread.run(Thread.java:745)
      	at ......remote call to jenkins-slave98(172.18.25.208)(Native Method)
      	at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1416)
      	at hudson.remoting.UserResponse.retrieve(UserRequest.java:220)
      	at hudson.remoting.Channel.call(Channel.java:781)
      	at hudson.Launcher$RemoteLauncher.launch(Launcher.java:928)
      	at hudson.Launcher$ProcStarter.start(Launcher.java:381)
      	at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:95)
      	at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:64)
      	at hudson.plugins.promoted_builds.Promotion$RunnerImpl.build(Promotion.java:405)
      	at hudson.plugins.promoted_builds.Promotion$RunnerImpl.doRun(Promotion.java:347)
      	at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:534)
      	at hudson.model.Run.execute(Run.java:1738)
      	at hudson.model.Run.run(Run.java:1676)
      	at hudson.plugins.promoted_builds.Promotion.run(Promotion.java:286)
      	at hudson.model.ResourceController.execute(ResourceController.java:98)
      	at hudson.model.Executor.run(Executor.java:410)
      Caused by: java.io.IOException: error=7, Argument list too long
      	at java.lang.UNIXProcess.forkAndExec(Native Method)
      	at java.lang.UNIXProcess.<init>(UNIXProcess.java:187)
      	at java.lang.ProcessImpl.start(ProcessImpl.java:130)
      	at java.lang.ProcessBuilder.start(ProcessBuilder.java:1028)
      	at hudson.Proc$LocalProc.<init>(Proc.java:244)
      	at hudson.Proc$LocalProc.<init>(Proc.java:216)
      	at hudson.Launcher$LocalLauncher.launch(Launcher.java:815)
      	at hudson.Launcher$ProcStarter.start(Launcher.java:381)
      	at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:1148)
      	at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:1113)
      	at hudson.remoting.UserRequest.perform(UserRequest.java:120)
      	at hudson.remoting.UserRequest.perform(UserRequest.java:48)
      	at hudson.remoting.Request$2.run(Request.java:326)
      	at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:262)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      	at java.lang.Thread.run(Thread.java:745)
      failed build hudson.tasks.Shell@6d29c4a8 SUCCESS
      

          [JENKINS-35480] Execute shell FATAL: command execution failed

          I'm aware that you don't have a space, but to clear any confuse.

          The problem appears when there is a space between hashbang and shell path:

          #! /bin/bash
          

          When I removed it then it works fine.

          #!/bin/bash
          

          Installation: apt
          Jenkins: 2.7
          Tomcat: No
          Java: 8 oracle (1.8.0_91)
          System: Ubuntu 14.04.4
          

          Ahmed AbouZaid added a comment - I'm aware that you don't have a space, but to clear any confuse. The problem appears when there is a space between hashbang and shell path: #! /bin/bash When I removed it then it works fine. #!/bin/bash Installation: apt Jenkins: 2.7 Tomcat: No Java: 8 oracle (1.8.0_91) System : Ubuntu 14.04.4

          Rick Liu added a comment -

          I just added the space between the hash-bang and /bin/bash,
          but still got error.

          #! /bin/bash -xe
          
          echo "test!!!"
          
          [Test_Coverage_Report] $  /bin/bash -xe /tmp/hudson1672939348743230101.sh
          FATAL: command execution failed
          java.io.IOException: Cannot run program "" (in directory "/home/devops/jenkins_slave/workspace/ReviewBoard/Test_Coverage_Report"): error=2, No such file or directory
          	at java.lang.ProcessBuilder.start(ProcessBuilder.java:1047)
          	at hudson.Proc$LocalProc.<init>(Proc.java:244)
          	at hudson.Proc$LocalProc.<init>(Proc.java:216)
          	at hudson.Launcher$LocalLauncher.launch(Launcher.java:815)
          	at hudson.Launcher$ProcStarter.start(Launcher.java:381)
          	at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:1148)
          	at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:1113)
          	at hudson.remoting.UserRequest.perform(UserRequest.java:120)
          	at hudson.remoting.UserRequest.perform(UserRequest.java:48)
          	at hudson.remoting.Request$2.run(Request.java:326)
          	at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
          	at java.util.concurrent.FutureTask.run(FutureTask.java:262)
          	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
          	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
          	at java.lang.Thread.run(Thread.java:745)
          	at ......remote call to jenkins-slave97(172.16.81.60)(Native Method)
          	at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1416)
          	at hudson.remoting.UserResponse.retrieve(UserRequest.java:220)
          	at hudson.remoting.Channel.call(Channel.java:781)
          	at hudson.Launcher$RemoteLauncher.launch(Launcher.java:928)
          	at hudson.Launcher$ProcStarter.start(Launcher.java:381)
          	at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:95)
          	at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:64)
          	at hudson.plugins.promoted_builds.Promotion$RunnerImpl.build(Promotion.java:405)
          	at hudson.plugins.promoted_builds.Promotion$RunnerImpl.doRun(Promotion.java:347)
          	at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:534)
          	at hudson.model.Run.execute(Run.java:1738)
          	at hudson.model.Run.run(Run.java:1676)
          	at hudson.plugins.promoted_builds.Promotion.run(Promotion.java:286)
          	at hudson.model.ResourceController.execute(ResourceController.java:98)
          	at hudson.model.Executor.run(Executor.java:410)
          Caused by: java.io.IOException: error=2, No such file or directory
          	at java.lang.UNIXProcess.forkAndExec(Native Method)
          	at java.lang.UNIXProcess.<init>(UNIXProcess.java:187)
          	at java.lang.ProcessImpl.start(ProcessImpl.java:130)
          	at java.lang.ProcessBuilder.start(ProcessBuilder.java:1028)
          	at hudson.Proc$LocalProc.<init>(Proc.java:244)
          	at hudson.Proc$LocalProc.<init>(Proc.java:216)
          	at hudson.Launcher$LocalLauncher.launch(Launcher.java:815)
          	at hudson.Launcher$ProcStarter.start(Launcher.java:381)
          	at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:1148)
          	at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:1113)
          	at hudson.remoting.UserRequest.perform(UserRequest.java:120)
          	at hudson.remoting.UserRequest.perform(UserRequest.java:48)
          	at hudson.remoting.Request$2.run(Request.java:326)
          	at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
          	at java.util.concurrent.FutureTask.run(FutureTask.java:262)
          	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
          	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
          	at java.lang.Thread.run(Thread.java:745)
          failed build hudson.tasks.Shell@5a55e981 SUCCESS
          

          Rick Liu added a comment - I just added the space between the hash-bang and /bin/bash, but still got error. #! /bin/bash -xe echo "test!!!" [Test_Coverage_Report] $ /bin/bash -xe /tmp/hudson1672939348743230101.sh FATAL: command execution failed java.io.IOException: Cannot run program "" (in directory " /home/devops/jenkins_slave/workspace/ReviewBoard/Test_Coverage_Report"): error=2, No such file or directory at java.lang.ProcessBuilder.start(ProcessBuilder.java:1047) at hudson.Proc$LocalProc.<init>(Proc.java:244) at hudson.Proc$LocalProc.<init>(Proc.java:216) at hudson.Launcher$LocalLauncher.launch(Launcher.java:815) at hudson.Launcher$ProcStarter.start(Launcher.java:381) at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:1148) at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:1113) at hudson.remoting.UserRequest.perform(UserRequest.java:120) at hudson.remoting.UserRequest.perform(UserRequest.java:48) at hudson.remoting.Request$2.run(Request.java:326) at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang. Thread .run( Thread .java:745) at ......remote call to jenkins-slave97(172.16.81.60)(Native Method) at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1416) at hudson.remoting.UserResponse.retrieve(UserRequest.java:220) at hudson.remoting.Channel.call(Channel.java:781) at hudson.Launcher$RemoteLauncher.launch(Launcher.java:928) at hudson.Launcher$ProcStarter.start(Launcher.java:381) at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:95) at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:64) at hudson.plugins.promoted_builds.Promotion$RunnerImpl.build(Promotion.java:405) at hudson.plugins.promoted_builds.Promotion$RunnerImpl.doRun(Promotion.java:347) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:534) at hudson.model.Run.execute(Run.java:1738) at hudson.model.Run.run(Run.java:1676) at hudson.plugins.promoted_builds.Promotion.run(Promotion.java:286) at hudson.model.ResourceController.execute(ResourceController.java:98) at hudson.model.Executor.run(Executor.java:410) Caused by: java.io.IOException: error=2, No such file or directory at java.lang.UNIXProcess.forkAndExec(Native Method) at java.lang.UNIXProcess.<init>(UNIXProcess.java:187) at java.lang.ProcessImpl.start(ProcessImpl.java:130) at java.lang.ProcessBuilder.start(ProcessBuilder.java:1028) at hudson.Proc$LocalProc.<init>(Proc.java:244) at hudson.Proc$LocalProc.<init>(Proc.java:216) at hudson.Launcher$LocalLauncher.launch(Launcher.java:815) at hudson.Launcher$ProcStarter.start(Launcher.java:381) at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:1148) at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:1113) at hudson.remoting.UserRequest.perform(UserRequest.java:120) at hudson.remoting.UserRequest.perform(UserRequest.java:48) at hudson.remoting.Request$2.run(Request.java:326) at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang. Thread .run( Thread .java:745) failed build hudson.tasks.Shell@5a55e981 SUCCESS

          Rick Liu added a comment -

          Ok I just found out this error happened
          only when I use "Extended Choice Parameter" plug-in and use "JSON parameter type".

          If I use "Extended Choice Parameter" plug-in and use "Basic Parameter Types ",
          then everything works.

          Rick Liu added a comment - Ok I just found out this error happened only when I use "Extended Choice Parameter" plug-in and use "JSON parameter type". If I use "Extended Choice Parameter" plug-in and use "Basic Parameter Types ", then everything works.

          vimil added a comment -

          This is because the json data has exceeded the maximum allowed commandline length.

          You will have to use the 'save json to file' option in extended choice parameter plugin configuration. When you do this a file containing json contents is saved to the job location and its path is passed to the shell instead of the json content itself

          vimil added a comment - This is because the json data has exceeded the maximum allowed commandline length. You will have to use the 'save json to file' option in extended choice parameter plugin configuration. When you do this a file containing json contents is saved to the job location and its path is passed to the shell instead of the json content itself

          Rick Liu added a comment -

          I have already selected "save parameters to file" but it's still the same

          Rick Liu added a comment - I have already selected "save parameters to file" but it's still the same

          Oleg Nenashev added a comment -

          Sorry, over last months I had no time to work on the plugin, because I had to focus on the Jenkins core and other projects. I also have not been using this plugin on my own since 2016. So I have decided to unassign the issues so that there is no expectation that I work on them anytime soon.

          Currently the plugin is being transfered to another maintainer. Hopefully he will have some time to finish triaging of the issues and maybe to deliver some fixes. But, as in any community-driven project, everybody is welcome to propose pull requests and to contribute to the plugin's state.

          Oleg Nenashev added a comment - Sorry, over last months I had no time to work on the plugin, because I had to focus on the Jenkins core and other projects. I also have not been using this plugin on my own since 2016. So I have decided to unassign the issues so that there is no expectation that I work on them anytime soon. Currently the plugin is being transfered to another maintainer. Hopefully he will have some time to finish triaging of the issues and maybe to deliver some fixes. But, as in any community-driven project, everybody is welcome to propose pull requests and to contribute to the plugin's state.

            Unassigned Unassigned
            totoroliu Rick Liu
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: