Groovy Save Exception after run

194 views
Skip to first unread message

pallen

unread,
Apr 11, 2017, 12:47:50 PM4/11/17
to Jenkins Developers
Hi Guys,

I'm getting an exception after running my own DSL task 'P4Groovy':

The extension is here, in 'GetP4' I extend Builder and implement SimpleBuildStep to execute the task and then create the step by extending 'Step' in 'GetP4Step' (that bit of code has been updated from 'AbstractStepImpl').  However, the exception remains the same regardless of my recent updates.  The build step runs and I can see the output in the log, however on close of the workflow it throw the exception below...

In Jenkins 1.642.3 I get no NPE, however with 2.32 I see the NPE?  

If I mark my use of TaskListener listener as transient then no exception?  However no logs for my DSL task :-(

Any pointers would be greatly appreciated.

Kind regards,
Paul



Apr 11, 2017 5:30:01 PM org.jenkinsci.plugins.workflow.cps.CpsThreadGroup saveProgramIfPossible
WARNING: program state save failed
java.io.IOException: Failed to persist /Users/pallen/Workspaces/main.p4-jenkins/dev/work/jobs/groovy/builds/10/program.dat
        at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.saveProgram(CpsThreadGroup.java:461)
        at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.saveProgram(CpsThreadGroup.java:427)
        at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.saveProgramIfPossible(CpsThreadGroup.java:415)
        at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:360)
        at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$100(CpsThreadGroup.java:80)
        at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:240)
        at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:228)
        at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:63)
        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:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NullPointerException
        at hudson.remoting.RemoteOutputStream.writeObject(RemoteOutputStream.java:82)
        at sun.reflect.GeneratedMethodAccessor294.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at org.jboss.marshalling.reflect.SerializableClass.callWriteObject(SerializableClass.java:271)
        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.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 hudson.util.StreamTaskListener.writeObject(StreamTaskListener.java:163)
        at sun.reflect.GeneratedMethodAccessor293.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at org.jboss.marshalling.reflect.SerializableClass.callWriteObject(SerializableClass.java:271)
        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.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.LinkedHashMap.internalWriteEntries(LinkedHashMap.java:333)
        at java.util.HashMap.writeObject(HashMap.java:1354)
        at sun.reflect.GeneratedMethodAccessor188.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at org.jboss.marshalling.reflect.SerializableClass.callWriteObject(SerializableClass.java:271)
        at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:976)
        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 com.cloudbees.groovy.cps.SerializableScript.writeObject(SerializableScript.java:26)
        at sun.reflect.GeneratedMethodAccessor258.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at org.jboss.marshalling.reflect.SerializableClass.callWriteObject(SerializableClass.java:271)
        at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:976)
        at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:967)
        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.doWriteObject(RiverMarshaller.java:569)
        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.writeObject(RiverWriter.java:132)
        at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.saveProgram(CpsThreadGroup.java:452)
        ... 15 more
Caused by: an exception which occurred:
        in field listener
        in field scripts
        in object org.jenkinsci.plugins.workflow.cps.CpsThreadGroup@6e98f281

Apr 11, 2017 5:30:01 PM org.jenkinsci.plugins.workflow.job.WorkflowRun finish
INFO: groovy #10 completed: FAILURE

Jesse Glick

unread,
Apr 11, 2017, 1:40:27 PM4/11/17
to Jenkins Dev
On Tue, Apr 11, 2017 at 12:47 PM, pallen <pal...@perforce.com> wrote:
> If I mark my use of TaskListener listener as transient then no exception?

Yes the `TaskListener` field must be `transient`. It cannot be
serialized as part of the program state. (While it is marked
`Serializable`, that is only for serializing over a Remoting
`Channel`—very different.)

> However no logs for my DSL task

I am afraid I do not follow.

pallen

unread,
Apr 12, 2017, 5:00:20 AM4/12/17
to Jenkins Developers
Hi Jesse,

When I had no logs from my DSL step I was referring to the console output...

Started by user anonymous
[Pipeline] node
Running on master in /Users/pallen/Workspaces/main.p4-jenkins/dev/work/workspace/groovy
[Pipeline] {
[Pipeline] stage (Populate files)
Using the ‘stage’ step without a block argument is deprecated
Entering stage Populate files
Proceeding
[Pipeline] p4sync
... p4 client -o jenkins-master-groovy +
... p4 info +
... p4 client -o jenkins-master-groovy +
... p4 client -i +
... client: jenkins-master-groovy
... p4 client -o jenkins-master-groovy +
... p4 info +
... p4 counter change +
... p4 changes -m1 -ssubmitted //jenkins-master-groovy/... +
Building on Node: master
... p4 client -o jenkins-master-groovy +
... p4 info +
---SNIP--- P4 Task: syncing files at change: 11528
... p4 sync /Users/pallen/Workspaces/main.p4-jenkins/dev/work/workspace/groovy/...@1152___ +
duration: (19ms) P4 Task: saving built changes.
... p4 client -o jenkins-master-groovy +
... p4 info +
... done [Pipeline] stage (Sync files) Using the ‘stage’ step without a block argument is deprecated Entering stage Sync files Proceeding [Pipeline] p4
... p4 client -o jenkins-master-groovy +
... p4 info +
... p4 client -o jenkins-master-groovy +
... p4 client -i +
... client: jenkins-master-groovy
... p4 client -o jenkins-master-groovy +
... p4 info +
---SNIP--- P4 Task: establishing connection. ... server: phooey.das.perforce.com:1666 ... node: phooey.das.perforce.com
... p4 sync -q //streams/st1-main/... +
[Pipeline] } [Pipeline] // node [Pipeline] End of Pipeline
java.lang.NullPointerException
	at hudson.remoting.RemoteOutputStream.writeObject(RemoteOutputStream.java:82)
	at sun.reflect.GeneratedMethodAccessor294.invoke(Unknown Source)


When I make TaskListener transient the block highlighted in red is missing.

It turns out I had marked TaskListener as transient in both GetP4Task and P4Groovy, but only P4Groovy (program state) was required.

Thanks for the explanation.

Paul  

Reply all
Reply to author
Forward
0 new messages