mathworks / jenkins-matlab-plugin

This plugin enables you to run MATLAB® and Simulink® as part of your Jenkins™ build.
47 stars 54 forks source link

use of runMATLABBuild in jenkinsfile, breaks builds #320

Closed Rvh91 closed 3 months ago

Rvh91 commented 6 months ago

We have had multiple builds break that we could not explain, where in the Jenkins logs we would end up with the errors listed below. Builds that passed all stages succesfull, could be marked as failed a few hours later, which completely broke our build history. We have setup the Jenkins job as a multibranch pipeline.

Changing the step in the jenkinsFile from

stage('Run repository test suite') {
            steps {
                runMATLABBuild(tasks: 'testReport')
            }
}

to

stage('Run repository test suite') {
            steps {
                runMATLABCommand(command: 'buildtool testReport')
            }
}

seems to have resolved the issue for us.

In the console output:

[Pipeline] End of Pipeline
[Bitbucket] Notifying commit build result
[Bitbucket] Build result notified
Finished: FAILURE
Creating placeholder flownodes because failed loading originals.
ERROR: Cannot resume build because FlowNode 33 for FlowHead 1 could not be loaded.
[Bitbucket] Notifying commit build result
[Bitbucket] Build result notified
Finished: FAILURE

But it can also happen on a successful pipeline:

[Pipeline] End of Pipeline
[Bitbucket] Notifying commit build result
[Bitbucket] Build result notified
Finished: SUCCESS
Creating placeholder flownodes because failed loading originals.
ERROR: Cannot resume build because FlowNode 24 for FlowHead 1 could not be loaded.
[Bitbucket] Notifying commit build result
[Bitbucket] Build result notified
Finished: FAILURE

NOTE: that the snipped above is taken from a different build, whereas the rest of the errors listed here are all from the same build, hence the different flownode numbers

In the Jenkins logs (truncated with the dots to fit the allowed message size, full logs can be found as attached file) fullJenkinsLog.txt :

May 08, 2024 12:17:27 PM WARNING hudson.FilePath _getChannelForSerialization
A FilePath object is being serialized when it should not be, indicating a bug in a plugin. See https://www.jenkins.io/redirect/filepath-serialization for details.
java.io.NotSerializableException: The calling thread Thread[#52022,Running CpsFlowExecution[Owner[<repositoryname>/<branchname>/<buildnumber>:<repositoryname>/<branchname> #<buildnumber>]],5,main] has no associated channel. The current object D:\BuildServerAgents\matlab_agent\workspace\<repositoryname>_<branchname> is interface org.jenkinsci.remoting.SerializableOnlyOverRemoting, but it is likely being serialized/deserialized without the channel
    at org.jenkinsci.remoting.SerializableOnlyOverRemoting.getChannelForSerialization(SerializableOnlyOverRemoting.java:67)
    at hudson.FilePath._getChannelForSerialization(FilePath.java:3563)
    at hudson.FilePath.writeObject(FilePath.java:3552)
.
.
.

May 08, 2024 12:17:27 PM WARNING org.jenkinsci.plugins.workflow.cps.CpsFlowExecution notifyListeners
null
java.lang.IllegalStateException: Can't send a remote FilePath to a different remote channel (current=hudson.remoting.Channel@7a009a17:JNLP4-connect connection from <agent hostname / IP>, target=null)
    at hudson.FilePath.writeObject(FilePath.java:3554)
    at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
    at java.base/java.lang.reflect.Method.invoke(Method.java:580)
    at com.thoughtworks.xstream.core.util.SerializationMembers.callWriteObject(SerializationMembers.java:154)
Caused: com.thoughtworks.xstream.converters.ConversionException: Failed calling method
---- Debugging information ----
message             : Failed calling method
cause-exception     : java.lang.IllegalStateException
cause-message       : Can't send a remote FilePath to a different remote channel (current=hudson.remoting.Channel@7a009a17:JNLP4-connect connection from <agent hostname / IP>, target=null)
method              : hudson.FilePath.writeObject()
-------------------------------
    at com.thoughtworks.xstream.core.util.SerializationMembers.callWriteObject(SerializationMembers.java:161)
.
.
.
    at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:270)
Caused: java.lang.RuntimeException: Failed to serialize com.mathworks.ci.BuildArtifactAction#workspace for class com.mathworks.ci.BuildArtifactAction
    at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:274)
.
.
.
    at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:270)
Caused: java.lang.RuntimeException: Failed to serialize hudson.model.Actionable#actions for class org.jenkinsci.plugins.workflow.job.WorkflowRun
    at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:274)
.
.
.
    at hudson.XmlFile.write(XmlFile.java:216)
Caused: java.io.IOException
    at hudson.XmlFile.write(XmlFile.java:223)
.
.
.
    at java.base/java.lang.Thread.run(Thread.java:1583)

