Shared library function cannot call other shared library function in separate file if called function uses "writeFile"

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Shared library function cannot call other shared library function in separate file if called function uses "writeFile"

David Karr
The statement I make in the subject doesn't make sense, but I don't know how else to describe it.

I'm working on a set of builds using scripted pipelines.  Our Jenkinsfiles are very short, all of the build logic is in the shared library.  In the "main" shared library function, I'm trying to call another function defined in another "vars" class.  We have many of these already.  In this called function, I have a call to the "writeFile" pipeline step to create a temporary file used by a shell script called immediately after that.  This is the only place anywhere in our builds that we call "writeFile".

When I run the build, I get this very unhelpful message:

Jenkins Job Failed due to Exception : org.codehaus.groovy.control.ErrorCollector

There is literally no other information provided, except for the log lines that come before it.  I found that an echo statement that is called before this suspect function is called is emitted in the log.  An echo statement as the first line of the "call()" method of the function being called is NOT emitted in the log. Somehow the act of calling the function makes it die, with no explanation.

So, I tried a workaround.  In the calling script file, I added a "def" at the end of the file, to define an "inline function" with almost the same name as the "vars" function name.  I copied the entire body of the "call()" method of the vars function into that inline function.  I replaced the call to the vars function with the call to the inline function.  It worked on the first try.

Any ideas what might cause this?

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/3119e9f3-e6a8-4fa6-861a-76c9358ab300%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

AW: Shared library function cannot call other shared library function in separate file if called function uses "writeFile"

Reinhold Füreder
Hi David,

I think that could be related to https://issues.jenkins-ci.org/browse/JENKINS-50736, because there is a pipeline basic step called 'writeFile' (see https://jenkins.io/doc/pipeline/steps/workflow-basic-steps/#writefile-write-file-to-workspace), but maybe Jesse Glick or Andrew Bayer can shed some more light on this issue...

HTH Reinhold


Von: [hidden email] <[hidden email]> im Auftrag von David Karr <[hidden email]>
Gesendet: Freitag, 7. Februar 2020 21:51
An: Jenkins Users <[hidden email]>
Betreff: Shared library function cannot call other shared library function in separate file if called function uses "writeFile"
 
The statement I make in the subject doesn't make sense, but I don't know how else to describe it.

I'm working on a set of builds using scripted pipelines.  Our Jenkinsfiles are very short, all of the build logic is in the shared library.  In the "main" shared library function, I'm trying to call another function defined in another "vars" class.  We have many of these already.  In this called function, I have a call to the "writeFile" pipeline step to create a temporary file used by a shell script called immediately after that.  This is the only place anywhere in our builds that we call "writeFile".

When I run the build, I get this very unhelpful message:

Jenkins Job Failed due to Exception : org.codehaus.groovy.control.ErrorCollector

There is literally no other information provided, except for the log lines that come before it.  I found that an echo statement that is called before this suspect function is called is emitted in the log.  An echo statement as the first line of the "call()" method of the function being called is NOT emitted in the log. Somehow the act of calling the function makes it die, with no explanation.

So, I tried a workaround.  In the calling script file, I added a "def" at the end of the file, to define an "inline function" with almost the same name as the "vars" function name.  I copied the entire body of the "call()" method of the vars function into that inline function.  I replaced the call to the vars function with the call to the inline function.  It worked on the first try.

Any ideas what might cause this?

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/3119e9f3-e6a8-4fa6-861a-76c9358ab300%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/AM0PR01MB6147F74252A8BD51D29E9A77F71F0%40AM0PR01MB6147.eurprd01.prod.exchangelabs.com.
Reply | Threaded
Open this post in threaded view
|

Re: Shared library function cannot call other shared library function in separate file if called function uses "writeFile"

Jan Monterrubio
Yeah you’re probably getting namespace collisions. This happened to me trying to make a logging function called ‘error’ as well. 

On Sat, Feb 8, 2020 at 10:43 Reinhold Füreder <[hidden email]> wrote:
Hi David,

I think that could be related to https://issues.jenkins-ci.org/browse/JENKINS-50736, because there is a pipeline basic step called 'writeFile' (see https://jenkins.io/doc/pipeline/steps/workflow-basic-steps/#writefile-write-file-to-workspace), but maybe Jesse Glick or Andrew Bayer can shed some more light on this issue...

HTH Reinhold


Von: [hidden email] <[hidden email]> im Auftrag von David Karr <[hidden email]>
Gesendet: Freitag, 7. Februar 2020 21:51
An: Jenkins Users <[hidden email]>
Betreff: Shared library function cannot call other shared library function in separate file if called function uses "writeFile"
 
The statement I make in the subject doesn't make sense, but I don't know how else to describe it.

I'm working on a set of builds using scripted pipelines.  Our Jenkinsfiles are very short, all of the build logic is in the shared library.  In the "main" shared library function, I'm trying to call another function defined in another "vars" class.  We have many of these already.  In this called function, I have a call to the "writeFile" pipeline step to create a temporary file used by a shell script called immediately after that.  This is the only place anywhere in our builds that we call "writeFile".

