Pipeline - bug - shell scripts fail when parameters are too large.

3,279 views
Skip to first unread message

Jonathan Hodgson

unread,
Sep 28, 2016, 10:41:55 AM9/28/16
to Jenkins Developers
I don't seem to have an option to add issues on Jira, so I'll have to report this here

I have a pipeline job that takes various parameters (all supplied by a script on a remote machine invoking the build).

The problem is, that if those parameters get too large, shell scripts called from jenkins fail!

It's not the content of the script, because as an experiment I've reduced that line to

sh "echo hello"

Hard to go wrong with that (this part of the pipeline script is running on the master, a debian linux machine)

Nor is it the specific content of the parameters, again for test purposes I've reduced one parameter to being simply a string of repeating 'x" characters.

If the string is short, all is well.

If it's long, then I get

[Pipeline] echo An Error Occured java.io.IOException: Cannot run program "nohup" (in directory "/var/lib/jenkins/workspace/WPF-TryBuild/impOSCar"): error=7, Argument list too long [Pipeline] End of Pipeline java.io.IOException: Cannot run program "nohup" (in directory "/var/lib/jenkins/workspace/WPF-TryBuild/impOSCar"): error=7, Argument list too long at java.lang.ProcessBuilder.start(ProcessBuilder.java:1047) at hudson.Proc$LocalProc.<init>(Proc.java:243) at hudson.Proc$LocalProc.<init>(Proc.java:212) at hudson.Launcher$LocalLauncher.launch(Launcher.java:815) at hudson.Launcher$ProcStarter.start(Launcher.java:381) at org.jenkinsci.plugins.durabletask.BourneShellScript.launchWithCookie(BourneShellScript.java:147) at org.jenkinsci.plugins.durabletask.FileMonitoringTask.launch(FileMonitoringTask.java:61) at org.jenkinsci.plugins.workflow.steps.durable_task.DurableTaskStep$Execution.start(DurableTaskStep.java:158) at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:184) at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:126) at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:109) at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:48) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113) at com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:16) at WorkflowScript.checkOutWithPatch(WorkflowScript:117) at WorkflowScript.checkoutGroovy(WorkflowScript:140) at ___cps.transform___(Native Method) at com.cloudbees.groovy.cps.impl.ContinuationGroup.methodCall(ContinuationGroup.java:48) at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:109) at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixArg(FunctionCallBlock.java:82) at sun.reflect.GeneratedMethodAccessor441.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72) at com.cloudbees.groovy.cps.impl.ConstantBlock.eval(ConstantBlock.java:21) at com.cloudbees.groovy.cps.Next.step(Next.java:58) at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:154) at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:163) at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:324) at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$100(CpsThreadGroup.java:78) at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:236) at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:224) at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:63) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:112) at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) 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) 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:243) at hudson.Proc$LocalProc.<init>(Proc.java:212) at hudson.Launcher$LocalLauncher.launch(Launcher.java:815) at hudson.Launcher$ProcStarter.start(Launcher.java:381) at org.jenkinsci.plugins.durabletask.BourneShellScript.launchWithCookie(BourneShellScript.java:147) at org.jenkinsci.plugins.durabletask.FileMonitoringTask.launch(FileMonitoringTask.java:61) at org.jenkinsci.plugins.workflow.steps.durable_task.DurableTaskStep$Execution.start(DurableTaskStep.java:158) at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:184) at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:126) at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:109) at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:48) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113) at com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:16) ... 24 more

The bug manifests itself when teh parameter is somewhere between 130000 and 140000 characters long.

The only thing I can add is that this seems to be recent, I was successfully sending MUCH bigger parameter strings a few weeks ago (the parameter is a unified diff). I couldn't say what update caused it to break though, because I've been trying to fix other problems with the project and using shorter test patches while I've been doing it.

Daniel Beck

unread,
Sep 28, 2016, 10:57:10 AM9/28/16
to jenkin...@googlegroups.com
Report bugs in our bug tracker.

https://wiki.jenkins-ci.org/display/JENKINS/How+to+report+an+issue

Include a complete Jenkinsfile/job configuration/whatever else is needed to reproduce this issue from scratch.
> --
> You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-de...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/29589bbf-8f44-4323-87e1-07428d795858%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Jesse Glick

unread,
Sep 28, 2016, 11:12:21 AM9/28/16
to Jenkins Dev
On Wed, Sep 28, 2016 at 10:41 AM, Jonathan Hodgson
<j.r.h...@gmail.com> wrote:
> this seems to be recent

As of Pipeline: Job 2.7, build parameters will be in your environment,
not just as Groovy variables. If you want to mask this one, just use
`withEnv`.

Offhand sounds like a Linux limitation; certainly sending such large
values for parameters is not an intended use case.

Jonathan Hodgson

unread,
Sep 28, 2016, 11:15:41 AM9/28/16
to Jenkins Developers, m...@beckweb.net
I'd love to, but I can't ee a  "report an issue" option on the JIRA homepage.

As I mentioned in my first post.

Maybe I'm going blind, or mad, in fact the latter is quite likely having spent  trying to deal with encoding issues forced on me by that fact that for some reason pipeline builds don't support file parameters, and having fixed that bumped into this.

Could someone please point me to where the "report an issue button/link is?"

Jonathan Hodgson

unread,
Sep 28, 2016, 11:18:36 AM9/28/16
to Jenkins Developers
But I'm not even using the parameter at that point, I'm just calling shell with "echo hello", how can that be a linux limitation?
Plus, it worked fine before, on the same machine, with MUCH bigger parameters.

Personally I'd rather not be sending these diffs as a string parameter, it's a pain in the arse, but until such time as File Parameters worlk in pipeline builds, I have no choice if I want to provide try-before-commit functionality. 

Slide

unread,
Sep 28, 2016, 11:26:39 AM9/28/16
to Jenkins Developers

Is there a reason you can't send the path to the file that the diff comes from?


--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-de...@googlegroups.com.

Jonathan Hodgson

unread,
Sep 28, 2016, 12:59:00 PM9/28/16
to Jenkins Developers


On Wednesday, September 28, 2016 at 4:26:39 PM UTC+1, slide wrote:

Is there a reason you can't send the path to the file that the diff comes from?



Because the diff is created on a remote machine, the one requesting the build. so it has to be a push operation.

What I'm basically trying to do is replicate the "patch file as a parameter" option available on normal jobs. (It's still there as a selectable option on pipeline jobs, but it doesn't work, another bug in my opinion, it should either work, or not be on the option list).

After MUCH messing about (due in part to diffs containing different character encodings and Groovy being seemingly determined to be "helpful" and convert encodings, and Groovy doing some things mind-bogglingly slowly) I appeared to have engineered a solution, only to find that in the meantime this bug had cropped up.

 

Jonathan Hodgson

unread,
Sep 28, 2016, 1:02:35 PM9/28/16
to Jenkins Developers
Well I can now see a "Create" button on the JIRA homepage.

I don't know if that changed while I was out, or if it's just a result the break/walk in the fresh air/coffee returning some sanity to my mangled brain, but I will put together a proper bug report on there now.

Jonathan Hodgson

unread,
Sep 28, 2016, 2:10:20 PM9/28/16
to Jenkins Developers
Ticket now created


I further streamlined my scripts to isolate the issue. Basically as soon as any single parameter goes over a certain length (13065 characters in my tests) all shell scripts stop working
Reply all
Reply to author
Forward
0 new messages