May 08, 2024 12:17:27 PM WARNING hudson.FilePath _getChannelForSerialization
A FilePath object is being serialized when it should not be, indicating a bug in a plugin. See https://www.jenkins.io/redirect/filepath-serialization for details.
java.io.NotSerializableException: The calling thread Thread[#52022,Running CpsFlowExecution[Owner[<repositoryname>/<branchname>/<buildnumber>:<repositoryname>/<branchname> #<buildnumber>]],5,main] has no associated channel. The current object D:\BuildServerAgents\matlab_agent\workspace\<repositoryname>_<branchname> is interface org.jenkinsci.remoting.SerializableOnlyOverRemoting, but it is likely being serialized/deserialized without the channel
    at org.jenkinsci.remoting.SerializableOnlyOverRemoting.getChannelForSerialization(SerializableOnlyOverRemoting.java:67)
    at hudson.FilePath._getChannelForSerialization(FilePath.java:3563)
    at hudson.FilePath.writeObject(FilePath.java:3552)
.
.
.

May 08, 2024 12:17:28 PM WARNING org.jenkinsci.plugins.workflow.cps.CpsFlowExecution notifyListeners
null
java.lang.IllegalStateException: Can't send a remote FilePath to a different remote channel (current=hudson.remoting.Channel@7a009a17:JNLP4-connect connection from <agent hostname / IP>, target=null)
    at hudson.FilePath.writeObject(FilePath.java:3554)
    at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
    at java.base/java.lang.reflect.Method.invoke(Method.java:580)
    at com.thoughtworks.xstream.core.util.SerializationMembers.callWriteObject(SerializationMembers.java:154)
Caused: com.thoughtworks.xstream.converters.ConversionException: Failed calling method
---- Debugging information ----
message             : Failed calling method
cause-exception     : java.lang.IllegalStateException
cause-message       : Can't send a remote FilePath to a different remote channel (current=hudson.remoting.Channel@7a009a17:JNLP4-connect connection from <agent hostname / IP>, target=null)
method              : hudson.FilePath.writeObject()
-------------------------------
    at com.thoughtworks.xstream.core.util.SerializationMembers.callWriteObject(SerializationMembers.java:161)
.
.
.
    at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:270)
Caused: java.lang.RuntimeException: Failed to serialize com.mathworks.ci.BuildArtifactAction#workspace for class com.mathworks.ci.BuildArtifactAction
    at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:274)
.
.
.
    at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:270)
Caused: java.lang.RuntimeException: Failed to serialize hudson.model.Actionable#actions for class org.jenkinsci.plugins.workflow.job.WorkflowRun
    at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:274)
.
.
.
    at hudson.XmlFile.write(XmlFile.java:216)
Caused: java.io.IOException
    at hudson.XmlFile.write(XmlFile.java:223)
.
.
.
    at java.base/java.lang.Thread.run(Thread.java:1583)

May 08, 2024 12:17:28 PM WARNING hudson.FilePath _getChannelForSerialization
A FilePath object is being serialized when it should not be, indicating a bug in a plugin. See https://www.jenkins.io/redirect/filepath-serialization for details.
java.io.NotSerializableException: The calling thread Thread[#52021,Running CpsFlowExecution[Owner[<repositoryname>/<branchname>/<buildnumber>:<repositoryname>/<branchname> #<buildnumber>]],5,main] has no associated channel. The current object D:\BuildServerAgents\matlab_agent\workspace\<repositoryname>_<branchname> is interface org.jenkinsci.remoting.SerializableOnlyOverRemoting, but it is likely being serialized/deserialized without the channel
    at org.jenkinsci.remoting.SerializableOnlyOverRemoting.getChannelForSerialization(SerializableOnlyOverRemoting.java:67)
    at hudson.FilePath._getChannelForSerialization(FilePath.java:3563)
    at hudson.FilePath.writeObject(FilePath.java:3552)
.
.
.

May 08, 2024 12:17:28 PM WARNING org.jenkinsci.plugins.workflow.cps.CpsFlowExecution notifyListeners
null
java.lang.IllegalStateException: Can't send a remote FilePath to a different remote channel (current=hudson.remoting.Channel@7a009a17:JNLP4-connect connection from <agent hostname / IP>, target=null)
    at hudson.FilePath.writeObject(FilePath.java:3554)
    at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
    at java.base/java.lang.reflect.Method.invoke(Method.java:580)
    at com.thoughtworks.xstream.core.util.SerializationMembers.callWriteObject(SerializationMembers.java:154)
Caused: com.thoughtworks.xstream.converters.ConversionException: Failed calling method
---- Debugging information ----
message             : Failed calling method
cause-exception     : java.lang.IllegalStateException
cause-message       : Can't send a remote FilePath to a different remote channel (current=hudson.remoting.Channel@7a009a17:JNLP4-connect connection from <agent hostname / IP>, target=null)
method              : hudson.FilePath.writeObject()
-------------------------------
    at com.thoughtworks.xstream.core.util.SerializationMembers.callWriteObject(SerializationMembers.java:161)
.
.
.
    at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:270)
Caused: java.lang.RuntimeException: Failed to serialize com.mathworks.ci.BuildArtifactAction#workspace for class com.mathworks.ci.BuildArtifactAction
    at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:274)
.
.
.
    at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:270)
Caused: java.lang.RuntimeException: Failed to serialize hudson.model.Actionable#actions for class org.jenkinsci.plugins.workflow.job.WorkflowRun
.
.
.
    at hudson.XmlFile.write(XmlFile.java:216)
Caused: java.io.IOException
    at hudson.XmlFile.write(XmlFile.java:223)
.
.
.
    at java.base/java.lang.Thread.run(Thread.java:1583)