When I run the build, I get this very unhelpful message:

Jenkins Job Failed due to Exception : org.codehaus.groovy.control.ErrorCollector

There is literally no other information provided, except for the log lines that come before it.  I found that an echo statement that is called before this suspect function is called is emitted in the log.  An echo statement as the first line of the "call()" method of the function being called is NOT emitted in the log. Somehow the act of calling the function makes it die, with no explanation.

So, I tried a workaround.  In the calling script file, I added a "def" at the end of the file, to define an "inline function" with almost the same name as the "vars" function name.  I copied the entire body of the "call()" method of the vars function into that inline function.  I replaced the call to the vars function with the call to the inline function.  It worked on the first try.

Any ideas what might cause this?

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/3119e9f3-e6a8-4fa6-861a-76c9358ab300%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/AM0PR01MB6147F74252A8BD51D29E9A77F71F0%40AM0PR01MB6147.eurprd01.prod.exchangelabs.com.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CADgiF9%2BCtDoeyZZbBJ9j4UNDmxJGfuqrzqgDPx6pFxX5fY4CQA%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: Shared library function cannot call other shared library function in separate file if called function uses "writeFile"

David Karr
In reply to this post by David Karr
I think you've both misunderstood what I'm saying, or I'm not being clear enough.

I'm not writing to write a function named "writeFile", I'm just calling that pipeline step from the function.  All of the function names I'm creating are definitely unique.  If I call the "vars" function that calls "writeFile", I get the seemingly generic error with no other information.  If I instead call the inline function with contents identical to the "vars" function, it works fine.

On Friday, February 7, 2020 at 12:51:42 PM UTC-8, David Karr wrote:
The statement I make in the subject doesn't make sense, but I don't know how else to describe it.

I'm working on a set of builds using scripted pipelines.  Our Jenkinsfiles are very short, all of the build logic is in the shared library.  In the "main" shared library function, I'm trying to call another function defined in another "vars" class.  We have many of these already.  In this called function, I have a call to the "writeFile" pipeline step to create a temporary file used by a shell script called immediately after that.  This is the only place anywhere in our builds that we call "writeFile".

When I run the build, I get this very unhelpful message:

Jenkins Job Failed due to Exception : org.codehaus.groovy.control.ErrorCollector

There is literally no other information provided, except for the log lines that come before it.  I found that an echo statement that is called before this suspect function is called is emitted in the log.  An echo statement as the first line of the "call()" method of the function being called is NOT emitted in the log. Somehow the act of calling the function makes it die, with no explanation.

So, I tried a workaround.  In the calling script file, I added a "def" at the end of the file, to define an "inline function" with almost the same name as the "vars" function name.  I copied the entire body of the "call()" method of the vars function into that inline function.  I replaced the call to the vars function with the call to the inline function.  It worked on the first try.

Any ideas what might cause this?

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/6ff2f989-046b-4d56-9d3d-d1d69487e97c%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

RE: Shared library function cannot call other shared library function in separate file if called function uses "writeFile"

Reinhold Füreder

Weird. And sorry for misunderstanding you.

 

There might be a stacktrace in the Jenkins log file (hopefully). Or you could try catch all exceptions in your scripted pipeline to get some more details…

 

I just tried to reproduce your problem (or the one I now think you are describing), but unfortunately it works like a charm 😲

 

Cu Reinhold

 

 

From: [hidden email] <[hidden email]> On Behalf Of David Karr
Sent: Sonntag, 9. Februar 2020 02:17
To: Jenkins Users <[hidden email]>
Subject: Re: Shared library function cannot call other shared library function in separate file if called function uses "writeFile"

 

I think you've both misunderstood what I'm saying, or I'm not being clear enough.

 

I'm not writing to write a function named "writeFile", I'm just calling that pipeline step from the function.  All of the function names I'm creating are definitely unique.  If I call the "vars" function that calls "writeFile", I get the seemingly generic error with no other information.  If I instead call the inline function with contents identical to the "vars" function, it works fine.


On Friday, February 7, 2020 at 12:51:42 PM UTC-8, David Karr wrote:

The statement I make in the subject doesn't make sense, but I don't know how else to describe it.

 

I'm working on a set of builds using scripted pipelines.  Our Jenkinsfiles are very short, all of the build logic is in the shared library.  In the "main" shared library function, I'm trying to call another function defined in another "vars" class.  We have many of these already.  In this called function, I have a call to the "writeFile" pipeline step to create a temporary file used by a shell script called immediately after that.  This is the only place anywhere in our builds that we call "writeFile".

 

When I run the build, I get this very unhelpful message:

 

Jenkins Job Failed due to Exception : org.codehaus.groovy.control.ErrorCollector


