[JIRA] (JENKINS-59778) Pipeline script fails to call Java code on slave: Failed to deserialize the Callable object

2019-10-16 Thread alexander.samoy...@gmail.com (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Alexander Samoylov commented on  JENKINS-59778  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
  Re: Pipeline script fails to call Java code on slave: Failed to deserialize the Callable object   
 

  
 
 
 
 

 
 Well, I understand. Thank you for the clarification. You wrote also above that "The supported way to do this from Pipeline is to implement Step in a plugin, and have the step handle the interactions with remoting". Probably you know some pipeline code which implements similar thing? I tried to look for on https://github.com/jenkinsci/jenkins-scripts/tree/master/scriptler, but did not find anything useful. Could you please refer to some code snippet, of course if you know such one?  
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  
 

  
 

  
 
 
 
  
 

  
 
 
 
 

 
 This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)  
 
 

 
   
 

  
 

  
 

   





-- 
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-issues/JIRA.202502.1571054173000.8884.1571244060153%40Atlassian.JIRA.


[JIRA] (JENKINS-59778) Pipeline script fails to call Java code on slave: Failed to deserialize the Callable object

2019-10-15 Thread dnusb...@cloudbees.com (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Devin Nusbaum closed an issue as Won't Fix  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
 Jenkins /  JENKINS-59778  
 
 
  Pipeline script fails to call Java code on slave: Failed to deserialize the Callable object   
 

  
 
 
 
 

 
Change By: 
 Devin Nusbaum  
 
 
Status: 
 Open Closed  
 
 
Resolution: 
 Won't Fix  
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  
 

  
 

  
 
 
 
  
 

  
 
 
 
 

 
 This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)  
 
 

 
   
 

  
 

  
 

   





-- 
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-issues/JIRA.202502.1571054173000.8008.1571148540515%40Atlassian.JIRA.


[JIRA] (JENKINS-59778) Pipeline script fails to call Java code on slave: Failed to deserialize the Callable object

2019-10-15 Thread dnusb...@cloudbees.com (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Devin Nusbaum commented on  JENKINS-59778  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
  Re: Pipeline script fails to call Java code on slave: Failed to deserialize the Callable object   
 

  
 
 
 
 

 
 Alexander Samoylov GroovyInstallation is Java code from a plugin. Compared to Groovy code in Pipeline, the most important differences are that it is not CPS-transformed, it is not sandbox-transformed, its class loader hierarchy is different, and there is a class file on disk for it somewhere instead of whatever happens for Groovy code run by the embedded Groovy interpreter. I suspect the latter is what is causing problems in your case. Both Pipeline Groovy code and remoting do some tricky low-level things, and so they don't play well together. If you just want to run some Groovy code for debugging purposes, you could try using the script console, which will at least eliminate the Pipeline-specific complexities, to see if that makes a difference.  
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  
 

  
 

  
 
 
 
  
 

  
 
 
 
 

 
 This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)  
 
 

 
   
 

  
 

  
 

   





-- 
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-issues/JIRA.202502.1571054173000.8004.1571148480209%40Atlassian.JIRA.


[JIRA] (JENKINS-59778) Pipeline script fails to call Java code on slave: Failed to deserialize the Callable object

