[JIRA] (JENKINS-50100) Sleep throws after calling Jenkins.instance like getItemByFullName

2018-03-12 Thread joesatriani...@gmail.com (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Serghei Moret closed an issue as Not A Defect  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
 Jenkins /  JENKINS-50100  
 
 
  Sleep throws after calling Jenkins.instance like getItemByFullName   
 

  
 
 
 
 

 
Change By: 
 Serghei Moret  
 
 
Status: 
 Reopened Closed  
 
 
Resolution: 
 Not A Defect  
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  
 

  
 

  
 
 
 
  
 

  
 
 
 
 

 
 This message was sent by Atlassian JIRA (v7.3.0#73011-sha1:3c73d0e)  
 
 

 
   
 

  
 

  
 

   





-- 
You received this message because you are subscribed to the Google Groups "Jenkins Issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[JIRA] (JENKINS-50100) Sleep throws after calling Jenkins.instance like getItemByFullName

2018-03-12 Thread joesatriani...@gmail.com (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Serghei Moret edited a comment on  JENKINS-50100  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
  Re: Sleep throws after calling Jenkins.instance like getItemByFullName   
 

  
 
 
 
 

 
 Thanks [~abayer]  , works like a charm  
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  
 

  
 

  
 
 
 
  
 

  
 
 
 
 

 
 This message was sent by Atlassian JIRA (v7.3.0#73011-sha1:3c73d0e)  
 
 

 
   
 

  
 

  
 

   





-- 
You received this message because you are subscribed to the Google Groups "Jenkins Issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[JIRA] (JENKINS-50100) Sleep throws after calling Jenkins.instance like getItemByFullName

2018-03-12 Thread joesatriani...@gmail.com (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Serghei Moret commented on  JENKINS-50100  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
  Re: Sleep throws after calling Jenkins.instance like getItemByFullName   
 

  
 
 
 
 

 
 Thanks Andrew Bayer  
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  
 

  
 

  
 
 
 
  
 

  
 
 
 
 

 
 This message was sent by Atlassian JIRA (v7.3.0#73011-sha1:3c73d0e)  
 
 

 
   
 

  
 

  
 

   





-- 
You received this message because you are subscribed to the Google Groups "Jenkins Issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[JIRA] (JENKINS-50100) Sleep throws after calling Jenkins.instance like getItemByFullName

2018-03-12 Thread andrew.ba...@gmail.com (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Andrew Bayer commented on  JENKINS-50100  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
  Re: Sleep throws after calling Jenkins.instance like getItemByFullName   
 

  
 
 
 
 

 
 @NonCPS basically means "don't run this method in the main Pipeline thread", which gets serialized for durability to work. So you should never let any objects that you don't know are serializable leak out of a @NonCPS method. In your example, I'd change it to: 

 

@NonCPS
def getJobs(project) {
 return Jenkins.instance.getItemByFullName(project)?.toString()
}
 

 ...so that you're returning a String, and not a WorkflowJob. Once the WorkflowJob returned by Jenkins.instance.getItemByFullName(project) gets out of the @NonCPS method, you're going to end up hitting serialization issues.  
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  
 

  
 

  
 
 
 
  
 

  
 
 
 
 

 
 This message was sent by Atlassian JIRA (v7.3.0#73011-sha1:3c73d0e)  
 
 

 
   
 

  
 

  
 

   





-- 
You received this message because you are subscribed to the Google Groups "Jenkins Issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[JIRA] (JENKINS-50100) Sleep throws after calling Jenkins.instance like getItemByFullName

2018-03-12 Thread joesatriani...@gmail.com (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Serghei Moret edited a comment on  JENKINS-50100  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
  Re: Sleep throws after calling Jenkins.instance like getItemByFullName   
 

  
 
 
 
 

 
 [~abayer]  Thank you fro the quick answer.  Can you please consult more about @NonCPS (unfortunately for this job I need to get the list of jobs using getItemByFullName)? I've tried it but still getting the same. Here is what I do:  {code:java}@NonCPSdef getJobs(project) { return Jenkins.instance.getItemByFullName(project)}def job = getJobs("monorepo-deploy")println jobsleep 10{code}  Stack trace looks the same as w/o @NonCPS {code:java} [Pipeline] echoorg.jenkinsci.plugins.workflow.job.WorkflowJob@63b1886d[ios-calabash-monorepo-deploy][Pipeline] sleepSleeping for 10 sec[Pipeline] End of Pipelinean exception which occurred: in field com.cloudbees.groovy.cps.impl.BlockScopeEnv.locals in object com.cloudbees.groovy.cps.impl.BlockScopeEnv@5d7f9cec in field com.cloudbees.groovy.cps.impl.CallEnv.caller in object com.cloudbees.groovy.cps.impl.FunctionCallEnv@7a368476 in field com.cloudbees.groovy.cps.Continuable.e in object org.jenkinsci.plugins.workflow.cps.SandboxContinuable@539f7260 in field org.jenkinsci.plugins.workflow.cps.CpsThread.program in object org.jenkinsci.plugins.workflow.cps.CpsThread@28a02409 in field org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.threads in object org.jenkinsci.plugins.workflow.cps.CpsThreadGroup@6022fdd7 in object org.jenkinsci.plugins.workflow.cps.CpsThreadGroup@6022fdd7Caused: java.io.NotSerializableException: org.jenkinsci.plugins.workflow.job.WorkflowJob at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:860) 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.HashMap.internalWriteEntries(HashMap.java:1785) at java.util.HashMap.writeObject(HashMap.java:1362) at sun.reflect.GeneratedMethodAccessor124.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.jboss.marshalling.reflect.SerializableClass.callWriteObject(SerializableClass.java:273) 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.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032) at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988) 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.doWriteFields(RiverMarshaller.java:1032) at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988) at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:967) at 

[JIRA] (JENKINS-50100) Sleep throws after calling Jenkins.instance like getItemByFullName

2018-03-12 Thread joesatriani...@gmail.com (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Serghei Moret reopened an issue  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
 Jenkins /  JENKINS-50100  
 
 
  Sleep throws after calling Jenkins.instance like getItemByFullName   
 

  
 
 
 
 

 
Change By: 
 Serghei Moret  
 
 
Resolution: 
 Not A Defect  
 
 
Status: 
 Resolved Reopened  
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  
 

  
 

  
 
 
 
  
 

  
 
 
 
 

 
 This message was sent by Atlassian JIRA (v7.3.0#73011-sha1:3c73d0e)  
 
 

 
   
 

  
 

  
 

   





-- 
You received this message because you are subscribed to the Google Groups "Jenkins Issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[JIRA] (JENKINS-50100) Sleep throws after calling Jenkins.instance like getItemByFullName

2018-03-12 Thread joesatriani...@gmail.com (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Serghei Moret commented on  JENKINS-50100  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
  Re: Sleep throws after calling Jenkins.instance like getItemByFullName   
 

  
 
 
 
 

 
 Andrew Bayer Can you please consult more about @NonCPS (unfortunately for this job I need to get the list of jobs using getItemByFullName)? I've tried it but still getting the same. Here is what I do:     

 

@NonCPS
def getJobs(project) {
 return Jenkins.instance.getItemByFullName(project)
}
def job = getJobs("monorepo-deploy")
println job
sleep 10
 

     Stack trace looks the same as w/o @NonCPS [Pipeline] echo org.jenkinsci.plugins.workflow.job.WorkflowJob@63b1886d[ios-calabash-monorepo-deploy] [Pipeline] sleep Sleeping for 10 sec [Pipeline] End of Pipeline an exception which occurred: in field com.cloudbees.groovy.cps.impl.BlockScopeEnv.locals in object com.cloudbees.groovy.cps.impl.BlockScopeEnv@5d7f9cec in field com.cloudbees.groovy.cps.impl.CallEnv.caller in object com.cloudbees.groovy.cps.impl.FunctionCallEnv@7a368476 in field com.cloudbees.groovy.cps.Continuable.e in object org.jenkinsci.plugins.workflow.cps.SandboxContinuable@539f7260 in field org.jenkinsci.plugins.workflow.cps.CpsThread.program in object org.jenkinsci.plugins.workflow.cps.CpsThread@28a02409 in field org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.threads in object org.jenkinsci.plugins.workflow.cps.CpsThreadGroup@6022fdd7 in object org.jenkinsci.plugins.workflow.cps.CpsThreadGroup@6022fdd7 Caused: java.io.NotSerializableException: org.jenkinsci.plugins.workflow.job.WorkflowJob at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:860) 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.HashMap.internalWriteEntries(HashMap.java:1785) at java.util.HashMap.writeObject(HashMap.java:1362) at sun.reflect.GeneratedMethodAccessor124.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.jboss.marshalling.reflect.SerializableClass.callWriteObject(SerializableClass.java:273) 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.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032) at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988) at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:967) at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854) at 

[JIRA] (JENKINS-50100) Sleep throws after calling Jenkins.instance like getItemByFullName

2018-03-11 Thread andrew.ba...@gmail.com (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Andrew Bayer resolved as Not A Defect  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
 As the stacktrace shows, the problem is that you’ve called getItemByFullName and now have a WorkflowJob object in scope. So when the Pipeline is next serialized (which will happen eventually regardless but is always triggered by a sleep, things fail because WorkflowJob isn’t serializable. You should avoid calling things like Jenkins.instance.getItemByFullName in the first place, but if you must, you should do so in a method annotated with @NonCPS. Methods with that annotation can’t call Pipeline steps but aren’t serialized.  
 

  
 
 
 
 

 
 Jenkins /  JENKINS-50100  
 
 
  Sleep throws after calling Jenkins.instance like getItemByFullName   
 

  
 
 
 
 

 
Change By: 
 Andrew Bayer  
 
 
Status: 
 Open Resolved  
 
 
Resolution: 
 Not A Defect  
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  
 

  
 

  
 
 
 
  
 

  
 
 
 
 

 
 This message was sent by Atlassian JIRA (v7.3.0#73011-sha1:3c73d0e)  
 
 

 
   
 
   

[JIRA] (JENKINS-50100) Sleep throws after calling Jenkins.instance like getItemByFullName

2018-03-11 Thread joesatriani...@gmail.com (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Serghei Moret updated an issue  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
 Jenkins /  JENKINS-50100  
 
 
  Sleep throws after calling Jenkins.instance like getItemByFullName   
 

  
 
 
 
 

 
Change By: 
 Serghei Moret  
 

  
 
 
 
 

 
 Jenkins throws immediately while trying to sleep (it says sleeping but immediately throws, so the sleep doesn't happen). This happens only when the sleep command stays after Jenkins.instance.getItemByFullName method call. If I call sleep just one line before it sleeps as expected.Stack trace: {code:java} [Pipeline] sleepSleeping for 10 sec[Pipeline] End of Pipelinean exception which occurred: in field com.cloudbees.groovy.cps.impl.BlockScopeEnv.locals in object com.cloudbees.groovy.cps.impl.BlockScopeEnv@6e3fdbf0 in field com.cloudbees.groovy.cps.impl.CallEnv.caller in object com.cloudbees.groovy.cps.impl.FunctionCallEnv@42c458b6 in field com.cloudbees.groovy.cps.Continuable.e in object org.jenkinsci.plugins.workflow.cps.SandboxContinuable@689786e7 in field org.jenkinsci.plugins.workflow.cps.CpsThread.program in object org.jenkinsci.plugins.workflow.cps.CpsThread@79ea6269 in field org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.threads in object org.jenkinsci.plugins.workflow.cps.CpsThreadGroup@ac4614b in object org.jenkinsci.plugins.workflow.cps.CpsThreadGroup@ac4614bCaused: java.io.NotSerializableException: org.jenkinsci.plugins.workflow.job.WorkflowJob at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:860) 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.HashMap.internalWriteEntries(HashMap.java:1785) at java.util.HashMap.writeObject(HashMap.java:1362) at sun.reflect.GeneratedMethodAccessor124.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.jboss.marshalling.reflect.SerializableClass.callWriteObject(SerializableClass.java:273) 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.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032) at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988) at 

[JIRA] (JENKINS-50100) Sleep throws after calling Jenkins.instance like getItemByFullName

2018-03-11 Thread joesatriani...@gmail.com (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Serghei Moret created an issue  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
 Jenkins /  JENKINS-50100  
 
 
  Sleep throws after calling Jenkins.instance like getItemByFullName   
 

  
 
 
 
 

 
Issue Type: 
  Bug  
 
 
Assignee: 
 Unassigned  
 
 
Components: 
 pipeline  
 
 
Created: 
 2018-03-11 20:53  
 
 
Labels: 
 jenkins pipeline  
 
 
Priority: 
  Major  
 
 
Reporter: 
 Serghei Moret  
 

  
 
 
 
 

 
 Jenkins throws immediately while trying to sleep (it says sleeping but immediately throws, so the sleep doesn't happen). This happens only when the sleep command stays after Jenkins.instance.getItemByFullName method call. If I call sleep just one line before it sleeps as expected. Stack trace: [Pipeline] sleep Sleeping for 10 sec [Pipeline] End of Pipeline an exception which occurred: in field com.cloudbees.groovy.cps.impl.BlockScopeEnv.locals in object com.cloudbees.groovy.cps.impl.BlockScopeEnv@6e3fdbf0 in field com.cloudbees.groovy.cps.impl.CallEnv.caller in object com.cloudbees.groovy.cps.impl.FunctionCallEnv@42c458b6 in field com.cloudbees.groovy.cps.Continuable.e in object org.jenkinsci.plugins.workflow.cps.SandboxContinuable@689786e7 in field org.jenkinsci.plugins.workflow.cps.CpsThread.program in object org.jenkinsci.plugins.workflow.cps.CpsThread@79ea6269 in field org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.threads in object org.jenkinsci.plugins.workflow.cps.CpsThreadGroup@ac4614b in object org.jenkinsci.plugins.workflow.cps.CpsThreadGroup@ac4614b Caused: java.io.NotSerializableException: org.jenkinsci.plugins.workflow.job.WorkflowJob at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:860) at org.jboss.marshalling.river.BlockMarshaller.doWriteObject(BlockMarshaller.java:65) at org.jboss.marshalling.river.BlockMarshaller.writeObject(BlockMarshaller.java:56) at