There is literally no other information provided, except for the log lines that come before it.  I found that an echo statement that is called before this suspect function is called is emitted in the log.  An echo statement as the first line of the "call()" method of the function being called is NOT emitted in the log. Somehow the act of calling the function makes it die, with no explanation.

 

So, I tried a workaround.  In the calling script file, I added a "def" at the end of the file, to define an "inline function" with almost the same name as the "vars" function name.  I copied the entire body of the "call()" method of the vars function into that inline function.  I replaced the call to the vars function with the call to the inline function.  It worked on the first try.

 

Any ideas what might cause this?

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/6ff2f989-046b-4d56-9d3d-d1d69487e97c%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/AM0PR01MB61470ACBCC11F888EA32B03CF7180%40AM0PR01MB6147.eurprd01.prod.exchangelabs.com.
Reply | Threaded
Open this post in threaded view
|

Re: Shared library function cannot call other shared library function in separate file if called function uses "writeFile"

David Karr
The problem is not that we're failing to catch an exception, the problem is that the exceptions aren't telling us anything.

The following occurs at the end of the build log:
an exception which occurred:
       
in field org.codehaus.groovy.control.MultipleCompilationErrorsException.collector
       
in object org.codehaus.groovy.control.MultipleCompilationErrorsException@56f542c3
       
in field com.cloudbees.groovy.cps.Outcome.abnormal
       
in object com.cloudbees.groovy.cps.Outcome@58839b2d
       
in field org.jenkinsci.plugins.workflow.cps.CpsBodyExecution.outcome
       
in object org.jenkinsci.plugins.workflow.cps.CpsBodyExecution@2fab07a3
       
in field org.jenkinsci.plugins.workflow.cps.CpsBodyExecution$SuccessAdapter.this$0
       
in object org.jenkinsci.plugins.workflow.cps.CpsBodyExecution$SuccessAdapter@13992864
       
in field com.cloudbees.groovy.cps.impl.CallEnv.returnAddress
       
in object com.cloudbees.groovy.cps.impl.FunctionCallEnv@4b24116
       
in field com.cloudbees.groovy.cps.impl.ProxyEnv.parent
       
in object com.cloudbees.groovy.cps.impl.TryBlockEnv@2c520b87
       
in field com.cloudbees.groovy.cps.impl.CallEnv.caller
       
in object com.cloudbees.groovy.cps.impl.ClosureCallEnv@2489377e
       
in field com.cloudbees.groovy.cps.impl.ProxyEnv.parent
       
in object com.cloudbees.groovy.cps.impl.BlockScopeEnv@2c3884bf
       
in field com.cloudbees.groovy.cps.impl.ProxyEnv.parent
       
in object com.cloudbees.groovy.cps.impl.BlockScopeEnv@bf6e705
       
in field com.cloudbees.groovy.cps.impl.ProxyEnv.parent
       
in object com.cloudbees.groovy.cps.impl.BlockScopeEnv@748ef562
       
in field com.cloudbees.groovy.cps.impl.ProxyEnv.parent
       
in object com.cloudbees.groovy.cps.impl.BlockScopeEnv@3758738
       
in field com.cloudbees.groovy.cps.impl.CpsClosureDef.capture
       
in object com.cloudbees.groovy.cps.impl.CpsClosureDef@41614515
       
in field com.cloudbees.groovy.cps.impl.CpsClosure.def
       
in object org.jenkinsci.plugins.workflow.cps.CpsClosure2@1cb035e0
       
in field org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.closures
       
in object org.jenkinsci.plugins.workflow.cps.CpsThreadGroup@2b6c7a88
       
in object org.jenkinsci.plugins.workflow.cps.CpsThreadGroup@2b6c7a88
Caused: java.io.NotSerializableException: org.codehaus.groovy.control.ErrorCollector
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:860)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:967)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:967)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:967)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:967)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:967)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:967)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:967)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:967)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
        at org
.jboss.marshalling.river.BlockMarshaller.doWriteObject(BlockMarshaller.java:65)
        at org
.jboss.marshalling.river.BlockMarshaller.writeObject(BlockMarshaller.java:56)
        at org
.jboss.marshalling.MarshallerObjectOutputStream.writeObjectOverride(MarshallerObjectOutputStream.java:50)
        at org
.jboss.marshalling.river.RiverObjectOutputStream.writeObjectOverride(RiverObjectOutputStream.java:179)
        at java
.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:344)
        at java
.util.HashMap.internalWriteEntries(HashMap.java:1790)
        at java
.util.HashMap.writeObject(HashMap.java:1363)
        at sun
.reflect.GeneratedMethodAccessor405.invoke(Unknown Source)
        at sun
.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java
.lang.reflect.Method.invoke(Method.java:498)
        at org
.jboss.marshalling.reflect.SerializableClass.callWriteObject(SerializableClass.java:273)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:976)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
        at org
.jboss.marshalling.AbstractObjectOutput.writeObject(AbstractObjectOutput.java:58)
        at org
.jboss.marshalling.AbstractMarshaller.writeObject(AbstractMarshaller.java:111)
        at org
.jenkinsci.plugins.workflow.support.pickles.serialization.RiverWriter.lambda$writeObject$0(RiverWriter.java:144)
        at org
.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovySandbox.runInSandbox(GroovySandbox.java:108)
        at org
.jenkinsci.plugins.workflow.support.pickles.serialization.RiverWriter.writeObject(RiverWriter.java:143)
        at org
.jenkinsci.plugins.workflow.cps.CpsThreadGroup.saveProgram(CpsThreadGroup.java:477)
        at org
.jenkinsci.plugins.workflow.cps.CpsThreadGroup.saveProgram(CpsThreadGroup.java:453)
        at org
.jenkinsci.plugins.workflow.cps.CpsThreadGroup.saveProgramIfPossible(CpsThreadGroup.java:440)
        at org
.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:367)
        at org
.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$200(CpsThreadGroup.java:83)
        at org
.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:244)
        at org
.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:232)
        at org
.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:64)
        at java
.util.concurrent.FutureTask.run(FutureTask.java:266)
        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:511)
        at java
.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java
.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java
.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java
.lang.Thread.run(Thread.java:748)
Enter code here...



On Monday, February 10, 2020 at 11:07:24 PM UTC-8, r.fuereder wrote:

Weird. And sorry for misunderstanding you.

 

There might be a stacktrace in the Jenkins log file (hopefully). Or you could try catch all exceptions in your scripted pipeline to get some more details…

 

I just tried to reproduce your problem (or the one I now think you are describing), but unfortunately it works like a charm 😲

 

Cu Reinhold

 

 

From: <a href="javascript:" target="_blank" gdf-obfuscated-mailto="uLfSv1g7GQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">jenkins...@googlegroups.com <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="uLfSv1g7GQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">jenkins...@googlegroups.com> On Behalf Of David Karr
Sent: Sonntag, 9. Februar 2020 02:17
To: Jenkins Users <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="uLfSv1g7GQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">jenkins...@googlegroups.com>
Subject: Re: Shared library function cannot call other shared library function in separate file if called function uses "writeFile"

 

I think you've both misunderstood what I'm saying, or I'm not being clear enough.

 

I'm not writing to write a function named "writeFile", I'm just calling that pipeline step from the function.  All of the function names I'm creating are definitely unique.  If I call the "vars" function that calls "writeFile", I get the seemingly generic error with no other information.  If I instead call the inline function with contents identical to the "vars" function, it works fine.


On Friday, February 7, 2020 at 12:51:42 PM UTC-8, David Karr wrote:

The statement I make in the subject doesn't make sense, but I don't know how else to describe it.

 

I'm working on a set of builds using scripted pipelines.  Our Jenkinsfiles are very short, all of the build logic is in the shared library.  In the "main" shared library function, I'm trying to call another function defined in another "vars" class.  We have many of these already.  In this called function, I have a call to the "writeFile" pipeline step to create a temporary file used by a shell script called immediately after that.  This is the only place anywhere in our builds that we call "writeFile".

 

When I run the build, I get this very unhelpful message:

 

Jenkins Job Failed due to Exception : org.codehaus.groovy.control.ErrorCollector


There is literally no other information provided, except for the log lines that come before it.  I found that an echo statement that is called before this suspect function is called is emitted in the log.  An echo statement as the first line of the "call()" method of the function being called is NOT emitted in the log. Somehow the act of calling the function makes it die, with no explanation.

 

So, I tried a workaround.  In the calling script file, I added a "def" at the end of the file, to define an "inline function" with almost the same name as the "vars" function name.  I copied the entire body of the "call()" method of the vars function into that inline function.  I replaced the call to the vars function with the call to the inline function.  It worked on the first try.

 

Any ideas what might cause this?

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="uLfSv1g7GQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">jenkins...@googlegroups.com.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/jenkinsci-users/6ff2f989-046b-4d56-9d3d-d1d69487e97c%40googlegroups.com?utm_medium=email&amp;utm_source=footer" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/jenkinsci-users/6ff2f989-046b-4d56-9d3d-d1d69487e97c%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/jenkinsci-users/6ff2f989-046b-4d56-9d3d-d1d69487e97c%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;"> https://groups.google.com/d/msgid/jenkinsci-users/6ff2f989-046b-4d56-9d3d-d1d69487e97c%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/cdcd32cd-40c5-4643-be0f-c52d02cd4ed8%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

RE: Shared library function cannot call other shared library function in separate file if called function uses "writeFile"

Reinhold Füreder

Hi David,

 

I see what you mean with “that the exceptions aren't telling us anything”: Unfortunately I am also not sure if “Caused: java.io.NotSerializableException: org.codehaus.groovy.control.ErrorCollector” may indicate that there is some serializiation problem or e.g. some @NonCPS methods calling normal methods, or if this is just a side effect of another problem (i.e. the actual root cause)…

Since the most trivial use case just worked for me, maybe you can post some more code (and context) here; otherwise it will be very difficult to provide any further assistenance…

 