2019-10-15 Thread alexander.samoy...@gmail.com (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Alexander Samoylov edited a comment on  JENKINS-59778  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
  Re: Pipeline script fails to call Java code on slave: Failed to deserialize the Callable object   
 

  
 
 
 
 

 
 [~dnusbaum], Yes, it never worked for me. I will try to describe my use case better.I ran some Java code on slave for debugging purposes. I used the class GroovyInstallation in my pipeline script and the problem was the getExecutable(VirtualChannel channel) method of this class returned null (even after the successful installation).The method getExecutable(VirtualChannel channel) does almost the same what I wrote in my example above (see https://github.com/jenkinsci/groovy-plugin/blob/master/src/main/java/hudson/plugins/groovy/GroovyInstallation.java), that is uses Callable. I wanted to do the same directly from the pipeline code in order to run my modified version of getExecutable (with printouts etc.), but as you see it failed with those exceptions.Obviously I had a question, why Callable usage  this  works via the instance of GroovyInstallation, but does not work from the pipeline directly. I didn't understand what is actually the difference and that's why opened this ticket. If you think that this is not supported, why then it works fine via the instance of GroovyInstallation?   
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  
 

  
 

  
 
 
 
  
 

  
 
 
 
 

 
 This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)  
 
 

 
   
 

  
 

  
 

   





-- 
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-issu

[JIRA] (JENKINS-59778) Pipeline script fails to call Java code on slave: Failed to deserialize the Callable object

2019-10-15 Thread alexander.samoy...@gmail.com (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Alexander Samoylov commented on  JENKINS-59778  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
  Re: Pipeline script fails to call Java code on slave: Failed to deserialize the Callable object   
 

  
 
 
 
 

 
 Devin Nusbaum, Yes, it never worked for me. I will try to describe my use case better. I ran some Java code on slave for debugging purposes. I used the class GroovyInstallation in my pipeline script and the problem was the getExecutable(VirtualChannel channel) method of this class returned null (even after the successful installation). The method getExecutable(VirtualChannel channel) does almost the same what I wrote in my example above (see https://github.com/jenkinsci/groovy-plugin/blob/master/src/main/java/hudson/plugins/groovy/GroovyInstallation.java), that is uses Callable. I wanted to do the same directly from the pipeline code in order to run my modified version of getExecutable (with printouts etc.), but as you see it failed with those exceptions. Obviously I had a question, why Callable usage this works via the instance of GroovyInstallation, but does not work from the pipeline directly. I didn't understand what is actually the difference and that's why opened this ticket. If you think that this is not supported, why then it works fine via the instance of GroovyInstallation?   
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  
 

  
 

  
 
 
 
  
 

  
 
 
 
 

 
 This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)  
 
 

 
   
 

  
 

  
 

   





-- 
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-issues/J

[JIRA] (JENKINS-59778) Pipeline script fails to call Java code on slave: Failed to deserialize the Callable object

2019-10-15 Thread dnusb...@cloudbees.com (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Devin Nusbaum commented on  JENKINS-59778  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
  Re: Pipeline script fails to call Java code on slave: Failed to deserialize the Callable object   
 

  
 
 
 
 

 
 Yes, using remoting directly from Pipelines is not supported. The supported way to do this from Pipeline is to implement Step in a plugin, and have the step handle the interactions with remoting. Alexander Samoylov, this has never worked for you, right? Or did it work previously before some plugin/core upgrade?  
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  
 

  
 

  
 
 
 
  
 

  
 
 
 
 

 
 This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)  
 
 

 
   
 

  
 

  
 

   





-- 
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-issues/JIRA.202502.1571054173000.7981.1571146080237%40Atlassian.JIRA.


[JIRA] (JENKINS-59778) Pipeline script fails to call Java code on slave: Failed to deserialize the Callable object

2019-10-15 Thread db...@cloudbees.com (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Daniel Beck commented on  JENKINS-59778  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
  Re: Pipeline script fails to call Java code on slave: Failed to deserialize the Callable object   
 

  
 
 
 
 

 
 I'm pretty sure writing callables in pipeline is unsupported. Devin Nusbaum perhaps? Does this look sane?  
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  
 

  
 

  
 
 
 
  
 

  
 
 
 
 

 
 This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)  
 
 

 
   
 

  
 

  
 

   





-- 
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-issues/JIRA.202502.1571054173000.7583.1571129761338%40Atlassian.JIRA.


[JIRA] (JENKINS-59778) Pipeline script fails to call Java code on slave: Failed to deserialize the Callable object

2019-10-14 Thread alexander.samoy...@gmail.com (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Alexander Samoylov created an issue  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
 Jenkins /  JENKINS-59778  
 
 
  Pipeline script fails to call Java code on slave: Failed to deserialize the Callable object   
 

  
 
 
 
 

 
Issue Type: 
  Bug  
 
 
Assignee: 
 Jeff Thompson  
 
 
Components: 
 pipeline, remoting  
 
 
Created: 
 2019-10-14 11:56  
 
 
Environment: 
 Jenkins server: 2.190.1  
 
 
Priority: 
  Minor  
 
 
Reporter: 
 Alexander Samoylov  
 

  
 
 
 
 

 
 This is a simple pipeline script on which the issue is reproduced: 

 

import jenkins.security.MasterToSlaveCallable;
//import hudson.remoting.Callable;

def executeJavaCodeOnNode() {

def node = Jenkins.getInstance().slaves.find({it.name == env.NODE_NAME})
def hostChannel = node.getComputer().getChannel()
def task = new MasterToSlaveCallable() {
public String call() throws IOException {
return new String("-on the node-");
}
};

hostChannel.call(task);
}

// Main
node ('linux-01') {
executeJavaCodeOnNode()
}
 

 This simple pipeline script fails with multiple Java exceptions. I think the most relevent of them are: 

 

java.lang.IllegalArgumentException: Unable to locate class file for class WorkflowScript$1
	at hudson.remoting.Which.classFileUrl(Which.java:65)
	at hudson.remoting.RemoteClassLoader$ClassLoaderProxy.fetch4(RemoteClassLoader.java:860)
	at hudson.re