May 08, 2024 12:17:28 PM WARNING hudson.FilePath _getChannelForSerialization
A FilePath object is being serialized when it should not be, indicating a bug in a plugin. See https://www.jenkins.io/redirect/filepath-serialization for details.
java.io.NotSerializableException: The calling thread Thread[#52021,Running CpsFlowExecution[Owner[<repositoryname>/<branchname>/<buildnumber>:<repositoryname>/<branchname> #<buildnumber>]],5,main] has no associated channel. The current object D:\BuildServerAgents\matlab_agent\workspace\<repositoryname>_<branchname> is interface org.jenkinsci.remoting.SerializableOnlyOverRemoting, but it is likely being serialized/deserialized without the channel
    at org.jenkinsci.remoting.SerializableOnlyOverRemoting.getChannelForSerialization(SerializableOnlyOverRemoting.java:67)
    at hudson.FilePath._getChannelForSerialization(FilePath.java:3563)
    at hudson.FilePath.writeObject(FilePath.java:3552)
.
.
.

May 08, 2024 12:17:28 PM WARNING org.jenkinsci.plugins.workflow.cps.CpsFlowExecution notifyListeners
null
java.lang.IllegalStateException: Can't send a remote FilePath to a different remote channel (current=hudson.remoting.Channel@7a009a17:JNLP4-connect connection from <agent hostname / IP>, target=null)
    at hudson.FilePath.writeObject(FilePath.java:3554)
    at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
    at java.base/java.lang.reflect.Method.invoke(Method.java:580)
    at com.thoughtworks.xstream.core.util.SerializationMembers.callWriteObject(SerializationMembers.java:154)
Caused: com.thoughtworks.xstream.converters.ConversionException: Failed calling method
---- Debugging information ----
message             : Failed calling method
cause-exception     : java.lang.IllegalStateException
cause-message       : Can't send a remote FilePath to a different remote channel (current=hudson.remoting.Channel@7a009a17:JNLP4-connect connection from <agent hostname / IP>, target=null)
method              : hudson.FilePath.writeObject()
-------------------------------
    at com.thoughtworks.xstream.core.util.SerializationMembers.callWriteObject(SerializationMembers.java:161)
.
.
.
    at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:270)
Caused: java.lang.RuntimeException: Failed to serialize com.mathworks.ci.BuildArtifactAction#workspace for class com.mathworks.ci.BuildArtifactAction
    at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:274)
.
.
.
    at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:270)
Caused: java.lang.RuntimeException: Failed to serialize hudson.model.Actionable#actions for class org.jenkinsci.plugins.workflow.job.WorkflowRun
    at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:274)
.
.
.
    at hudson.XmlFile.write(XmlFile.java:216)
Caused: java.io.IOException
    at hudson.XmlFile.write(XmlFile.java:223)
.
.
.
    at java.base/java.lang.Thread.run(Thread.java:1583)

May 08, 2024 12:17:28 PM WARNING hudson.FilePath _getChannelForSerialization
A FilePath object is being serialized when it should not be, indicating a bug in a plugin. See https://www.jenkins.io/redirect/filepath-serialization for details.
java.io.NotSerializableException: The calling thread Thread[#52021,Running CpsFlowExecution[Owner[<repositoryname>/<branchname>/<buildnumber>:<repositoryname>/<branchname> #<buildnumber>]],5,main] has no associated channel. The current object D:\BuildServerAgents\matlab_agent\workspace\<repositoryname>_<branchname> is interface org.jenkinsci.remoting.SerializableOnlyOverRemoting, but it is likely being serialized/deserialized without the channel
    at org.jenkinsci.remoting.SerializableOnlyOverRemoting.getChannelForSerialization(SerializableOnlyOverRemoting.java:67)
    at hudson.FilePath._getChannelForSerialization(FilePath.java:3563)
    at hudson.FilePath.writeObject(FilePath.java:3552)
.
.
.

May 08, 2024 12:17:28 PM WARNING org.jenkinsci.plugins.workflow.cps.CpsFlowExecution notifyListeners
null
java.lang.IllegalStateException: Can't send a remote FilePath to a different remote channel (current=hudson.remoting.Channel@7a009a17:JNLP4-connect connection from <agent hostname / IP>, target=null)
    at hudson.FilePath.writeObject(FilePath.java:3554)
    at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
    at java.base/java.lang.reflect.Method.invoke(Method.java:580)
    at com.thoughtworks.xstream.core.util.SerializationMembers.callWriteObject(SerializationMembers.java:154)
Caused: com.thoughtworks.xstream.converters.ConversionException: Failed calling method
---- Debugging information ----
message             : Failed calling method
cause-exception     : java.lang.IllegalStateException
cause-message       : Can't send a remote FilePath to a different remote channel (current=hudson.remoting.Channel@7a009a17:JNLP4-connect connection from <agent hostname / IP>, target=null)
method              : hudson.FilePath.writeObject()
-------------------------------
    at com.thoughtworks.xstream.core.util.SerializationMembers.callWriteObject(SerializationMembers.java:161)
.
.
.
    at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:270)
Caused: java.lang.RuntimeException: Failed to serialize com.mathworks.ci.BuildArtifactAction#workspace for class com.mathworks.ci.BuildArtifactAction
    at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:274)
.
.
.
    at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:270)
Caused: java.lang.RuntimeException: Failed to serialize hudson.model.Actionable#actions for class org.jenkinsci.plugins.workflow.job.WorkflowRun
    at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:274)