Sorry,

                Reinhold

 

 

From: [hidden email] <[hidden email]> On Behalf Of David Karr
Sent: Dienstag, 11. Februar 2020 21:01
To: Jenkins Users <[hidden email]>
Subject: Re: Shared library function cannot call other shared library function in separate file if called function uses "writeFile"

 

The problem is not that we're failing to catch an exception, the problem is that the exceptions aren't telling us anything.

 

The following occurs at the end of the build log:

an exception which occurred:
       
in field org.codehaus.groovy.control.MultipleCompilationErrorsException.collector
       
in object [hidden email]
       
in field com.cloudbees.groovy.cps.Outcome.abnormal
       
in object [hidden email]
       
in field org.jenkinsci.plugins.workflow.cps.CpsBodyExecution.outcome
       
in object [hidden email]
       
in field org.jenkinsci.plugins.workflow.cps.CpsBodyExecution$SuccessAdapter.this$0
       
in object [hidden email]
       
in field com.cloudbees.groovy.cps.impl.CallEnv.returnAddress
       
in object [hidden email]
       
in field com.cloudbees.groovy.cps.impl.ProxyEnv.parent
       
in object [hidden email]
       
in field com.cloudbees.groovy.cps.impl.CallEnv.caller
       
in object [hidden email]
       
in field com.cloudbees.groovy.cps.impl.ProxyEnv.parent
       
in object [hidden email]
       
in field com.cloudbees.groovy.cps.impl.ProxyEnv.parent
       
in object [hidden email]
       
in field com.cloudbees.groovy.cps.impl.ProxyEnv.parent
       
in object [hidden email]
       
in field com.cloudbees.groovy.cps.impl.ProxyEnv.parent
       
in object [hidden email]
       
in field com.cloudbees.groovy.cps.impl.CpsClosureDef.capture
       
in object [hidden email]
       
in field com.cloudbees.groovy.cps.impl.CpsClosure.def
       
in object [hidden email]
       
in field org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.closures
       
in object [hidden email]
       
in object [hidden email]
Caused: java.io.NotSerializableException: org.codehaus.groovy.control.ErrorCollector
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:860)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:967)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:967)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:967)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:967)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:967)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:967)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:967)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:967)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
        at org
.jboss.marshalling.river.BlockMarshaller.doWriteObject(BlockMarshaller.java:65)
        at org
.jboss.marshalling.river.BlockMarshaller.writeObject(BlockMarshaller.java:56)
        at org
.jboss.marshalling.MarshallerObjectOutputStream.writeObjectOverride(MarshallerObjectOutputStream.java:50)
        at org
.jboss.marshalling.river.RiverObjectOutputStream.writeObjectOverride(RiverObjectOutputStream.java:179)
        at java
.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:344)
        at java
.util.HashMap.internalWriteEntries(HashMap.java:1790)
        at java
.util.HashMap.writeObject(HashMap.java:1363)
        at sun
.reflect.GeneratedMethodAccessor405.invoke(Unknown Source)
        at sun
.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java
.lang.reflect.Method.invoke(Method.java:498)
        at org
.jboss.marshalling.reflect.SerializableClass.callWriteObject(SerializableClass.java:273)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:976)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
        at org
.jboss.marshalling.AbstractObjectOutput.writeObject(AbstractObjectOutput.java:58)
        at org
.jboss.marshalling.AbstractMarshaller.writeObject(AbstractMarshaller.java:111)
        at org
.jenkinsci.plugins.workflow.support.pickles.serialization.RiverWriter.lambda$writeObject$0(RiverWriter.java:144)
        at org
.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovySandbox.runInSandbox(GroovySandbox.java:108)
        at org
.jenkinsci.plugins.workflow.support.pickles.serialization.RiverWriter.writeObject(RiverWriter.java:143)
        at org
.jenkinsci.plugins.workflow.cps.CpsThreadGroup.saveProgram(CpsThreadGroup.java:477)
        at org
.jenkinsci.plugins.workflow.cps.CpsThreadGroup.saveProgram(CpsThreadGroup.java:453)
        at org
.jenkinsci.plugins.workflow.cps.CpsThreadGroup.saveProgramIfPossible(CpsThreadGroup.java:440)
        at org
.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:367)
        at org
.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$200(CpsThreadGroup.java:83)
        at org
.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:244)
        at org
.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:232)
        at org
.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:64)
        at java
.util.concurrent.FutureTask.run(FutureTask.java:266)
        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:511)
        at java
.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java
.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java
.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java
.lang.Thread.run(Thread.java:748)

Enter code here...




On Monday, February 10, 2020 at 11:07:24 PM UTC-8, r.fuereder wrote:

Weird. And sorry for misunderstanding you.

 

There might be a stacktrace in the Jenkins log file (hopefully). Or you could try catch all exceptions in your scripted pipeline to get some more details…

 

I just tried to reproduce your problem (or the one I now think you are describing), but unfortunately it works like a charm 😲

 

