Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[JENKINS-26137] At least during restarting tests, serialization error…
…s seem to be due to there being no PickleFactory’s installed.

Merely calling PickleFactory.all() from the RiverWriter constructor, rather than later, seems to let PushdStepTest.restarting pass (JENKINS-26051).
Additionally asserting that there are in fact some factories loaded, since there is sure to be trouble if there are not.
Also need to wait for the build to finish (JENKINS-26399).
Originally-Committed-As: 3d3fa348ed9c34e4492b2733802bc47416824e30
  • Loading branch information
jglick committed Jan 12, 2015
1 parent 823b836 commit 18ad074
Showing 1 changed file with 6 additions and 1 deletion.
Expand Up @@ -28,6 +28,7 @@
import org.jenkinsci.plugins.workflow.pickles.Pickle;
import org.jenkinsci.plugins.workflow.pickles.PickleFactory;
import com.trilead.ssh2.util.IOUtils;
import hudson.ExtensionList;
import org.jboss.marshalling.Marshaller;
import org.jboss.marshalling.Marshalling;
import org.jboss.marshalling.MarshallingConfiguration;
Expand Down Expand Up @@ -87,6 +88,10 @@ public class RiverWriter implements Closeable {

// TODO: rename to HibernatingObjectOutputStream?
public RiverWriter(File f, FlowExecutionOwner _owner) throws IOException {
final ExtensionList<PickleFactory> pickleFactories = PickleFactory.all();
if (pickleFactories.isEmpty()) {
throw new IllegalStateException("JENKINS-26137: Jenkins is shutting down");
}
file = f;
owner = _owner;
dout = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(file)));
Expand All @@ -107,7 +112,7 @@ public Object writeReplace(Object o) {
return new DryOwner();

if (pickling) {
for (PickleFactory f : PickleFactory.all()) {
for (PickleFactory f : pickleFactories) {
Pickle v = f.writeReplace(o);
if (v != null) {
pickles.add(v);
Expand Down

0 comments on commit 18ad074

Please sign in to comment.