.
.
.
    at hudson.XmlFile.write(XmlFile.java:216)
Caused: java.io.IOException
    at hudson.XmlFile.write(XmlFile.java:223)
.
.
.
    at java.base/java.lang.Thread.run(Thread.java:1583)

May 08, 2024 12:17:28 PM WARNING hudson.FilePath _getChannelForSerialization
A FilePath object is being serialized when it should not be, indicating a bug in a plugin. See https://www.jenkins.io/redirect/filepath-serialization for details.
java.io.NotSerializableException: The calling thread Thread[#52021,Running CpsFlowExecution[Owner[<repositoryname>/<branchname>/<buildnumber>:<repositoryname>/<branchname> #<buildnumber>]],5,main] has no associated channel. The current object D:\BuildServerAgents\matlab_agent\workspace\<repositoryname>_<branchname> is interface org.jenkinsci.remoting.SerializableOnlyOverRemoting, but it is likely being serialized/deserialized without the channel
    at org.jenkinsci.remoting.SerializableOnlyOverRemoting.getChannelForSerialization(SerializableOnlyOverRemoting.java:67)
    at hudson.FilePath._getChannelForSerialization(FilePath.java:3563)
    at hudson.FilePath.writeObject(FilePath.java:3552)
.
.
.

May 08, 2024 12:17:28 PM WARNING org.jenkinsci.plugins.workflow.cps.CpsFlowExecution notifyListeners
null
java.lang.IllegalStateException: Can't send a remote FilePath to a different remote channel (current=hudson.remoting.Channel@7a009a17:JNLP4-connect connection from <agent hostname / IP>, target=null)
    at hudson.FilePath.writeObject(FilePath.java:3554)
    at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
    at java.base/java.lang.reflect.Method.invoke(Method.java:580)
    at com.thoughtworks.xstream.core.util.SerializationMembers.callWriteObject(SerializationMembers.java:154)
Caused: com.thoughtworks.xstream.converters.ConversionException: Failed calling method
---- Debugging information ----
message             : Failed calling method
cause-exception     : java.lang.IllegalStateException
cause-message       : Can't send a remote FilePath to a different remote channel (current=hudson.remoting.Channel@7a009a17:JNLP4-connect connection from <agent hostname / IP>, target=null)
method              : hudson.FilePath.writeObject()
-------------------------------
    at com.thoughtworks.xstream.core.util.SerializationMembers.callWriteObject(SerializationMembers.java:161)
.
.
.
    at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:270)
Caused: java.lang.RuntimeException: Failed to serialize com.mathworks.ci.BuildArtifactAction#workspace for class com.mathworks.ci.BuildArtifactAction
    at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:274)
.
.
.
    at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:270)
Caused: java.lang.RuntimeException: Failed to serialize hudson.model.Actionable#actions for class org.jenkinsci.plugins.workflow.job.WorkflowRun
    at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:274)
.
.
.
    at hudson.XmlFile.write(XmlFile.java:216)
Caused: java.io.IOException
    at hudson.XmlFile.write(XmlFile.java:223)
    at org.jenkinsci.plugins.workflow.support.PipelineIOUtils.writeByXStream(PipelineIOUtils.java:30)
    at org.jenkinsci.plugins.workflow.job.WorkflowRun.save(WorkflowRun.java:1251)
.
.
.
    at java.base/java.lang.Thread.run(Thread.java:1583)

May 08, 2024 12:17:28 PM WARNING hudson.FilePath _getChannelForSerialization
A FilePath object is being serialized when it should not be, indicating a bug in a plugin. See https://www.jenkins.io/redirect/filepath-serialization for details.
java.io.NotSerializableException: The calling thread Thread[#52021,Running CpsFlowExecution[Owner[<repositoryname>/<branchname>/<buildnumber>:<repositoryname>/<branchname> #<buildnumber>]],5,main] has no associated channel. The current object D:\BuildServerAgents\matlab_agent\workspace\<repositoryname>_<branchname> is interface org.jenkinsci.remoting.SerializableOnlyOverRemoting, but it is likely being serialized/deserialized without the channel
    at org.jenkinsci.remoting.SerializableOnlyOverRemoting.getChannelForSerialization(SerializableOnlyOverRemoting.java:67)
    at hudson.FilePath._getChannelForSerialization(FilePath.java:3563)
    at hudson.FilePath.writeObject(FilePath.java:3552)
.
.
.

May 08, 2024 12:17:28 PM WARNING org.jenkinsci.plugins.workflow.cps.CpsFlowExecution notifyListeners
null
java.lang.IllegalStateException: Can't send a remote FilePath to a different remote channel (current=hudson.remoting.Channel@7a009a17:JNLP4-connect connection from <agent hostname / IP>, target=null)
    at hudson.FilePath.writeObject(FilePath.java:3554)
    at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
    at java.base/java.lang.reflect.Method.invoke(Method.java:580)
    at com.thoughtworks.xstream.core.util.SerializationMembers.callWriteObject(SerializationMembers.java:154)
Caused: com.thoughtworks.xstream.converters.ConversionException: Failed calling method
---- Debugging information ----
message             : Failed calling method
cause-exception     : java.lang.IllegalStateException
cause-message       : Can't send a remote FilePath to a different remote channel (current=hudson.remoting.Channel@7a009a17:JNLP4-connect connection from <agent hostname / IP>, target=null)
method              : hudson.FilePath.writeObject()
-------------------------------
    at com.thoughtworks.xstream.core.util.SerializationMembers.callWriteObject(SerializationMembers.java:161)
.
.
.
    at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:270)
Caused: java.lang.RuntimeException: Failed to serialize com.mathworks.ci.BuildArtifactAction#workspace for class com.mathworks.ci.BuildArtifactAction
    at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:274)
.
.
.
    at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:270)
Caused: java.lang.RuntimeException: Failed to serialize hudson.model.Actionable#actions for class org.jenkinsci.plugins.workflow.job.WorkflowRun
    at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:274)
.
.
.
    at hudson.XmlFile.write(XmlFile.java:216)
Caused: java.io.IOException
    at hudson.XmlFile.write(XmlFile.java:223)
.
.
.
    at java.base/java.lang.Thread.run(Thread.java:1583)

May 08, 2024 12:17:28 PM WARNING hudson.FilePath _getChannelForSerialization
A FilePath object is being serialized when it should not be, indicating a bug in a plugin. See https://www.jenkins.io/redirect/filepath-serialization for details.
java.io.NotSerializableException: The calling thread Thread[#52022,Running CpsFlowExecution[Owner[<repositoryname>/<branchname>/<buildnumber>:<repositoryname>/<branchname> #<buildnumber>]],5,main] has no associated channel. The current object D:\BuildServerAgents\matlab_agent\workspace\<repositoryname>_<branchname> is interface org.jenkinsci.remoting.SerializableOnlyOverRemoting, but it is likely being serialized/deserialized without the channel
    at org.jenkinsci.remoting.SerializableOnlyOverRemoting.getChannelForSerialization(SerializableOnlyOverRemoting.java:67)
    at hudson.FilePath._getChannelForSerialization(FilePath.java:3563)
    at hudson.FilePath.writeObject(FilePath.java:3552)
.
.
.

May 08, 2024 12:17:28 PM WARNING org.jenkinsci.plugins.workflow.cps.CpsFlowExecution notifyListeners
null
java.lang.IllegalStateException: Can't send a remote FilePath to a different remote channel (current=hudson.remoting.Channel@7a009a17:JNLP4-connect connection from <agent hostname / IP>, target=null)
    at hudson.FilePath.writeObject(FilePath.java:3554)
    at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
    at java.base/java.lang.reflect.Method.invoke(Method.java:580)
    at com.thoughtworks.xstream.core.util.SerializationMembers.callWriteObject(SerializationMembers.java:154)
Caused: com.thoughtworks.xstream.converters.ConversionException: Failed calling method
---- Debugging information ----
message             : Failed calling method
cause-exception     : java.lang.IllegalStateException
cause-message       : Can't send a remote FilePath to a different remote channel (current=hudson.remoting.Channel@7a009a17:JNLP4-connect connection from <agent hostname / IP>, target=null)
method              : hudson.FilePath.writeObject()
-------------------------------
    at com.thoughtworks.xstream.core.util.SerializationMembers.callWriteObject(SerializationMembers.java:161)
.
.
.
    at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:270)
Caused: java.lang.RuntimeException: Failed to serialize com.mathworks.ci.BuildArtifactAction#workspace for class com.mathworks.ci.BuildArtifactAction
    at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:274)
.
.
.
    at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:270)
Caused: java.lang.RuntimeException: Failed to serialize hudson.model.Actionable#actions for class org.jenkinsci.plugins.workflow.job.WorkflowRun
    at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:274)
.
.
.
    at hudson.XmlFile.write(XmlFile.java:216)
Caused: java.io.IOException
    at hudson.XmlFile.write(XmlFile.java:223)
.
.
.
    at java.base/java.lang.Thread.run(Thread.java:1583)

May 08, 2024 12:17:28 PM WARNING hudson.FilePath _getChannelForSerialization
A FilePath object is being serialized when it should not be, indicating a bug in a plugin. See https://www.jenkins.io/redirect/filepath-serialization for details.
java.io.NotSerializableException: The calling thread Thread[#52021,Running CpsFlowExecution[Owner[<repositoryname>/<branchname>/<buildnumber>:<repositoryname>/<branchname> #<buildnumber>]],5,main] has no associated channel. The current object D:\BuildServerAgents\matlab_agent\workspace\<repositoryname>_<branchname> is interface org.jenkinsci.remoting.SerializableOnlyOverRemoting, but it is likely being serialized/deserialized without the channel
    at org.jenkinsci.remoting.SerializableOnlyOverRemoting.getChannelForSerialization(SerializableOnlyOverRemoting.java:67)
.
.
.
    at com.thoughtworks.xstream.core.util.SerializationMembers.callWriteObject(SerializationMembers.java:154)
.
.
.

May 08, 2024 12:17:28 PM WARNING org.jenkinsci.plugins.workflow.cps.CpsFlowExecution saveOwner
Error persisting Run Owner[<repositoryname>/<branchname>/<buildnumber>:<repositoryname>/<branchname> #<buildnumber>]
java.lang.IllegalStateException: Can't send a remote FilePath to a different remote channel (current=hudson.remoting.Channel@7a009a17:JNLP4-connect connection from <agent hostname / IP>, target=null)
    at hudson.FilePath.writeObject(FilePath.java:3554)
    at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
    at java.base/java.lang.reflect.Method.invoke(Method.java:580)
    at com.thoughtworks.xstream.core.util.SerializationMembers.callWriteObject(SerializationMembers.java:154)
Caused: com.thoughtworks.xstream.converters.ConversionException: Failed calling method
---- Debugging information ----
message             : Failed calling method
cause-exception     : java.lang.IllegalStateException
cause-message       : Can't send a remote FilePath to a different remote channel (current=hudson.remoting.Channel@7a009a17:JNLP4-connect connection from <agent hostname / IP>, target=null)
method              : hudson.FilePath.writeObject()
-------------------------------
    at com.thoughtworks.xstream.core.util.SerializationMembers.callWriteObject(SerializationMembers.java:161)
    at com.thoughtworks.xstream.converters.reflection.SerializableConverter.doMarshal(SerializableConverter.java:257)
.
.
.
Caused: java.lang.RuntimeException: Failed to serialize com.mathworks.ci.BuildArtifactAction#workspace for class com.mathworks.ci.BuildArtifactAction
    at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:274)
.
.
.
    at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:270)
Caused: java.lang.RuntimeException: Failed to serialize hudson.model.Actionable#actions for class org.jenkinsci.plugins.workflow.job.WorkflowRun
    at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:274)
.
.
.
    at hudson.XmlFile.write(XmlFile.java:216)
Caused: java.io.IOException
    at hudson.XmlFile.write(XmlFile.java:223)
    at org.jenkinsci.plugins.workflow.support.PipelineIOUtils.writeByXStream(PipelineIOUtils.java:30)
    at org.jenkinsci.plugins.workflow.job.WorkflowRun.save(WorkflowRun.java:1251)
    at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.saveOwner(CpsFlowExecution.java:2143)
    at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:449)
    at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:331)
    at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:295)
    at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService.lambda$wrap$4(CpsVmExecutorService.java:136)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
.
.
.
    at java.base/java.lang.Thread.run(Thread.java:1583)

May 08, 2024 12:17:28 PM WARNING hudson.FilePath _getChannelForSerialization
A FilePath object is being serialized when it should not be, indicating a bug in a plugin. See https://www.jenkins.io/redirect/filepath-serialization for details.
java.io.NotSerializableException: The calling thread Thread[#52022,Running CpsFlowExecution[Owner[<repositoryname>/<branchname>/<buildnumber>:<repositoryname>/<branchname> #<buildnumber>]],5,main] has no associated channel. The current object D:\BuildServerAgents\matlab_agent\workspace\<repositoryname>_<branchname> is interface org.jenkinsci.remoting.SerializableOnlyOverRemoting, but it is likely being serialized/deserialized without the channel
    at org.jenkinsci.remoting.SerializableOnlyOverRemoting.getChannelForSerialization(SerializableOnlyOverRemoting.java:67)
    at hudson.FilePath._getChannelForSerialization(FilePath.java:3563)
    at hudson.FilePath.writeObject(FilePath.java:3552)
.
.
.

May 08, 2024 12:17:28 PM WARNING org.jenkinsci.plugins.workflow.job.WorkflowRun saveWithoutFailing
Failed to save <repositoryname>/<branchname> #<buildnumber>
java.lang.IllegalStateException: Can't send a remote FilePath to a different remote channel (current=hudson.remoting.Channel@7a009a17:JNLP4-connect connection from <agent hostname / IP>, target=null)
    at hudson.FilePath.writeObject(FilePath.java:3554)
    at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
    at java.base/java.lang.reflect.Method.invoke(Method.java:580)
    at com.thoughtworks.xstream.core.util.SerializationMembers.callWriteObject(SerializationMembers.java:154)
Caused: com.thoughtworks.xstream.converters.ConversionException: Failed calling method
---- Debugging information ----
message             : Failed calling method
cause-exception     : java.lang.IllegalStateException
cause-message       : Can't send a remote FilePath to a different remote channel (current=hudson.remoting.Channel@7a009a17:JNLP4-connect connection from <agent hostname / IP>, target=null)
method              : hudson.FilePath.writeObject()
-------------------------------
    at com.thoughtworks.xstream.core.util.SerializationMembers.callWriteObject(SerializationMembers.java:161)
    at com.thoughtworks.xstream.converters.reflection.SerializableConverter.doMarshal(SerializableConverter.java:257)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshal(AbstractReflectionConverter.java:90)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:68)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:59)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:83)
    at hudson.util.RobustReflectionConverter.marshallField(RobustReflectionConverter.java:283)
    at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:270)
Caused: java.lang.RuntimeException: Failed to serialize com.mathworks.ci.BuildArtifactAction#workspace for class com.mathworks.ci.BuildArtifactAction
    at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:274)
.
.
.
    at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:270)
Caused: java.lang.RuntimeException: Failed to serialize hudson.model.Actionable#actions for class org.jenkinsci.plugins.workflow.job.WorkflowRun
    at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:274)
    at hudson.util.RobustReflectionConverter$2.visit(RobustReflectionConverter.java:241)
.
.
.
    at hudson.XmlFile.write(XmlFile.java:216)
Caused: java.io.IOException
    at hudson.XmlFile.write(XmlFile.java:223)
    at org.jenkinsci.plugins.workflow.support.PipelineIOUtils.writeByXStream(PipelineIOUtils.java:30)
    at org.jenkinsci.plugins.workflow.job.WorkflowRun.save(WorkflowRun.java:1251)
    at hudson.BulkChange.commit(BulkChange.java:98)
    at org.jenkinsci.plugins.workflow.job.WorkflowRun.saveWithoutFailing(WorkflowRun.java:1226)
    at org.jenkinsci.plugins.workflow.job.WorkflowRun.finish(WorkflowRun.java:662)
    at org.jenkinsci.plugins.workflow.job.WorkflowRun$GraphL.onNewHead(WorkflowRun.java:1068)
    at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.notifyListeners(CpsFlowExecution.java:1565)
    at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$3.run(CpsThreadGroup.java:512)
    at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService.lambda$wrap$2(CpsVmExecutorService.java:83)
    at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:139)
    at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
.
.
.

    May 08, 2024 12:24:10 PM WARNING org.jenkinsci.plugins.workflow.cps.CpsFlowExecution onLoad
Error initializing storage and loading nodes, will try to create placeholders for: CpsFlowExecution[Owner[<repositoryname>/<branchname>/<buildnumber>:<repositoryname>/<branchname> #<buildnumber>]]
Also:   org.jenkinsci.plugins.workflow.actions.ErrorAction$ErrorId: 381026c1-e030-4106-bfac-2398cd437175
hudson.AbortException: Cannot resume build because FlowNode 33 for FlowHead 1 could not be loaded.
    at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.initializeStorage(CpsFlowExecution.java:757)
    at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.onLoad(CpsFlowExecution.java:795)
    at org.jenkinsci.plugins.workflow.job.WorkflowRun.getExecution(WorkflowRun.java:719)
    at org.jenkinsci.plugins.workflow.job.WorkflowRun.onLoad(WorkflowRun.java:577)
    at hudson.model.RunMap.retrieve(RunMap.java:233)
    at hudson.model.RunMap.retrieve(RunMap.java:61)
    at jenkins.model.lazy.AbstractLazyLoadRunMap.load(AbstractLazyLoadRunMap.java:663)
    at jenkins.model.lazy.AbstractLazyLoadRunMap.load(AbstractLazyLoadRunMap.java:645)
    at jenkins.model.lazy.AbstractLazyLoadRunMap.getByNumber(AbstractLazyLoadRunMap.java:543)
    at jenkins.model.lazy.LazyBuildMixIn.getBuildByNumber(LazyBuildMixIn.java:240)
    at org.jenkinsci.plugins.workflow.job.WorkflowJob.getBuildByNumber(WorkflowJob.java:234)
    at org.jenkinsci.plugins.workflow.job.WorkflowJob.getBuildByNumber(WorkflowJob.java:105)
.
.
.

May 08, 2024 12:24:10 PM INFO org.jenkinsci.plugins.workflow.cps.CpsFlowExecution createPlaceholderNodes
Creating placeholder flownodes for execution: CpsFlowExecution[Owner[<repositoryname>/<branchname>/<buildnumber>:<repositoryname>/<branchname> #<buildnumber>]]
May 08, 2024 12:24:10 PM WARNING org.jenkinsci.plugins.workflow.graph.FlowNode persistSafe
failed to save actions for FlowNode id=36
java.io.IOException: Cannot save actions for FlowEndNode[id=36, exec=CpsFlowExecution[Owner[<repositoryname>/<branchname>/<buildnumber>:<repositoryname>/<branchname> #<buildnumber>]]] for completed execution CpsFlowExecution[Owner[<repositoryname>/<branchname>/<buildnumber>:<repositoryname>/<branchname> #<buildnumber>]]: [org.jenkinsci.plugins.workflow.actions.ErrorAction@a7c9f06]
    at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.saveActions(CpsFlowExecution.java:1286)
    at org.jenkinsci.plugins.workflow.graph.FlowNode.save(FlowNode.java:486)
    at org.jenkinsci.plugins.workflow.graph.FlowNode.persistSafe(FlowNode.java:492)
    at org.jenkinsci.plugins.workflow.graph.FlowNode$1.add(FlowNode.java:442)
    at org.jenkinsci.plugins.workflow.graph.FlowNode$1.add(FlowNode.java:432)
    at java.base/java.util.AbstractList.add(AbstractList.java:113)
    at hudson.model.Actionable.addAction(Actionable.java:155)
    at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.createPlaceholderNodes(CpsFlowExecution.java:733)
    at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.onLoad(CpsFlowExecution.java:798)
    at org.jenkinsci.plugins.workflow.job.WorkflowRun.getExecution(WorkflowRun.java:719)
    at org.jenkinsci.plugins.workflow.job.WorkflowRun.onLoad(WorkflowRun.java:577)
.
.
.

May 08, 2024 12:24:10 PM WARNING org.jenkinsci.plugins.workflow.graph.FlowNode persistSafe
failed to save actions for FlowNode id=36
java.io.IOException: Cannot save actions for FlowEndNode[id=36, exec=CpsFlowExecution[Owner[<repositoryname>/<branchname>/<buildnumber>:<repositoryname>/<branchname> #<buildnumber>]]] for completed execution CpsFlowExecution[Owner[<repositoryname>/<branchname>/<buildnumber>:<repositoryname>/<branchname> #<buildnumber>]]: [org.jenkinsci.plugins.workflow.actions.ErrorAction@a7c9f06, org.jenkinsci.plugins.workflow.actions.TimingAction@7cdee3e8]
    at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.saveActions(CpsFlowExecution.java:1286)
    at org.jenkinsci.plugins.workflow.graph.FlowNode.save(FlowNode.java:486)
    at org.jenkinsci.plugins.workflow.graph.FlowNode.persistSafe(FlowNode.java:492)
    at org.jenkinsci.plugins.workflow.graph.FlowNode$1.add(FlowNode.java:442)
    at org.jenkinsci.plugins.workflow.graph.FlowNode$1.add(FlowNode.java:432)
    at java.base/java.util.AbstractList.add(AbstractList.java:113)
    at hudson.model.Actionable.addAction(Actionable.java:155)
    at org.jenkinsci.plugins.workflow.cps.FlowHead.setNewHead(FlowHead.java:146)
    at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.createPlaceholderNodes(CpsFlowExecution.java:734)
    at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.onLoad(CpsFlowExecution.java:798)
    at org.jenkinsci.plugins.workflow.job.WorkflowRun.getExecution(WorkflowRun.java:719)
    at org.jenkinsci.plugins.workflow.job.WorkflowRun.onLoad(WorkflowRun.java:577)
.
.
.

May 08, 2024 12:24:10 PM WARNING org.jenkinsci.plugins.workflow.job.WorkflowRun getExecution
Found incomplete build with completed execution - display name: <job name> » <branchname> #<buildnumber>
May 08, 2024 12:24:11 PM WARNING org.jenkinsci.plugins.workflow.flow.FlowExecutionList unregister
Owner[<repositoryname>/<branchname>/<buildnumber>:<repositoryname>/<branchname> #<buildnumber>] was not in the list to begin with: []
nbhoski commented 6 months ago

Hi @Rvh91 could you please help me with following

Rvh91 commented 6 months ago

Hi @nbhoski, We are using version 2.13.1, on Jenkins Version 2.440.3. Honestly it's a bit difficult to backtrack when the issues started, before I never looked at the jenkins logs of the controller, only the console output of the individual builds, so I never noticed when we started to get the 'writePath / Serialization / CpsFlowExecution' and related errors. We have had the issues with the random failures for a while, but never suspected the Matlab Plugin before (we had an 'unclean' kill of a running job, that in combination with the flowNode issues resulted in us suspecting issues in that direction initially). Because of that, I had manually cleaned out all old builds on both the controller and agent, related to that project.

I'm going through the commits on our develop branch, but it is almost impossible to backtrack, as the majority of our build history is now marked as failed. The last build that is still marked as successful ( 19th of march ) also made use of the "runMATLABBuild" command.

I have forked our repo, and started with an empty jenkinsfile to troubleshoot. The issues started popping up there when I started to use the "runMATLABBuild" command. After changing those lines to the aforementioned runMATLABCommand(command: 'buildtool testReport') instead of runMATLABBuild(tasks: 'testReport') the issues went away. Reverting back to the runMATLABBuild also results in those errors returning.

Hope this helps.

nbhoski commented 6 months ago

_I'm going through the commits on our develop branch, but it is almost impossible to backtrack, as the majority of our build history is now marked as failed. The last build that is still marked as successful ( 19th of march ) also made use of the "runMATLABBuild" command

For above on 19 the march when build was successful were you still using the same plugin version?

I have forked our repo, and started with an empty jenkinsfile to troubleshoot. The issues started popping up there when I started to use the "runMATLABBuild" command. After changing those lines to the aforementioned runMATLABCommand(command: 'buildtool testReport') instead of runMATLABBuild(tasks: 'testReport') the issues went away. Reverting back to the runMATLABBuild also results in those errors returning.

Can you please try above by using plugin version prior to 2.13.0 and see if this is reproducible?

Rvh91 commented 6 months ago

@nbhoski, I don't know to be honest, at the time I did not have admin privileges on our Jenkins controller. Is there any way for me to find our when plugins have been updated? I will rollback the plugin to 2.12.0 and try to reproduce the issue.

nbhoski commented 6 months ago

@nbhoski, I don't know to be honest, at the time I did not have admin privileges on our Jenkins controller. Is there any way for me to find our when plugins have been updated? I will rollback the plugin to 2.12.0 and try to reproduce the issue.

Sure , and also could you share buildfile.m that you are using ? so that I could reproduce it locally with latest plugin version

Rvh91 commented 6 months ago

I have tried it with the 2.12.0, and I dont see the same errors in the jenkins log (FlowNode persistSafe, CpsFlowExecution related errors, and FilePath _getChannelForSerialization), which leads me to believe that this version of the plugin does not have the error.

I dont think I'm allowed to share the buildfile though.. Also not sure if that would be of any use, as its calling many functions that you wont have?

nbhoski commented 6 months ago

Hi @Rvh91 since ths is warnning and I can reproduce it without any extra efforts. This should not cause the build failure anyways and this set of warning does not get displayed in the console log. I will work on fixing this warning message however the newer version of plugin should not break your build except for these warning messages.

Marked this as bug will work on this

nbhoski commented 3 months ago

This is fixed