Cu Reinhold

 

 

From: <a href="javascript:" target="_blank">jenkins...@... <<a href="javascript:" target="_blank">jenkins...@...> On Behalf Of David Karr
Sent: Sonntag, 9. Februar 2020 02:17
To: Jenkins Users <<a href="javascript:" target="_blank">jenkins...@...>
Subject: Re: Shared library function cannot call other shared library function in separate file if called function uses "writeFile"

 

I think you've both misunderstood what I'm saying, or I'm not being clear enough.

 

I'm not writing to write a function named "writeFile", I'm just calling that pipeline step from the function.  All of the function names I'm creating are definitely unique.  If I call the "vars" function that calls "writeFile", I get the seemingly generic error with no other information.  If I instead call the inline function with contents identical to the "vars" function, it works fine.


On Friday, February 7, 2020 at 12:51:42 PM UTC-8, David Karr wrote:

The statement I make in the subject doesn't make sense, but I don't know how else to describe it.

 

I'm working on a set of builds using scripted pipelines.  Our Jenkinsfiles are very short, all of the build logic is in the shared library.  In the "main" shared library function, I'm trying to call another function defined in another "vars" class.  We have many of these already.  In this called function, I have a call to the "writeFile" pipeline step to create a temporary file used by a shell script called immediately after that.  This is the only place anywhere in our builds that we call "writeFile".

 

When I run the build, I get this very unhelpful message:

 

Jenkins Job Failed due to Exception : org.codehaus.groovy.control.ErrorCollector


There is literally no other information provided, except for the log lines that come before it.  I found that an echo statement that is called before this suspect function is called is emitted in the log.  An echo statement as the first line of the "call()" method of the function being called is NOT emitted in the log. Somehow the act of calling the function makes it die, with no explanation.

 

So, I tried a workaround.  In the calling script file, I added a "def" at the end of the file, to define an "inline function" with almost the same name as the "vars" function name.  I copied the entire body of the "call()" method of the vars function into that inline function.  I replaced the call to the vars function with the call to the inline function.  It worked on the first try.

 

Any ideas what might cause this?

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:" target="_blank">jenkins...@....
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/6ff2f989-046b-4d56-9d3d-d1d69487e97c%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/cdcd32cd-40c5-4643-be0f-c52d02cd4ed8%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/AM0PR01MB614722CAD7E33569C50A9AEDF71B0%40AM0PR01MB6147.eurprd01.prod.exchangelabs.com.
Reply | Threaded
Open this post in threaded view
|

Re: Shared library function cannot call other shared library function in separate file if called function uses "writeFile"

David Karr
I was blocked on this for a couple days because of some other related issues.

I believe I have now verified that the cause of this problem is the "writeFile" pipeline step, but I don't know why.  I verified this because I was able to refactor the vars method to not use "writeFile" at all. A "sh" step that occurs just before this has been augmented to generate the data I need directly in the pipeline, and it pipes the output directly to the file, instead of using "writeFile".

So, for me, the issue is resolved.  I'm just going to be wary in the future about implementing Jenkins pipeline scripts that use "writeFile", and try to do it in a different way.

After I changed the Jenkins script to use the vars method again, it works perfectly fine.

On Tuesday, February 11, 2020 at 9:57:31 PM UTC-8, r.fuereder wrote:

Hi David,

 

I see what you mean with “that the exceptions aren't telling us anything”: Unfortunately I am also not sure if “Caused: java.io.NotSerializableException: org.codehaus.groovy.control.ErrorCollector” may indicate that there is some serializiation problem or e.g. some @NonCPS methods calling normal methods, or if this is just a side effect of another problem (i.e. the actual root cause)…

Since the most trivial use case just worked for me, maybe you can post some more code (and context) here; otherwise it will be very difficult to provide any further assistenance…

 

Sorry,

                Reinhold

 

 

From: <a href="javascript:" target="_blank" gdf-obfuscated-mailto="r8ZhDx2GGQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">jenkins...@googlegroups.com <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="r8ZhDx2GGQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">jenkins...@googlegroups.com> On Behalf Of David Karr
Sent: Dienstag, 11. Februar 2020 21:01
To: Jenkins Users <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="r8ZhDx2GGQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">jenkins...@googlegroups.com>
Subject: Re: Shared library function cannot call other shared library function in separate file if called function uses "writeFile"

 

The problem is not that we're failing to catch an exception, the problem is that the exceptions aren't telling us anything.

 

The following occurs at the end of the build log:

an exception which occurred:
       
in field org.codehaus.groovy.control.MultipleCompilationErrorsException.collector
       
in object <a href="javascript:" target="_blank" gdf-obfuscated-mailto="r8ZhDx2GGQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">org.codehaus.groovy.control.MultipleCompilationErrorsException@56f542c3
       
in field com.cloudbees.groovy.cps.Outcome.abnormal
       
