What are the rules for when pipeline jobs are serialized?

39 views
Skip to first unread message

Greg Smith

unread,
Sep 8, 2016, 12:09:26 PM9/8/16
to Jenkins Users

Hi,

I just updated my Jenkins instance to all of the latest plugins, and now many of my jobs are failing.  They are all failing because of serialization problems:

java.io.NotSerializableException: hudson.model.FreeStyleProject
	at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:860)

Now, this pipleline groovy script was running fine, but now the rules for when things are serialized has changed again, and its failing.

Can someone point me to something about when / where / how serialization of jobs should be happening, and what the rules are?  I'd like to build pipeline scripts that work over time and through upgrades, but the rules for when the job is serialized don't seem to be firm.

Making sure that I am never using any object in my script that absolutely can't be serialized is becoming a pain.  I can't seem to use any iterators, or hold any object in a var that can't be serialized, even within a single function.

Cheers,
Greg


Greg Smith

unread,
Sep 8, 2016, 12:17:58 PM9/8/16
to Jenkins Users

Ah -- Found the "@NonCPS" marker.   Seems to have gotten me past my original problem.

Cheers,
Greg

Slide

unread,
Sep 8, 2016, 12:43:07 PM9/8/16
to Jenkins Users

The serialization is one of the things I personally don't like about pipeline because I don't need it. I wish there was a way to turn it off completely, but that's probably a pipe dream. Use of @NonCPS is usually the best option for things where you want to use full groovy features.


--
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 jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/32055461-2f0e-44ce-ae59-95cb3e0c9004%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages