Remoting support from inside AbstractScmTagAction

39 views
Skip to first unread message

pallen

unread,
May 28, 2015, 1:17:12 PM5/28/15
to jenkin...@googlegroups.com
Hi Guys,

I have extended AbstractScmTagAction (TagAction) to provide my own labeling capabilities and have my own Notifier (TagNotifier).

I am trying to invoke a remote task, but get some serialization issues when trying to pass TaskListener listener.

{code=java}
public class TagAction extends AbstractScmTagAction implements Serializable {
private static final long serialVersionUID = 1L;
private final TaskListener listener;
...
public TagAction(Run<?, ?> run, TaskListener listener) throws IOException,
InterruptedException {
super(run);
this.listener = listener;
...
}
...
public void labelBuild(String name, String description) throws Exception {
...
TaggingTask task = new TaggingTask(name, description, buildChange);
...
task.setListener(listener);

// Invoke the Label Task (should I use build??? I can't find FilePath under run)
FilePath buildWorkspace = build.getWorkspace();
buildWorkspace.act(task);
...
}
}
{code}

Here is the error I see...


{code}
java.lang.RuntimeException: Failed to serialize hudson.model.Actionable#actions for class hudson.model.FreeStyleBuild
at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:214)
at hudson.util.RobustReflectionConverter$2.visit(RobustReflectionConverter.java:182)
at com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.visitSerializableFields(PureJavaReflectionProvider.java:138)
at hudson.util.RobustReflectionConverter.doMarshal(RobustReflectionConverter.java:167)
at hudson.util.RobustReflectionConverter.marshal(RobustReflectionConverter.java:108)
at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:43)
at com.thoughtworks.xstream.core.TreeMarshaller.start(TreeMarshaller.java:82)
at com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.marshal(AbstractTreeMarshallingStrategy.java:37)
at com.thoughtworks.xstream.XStream.marshal(XStream.java:1026)
at com.thoughtworks.xstream.XStream.marshal(XStream.java:1015)
at com.thoughtworks.xstream.XStream.toXML(XStream.java:988)
at hudson.XmlFile.write(XmlFile.java:178)
at hudson.model.Run.save(Run.java:1902)
at hudson.model.Run.execute(Run.java:1789)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:234)
Caused by: java.lang.RuntimeException: Failed to serialize org.jenkinsci.plugins.p4.tagging.TagAction#listener for class org.jenkinsci.plugins.p4.tagging.TagAction
at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:214)
at hudson.util.RobustReflectionConverter$2.visit(RobustReflectionConverter.java:182)
at com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.visitSerializableFields(PureJavaReflectionProvider.java:138)
at hudson.util.RobustReflectionConverter.doMarshal(RobustReflectionConverter.java:167)
at hudson.util.RobustReflectionConverter.marshal(RobustReflectionConverter.java:108)
at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:43)
at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:88)
at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.writeItem(AbstractCollectionConverter.java:64)
at com.thoughtworks.xstream.converters.collections.CollectionConverter.marshal(CollectionConverter.java:74)
at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:84)
at hudson.util.RobustReflectionConverter.marshallField(RobustReflectionConverter.java:223)
at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:210)
... 18 more
Caused by: com.thoughtworks.xstream.converters.ConversionException: Could not call hudson.model.StreamBuildListener.writeObject() : Could not call hudson.remoting.RemoteOutputStream.writeObject() : null
---- Debugging information ----
message             : Could not call hudson.remoting.RemoteOutputStream.writeObject()
cause-exception     : java.lang.NullPointerException
cause-message       : null
-------------------------------
message             : Could not call hudson.model.StreamBuildListener.writeObject()
cause-exception     : com.thoughtworks.xstream.converters.ConversionException
cause-message       : Could not call hudson.remoting.RemoteOutputStream.writeObject() : null
-------------------------------
at com.thoughtworks.xstream.converters.reflection.SerializationMethodInvoker.callWriteObject(SerializationMethodInvoker.java:141)
at com.thoughtworks.xstream.converters.reflection.SerializableConverter.doMarshal(SerializableConverter.java:259)
at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshal(AbstractReflectionConverter.java:83)
at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:84)
at hudson.util.RobustReflectionConverter.marshallField(RobustReflectionConverter.java:223)
at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:210)
... 33 more
Caused by: com.thoughtworks.xstream.converters.ConversionException: Could not call hudson.remoting.RemoteOutputStream.writeObject() : null
---- Debugging information ----
message             : Could not call hudson.remoting.RemoteOutputStream.writeObject()
cause-exception     : java.lang.NullPointerException
cause-message       : null
-------------------------------
at com.thoughtworks.xstream.converters.reflection.SerializationMethodInvoker.callWriteObject(SerializationMethodInvoker.java:141)
at com.thoughtworks.xstream.converters.reflection.SerializableConverter.doMarshal(SerializableConverter.java:259)
at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshal(AbstractReflectionConverter.java:83)
at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:43)
at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:88)
at com.thoughtworks.xstream.converters.reflection.SerializableConverter$1.writeToStream(SerializableConverter.java:140)
at com.thoughtworks.xstream.core.util.CustomObjectOutputStream.writeObjectOverride(CustomObjectOutputStream.java:84)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:342)
at hudson.util.StreamTaskListener.writeObject(StreamTaskListener.java:161)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at com.thoughtworks.xstream.converters.reflection.SerializationMethodInvoker.callWriteObject(SerializationMethodInvoker.java:135)
... 40 more
Caused by: java.lang.NullPointerException
at hudson.remoting.RemoteOutputStream.writeObject(RemoteOutputStream.java:82)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at com.thoughtworks.xstream.converters.reflection.SerializationMethodInvoker.callWriteObject(SerializationMethodInvoker.java:135)
... 55 more

{code}

Paul Allen

unread,
May 28, 2015, 1:26:56 PM5/28/15
to jenkin...@googlegroups.com
Perhaps I should be using TaskThread? My TaggingTask extends AbstractTask and implements FileCallable<Boolean>.

It seems that TaskListener is built into TaskThread.

(example here: https://github.com/jenkinsci/git-plugin/blob/f369f2e3ab41b4231ff97b90aa9105eb282084f2/src/main/java/hudson/plugins/git/GitTagAction.java)
> --
> 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/df28cf97-3786-4ccc-aa6a-3e788272b1b2%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



--------------------------------------------------------------------------------
This email and any files transmitted with it are confidential and intended
solely for the use of the individual or entity to whom they are addressed. If
you have received this email in error please notify the system manager. Please
note that any views or opinions presented in this email are solely those of the
author and do not necessarily represent those of Perforce Software. Finally,
the recipient should check this email and any attachments for the presence of
viruses. Perforce Software accepts no liability for any damage caused by any
virus transmitted by this email.

Perforce Software UK Ltd is registered in England and Wales as company no.
3816019 at the following address: West Forest Gate, Wellington Road, Wokingham,
RG40 2AT, UK
--------------------------------------------------------------------------------
Reply all
Reply to author
Forward
0 new messages