in object <a href="javascript:" target="_blank" gdf-obfuscated-mailto="r8ZhDx2GGQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">com.cloudbees.groovy.cps.Outcome@58839b2d
       
in field org.jenkinsci.plugins.workflow.cps.CpsBodyExecution.outcome
       
in object <a href="javascript:" target="_blank" gdf-obfuscated-mailto="r8ZhDx2GGQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">org.jenkinsci.plugins.workflow.cps.CpsBodyExecution@2fab07a3
       
in field org.jenkinsci.plugins.workflow.cps.CpsBodyExecution$SuccessAdapter.this$0
       
in object <a href="javascript:" target="_blank" gdf-obfuscated-mailto="r8ZhDx2GGQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">org.jenkinsci.plugins.workflow.cps.CpsBodyExecution$SuccessAdapter@13992864
       
in field com.cloudbees.groovy.cps.impl.CallEnv.returnAddress
       
in object <a href="javascript:" target="_blank" gdf-obfuscated-mailto="r8ZhDx2GGQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">com.cloudbees.groovy.cps.impl.FunctionCallEnv@4b24116
       
in field com.cloudbees.groovy.cps.impl.ProxyEnv.parent
       
in object <a href="javascript:" target="_blank" gdf-obfuscated-mailto="r8ZhDx2GGQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">com.cloudbees.groovy.cps.impl.TryBlockEnv@2c520b87
       
in field com.cloudbees.groovy.cps.impl.CallEnv.caller
       
in object <a href="javascript:" target="_blank" gdf-obfuscated-mailto="r8ZhDx2GGQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">com.cloudbees.groovy.cps.impl.ClosureCallEnv@2489377e
       
in field com.cloudbees.groovy.cps.impl.ProxyEnv.parent
       
in object <a href="javascript:" target="_blank" gdf-obfuscated-mailto="r8ZhDx2GGQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">com.cloudbees.groovy.cps.impl.BlockScopeEnv@2c3884bf
       
in field com.cloudbees.groovy.cps.impl.ProxyEnv.parent
       
in object <a href="javascript:" target="_blank" gdf-obfuscated-mailto="r8ZhDx2GGQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">com.cloudbees.groovy.cps.impl.BlockScopeEnv@bf6e705
       
in field com.cloudbees.groovy.cps.impl.ProxyEnv.parent
       
in object <a href="javascript:" target="_blank" gdf-obfuscated-mailto="r8ZhDx2GGQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">com.cloudbees.groovy.cps.impl.BlockScopeEnv@748ef562
       
in field com.cloudbees.groovy.cps.impl.ProxyEnv.parent
       
in object <a href="javascript:" target="_blank" gdf-obfuscated-mailto="r8ZhDx2GGQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">com.cloudbees.groovy.cps.impl.BlockScopeEnv@3758738
       
in field com.cloudbees.groovy.cps.impl.CpsClosureDef.capture
       
in object <a href="javascript:" target="_blank" gdf-obfuscated-mailto="r8ZhDx2GGQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">com.cloudbees.groovy.cps.impl.CpsClosureDef@41614515
       
in field com.cloudbees.groovy.cps.impl.CpsClosure.def
       
in object <a href="javascript:" target="_blank" gdf-obfuscated-mailto="r8ZhDx2GGQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">org.jenkinsci.plugins.workflow.cps.CpsClosure2@1cb035e0
       
in field org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.closures
       
in object <a href="javascript:" target="_blank" gdf-obfuscated-mailto="r8ZhDx2GGQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">org.jenkinsci.plugins.workflow.cps.CpsThreadGroup@2b6c7a88
       
in object <a href="javascript:" target="_blank" gdf-obfuscated-mailto="r8ZhDx2GGQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">org.jenkinsci.plugins.workflow.cps.CpsThreadGroup@2b6c7a88
Caused: java.io.NotSerializableException: org.codehaus.groovy.control.ErrorCollector
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:860)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:967)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:967)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:967)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:967)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:967)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:967)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:967)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:967)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
        at org
.jboss.marshalling.river.BlockMarshaller.doWriteObject(BlockMarshaller.java:65)
        at org
.jboss.marshalling.river.BlockMarshaller.writeObject(BlockMarshaller.java:56)
        at org
.jboss.marshalling.MarshallerObjectOutputStream.writeObjectOverride(MarshallerObjectOutputStream.java:50)
        at org
.jboss.marshalling.river.RiverObjectOutputStream.writeObjectOverride(RiverObjectOutputStream.java:179)
        at java
.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:344)
        at java
.util.HashMap.internalWriteEntries(HashMap.java:1790)
        at java
.util.HashMap.writeObject(HashMap.java:1363)
        at sun
.reflect.GeneratedMethodAccessor405.invoke(Unknown Source)
        at sun
.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java
.lang.reflect.Method.invoke(Method.java:498)
        at org
.jboss.marshalling.reflect.SerializableClass.callWriteObject(SerializableClass.java:273)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:976)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)
        at org
.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
        at org
.jboss.marshalling.AbstractObjectOutput.writeObject(AbstractObjectOutput.java:58)
        at org
.jboss.marshalling.AbstractMarshaller.writeObject(AbstractMarshaller.java:111)
        at org
.jenkinsci.plugins.workflow.support.pickles.serialization.RiverWriter.lambda$writeObject$0(RiverWriter.java:144)
        at org
.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovySandbox.runInSandbox(GroovySandbox.java:108)
        at org
.jenkinsci.plugins.workflow.support.pickles.serialization.RiverWriter.writeObject(RiverWriter.java:143)
        at org
.jenkinsci.plugins.workflow.cps.CpsThreadGroup.saveProgram(CpsThreadGroup.java:477)
        at org
.jenkinsci.plugins.workflow.cps.CpsThreadGroup.saveProgram(CpsThreadGroup.java:453)
        at org
.jenkinsci.plugins.workflow.cps.CpsThreadGroup.saveProgramIfPossible(CpsThreadGroup.java:440)
        at org
.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:367)
        at org
.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$200(CpsThreadGroup.java:83)
        at org
.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:244)
        at org
.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:232)
        at org
.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:64)
        at java
.util.concurrent.FutureTask.run(FutureTask.java:266)
        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:511)
        at java
.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java
.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java
.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java
.lang.Thread.run(Thread.java:748)

Enter code here...




On Monday, February 10, 2020 at 11:07:24 PM UTC-8, r.fuereder wrote:

Weird. And sorry for misunderstanding you.

 

There might be a stacktrace in the Jenkins log file (hopefully). Or you could try catch all exceptions in your scripted pipeline to get some more details…

 

I just tried to reproduce your problem (or the one I now think you are describing), but unfortunately it works like a charm 😲

 

Cu Reinhold

 

 

From: [hidden email] <[hidden email]> On Behalf Of David Karr
Sent: Sonntag, 9. Februar 2020 02:17
To: Jenkins Users <[hidden email]>
Subject: Re: Shared library function cannot call other shared library function in separate file if called function uses "writeFile"

 

I think you've both misunderstood what I'm saying, or I'm not being clear enough.

 

I'm not writing to write a function named "writeFile", I'm just calling that pipeline step from the function.  All of the function names I'm creating are definitely unique.  If I call the "vars" function that calls "writeFile", I get the seemingly generic error with no other information.  If I instead call the inline function with contents identical to the "vars" function, it works fine.


On Friday, February 7, 2020 at 12:51:42 PM UTC-8, David Karr wrote:

The statement I make in the subject doesn't make sense, but I don't know how else to describe it.

 

I'm working on a set of builds using scripted pipelines.  Our Jenkinsfiles are very short, all of the build logic is in the shared library.  In the "main" shared library function, I'm trying to call another function defined in another "vars" class.  We have many of these already.  In this called function, I have a call to the "writeFile" pipeline step to create a temporary file used by a shell script called immediately after that.  This is the only place anywhere in our builds that we call "writeFile".

 

When I run the build, I get this very unhelpful message:

 

Jenkins Job Failed due to Exception : org.codehaus.groovy.control.ErrorCollector


There is literally no other information provided, except for the log lines that come before it.  I found that an echo statement that is called before this suspect function is called is emitted in the log.  An echo statement as the first line of the "call()" method of the function being called is NOT emitted in the log. Somehow the act of calling the function makes it die, with no explanation.

 

So, I tried a workaround.  In the calling script file, I added a "def" at the end of the file, to define an "inline function" with almost the same name as the "vars" function name.  I copied the entire body of the "call()" method of the vars function into that inline function.  I replaced the call to the vars function with the call to the inline function.  It worked on the first try.

 

Any ideas what might cause this?

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/jenkinsci-users/6ff2f989-046b-4d56-9d3d-d1d69487e97c%40googlegroups.com?utm_medium=email&amp;utm_source=footer" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/jenkinsci-users/6ff2f989-046b-4d56-9d3d-d1d69487e97c%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/jenkinsci-users/6ff2f989-046b-4d56-9d3d-d1d69487e97c%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;"> https://groups.google.com/d/msgid/jenkinsci-users/6ff2f989-046b-4d56-9d3d-d1d69487e97c%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="r8ZhDx2GGQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">jenkins...@googlegroups.com.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/jenkinsci-users/cdcd32cd-40c5-4643-be0f-c52d02cd4ed8%40googlegroups.com?utm_medium=email&amp;utm_source=footer" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/jenkinsci-users/cdcd32cd-40c5-4643-be0f-c52d02cd4ed8%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/jenkinsci-users/cdcd32cd-40c5-4643-be0f-c52d02cd4ed8%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;"> https://groups.google.com/d/msgid/jenkinsci-users/cdcd32cd-40c5-4643-be0f-c52d02cd4ed8%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/f3807d22-4024-4cdb-87fc-76203b1cb2cf%40googlegroups.com.