If I remember correctly, the non 0 status of the command is enough to exit. Your exit 0, will not be executed. There is a workaround for that.
On Tue, May 7, 2019 at 3:28 PM Alexandru Băluț <[email protected]> wrote: > I set up a freestyle job which has a single "Execute shell" build step, > and is run on a remote node. The shell script starts some jobs in the > background, then waits for one of them to exit, then kills them all with > "killall -9 jobName || echo dead", then at the end it "exit 0" to signal > success. There are no post build steps. > > Despite "exit 0", the job fails. It would be useful if the "FATAL: Remote > call on instance-1 failed" message includes the failure reason. > > There are some "Also:" stacktraces printed, see below, which don't appear > when the script contains only "exit 0". Do you think these are related to > the failure? > > How can I find what's causing this failure? > > --- Console output below --- > > Started by remote host 1.1.1.1 > Building remotely on instance-1 (sim) in workspace /path/to/JobName > [JobName] $ /bin/sh -xe /tmp/jenkins6599300392607514127.sh > > [...] > > + date > Mon May 6 13:38:06 UTC 2019 > + echo Done > Done > + exit 0 > FATAL: Remote call on instance-1 failed > Also: hudson.remoting.Channel$CallSiteStackTrace: Remote call to channel > at > hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1737) > at hudson.remoting.Request.call(Request.java:197) > at > hudson.remoting.RemoteInvocationHandler.invoke(RemoteInvocationHandler.java:281) > at com.sun.proxy.$Proxy6.fetch3(Unknown Source) > at > hudson.remoting.RemoteClassLoader.findClass(RemoteClassLoader.java:209) > at java.lang.ClassLoader.loadClass(ClassLoader.java:588) > at java.lang.ClassLoader.loadClass(ClassLoader.java:521) > at java.lang.Class.forName0(Native Method) > at java.lang.Class.forName(Class.java:315) > at > hudson.util.ProcessTree$UnixReflection.<clinit>(ProcessTree.java:778) > at > hudson.util.ProcessTree$UnixProcess.kill(ProcessTree.java:726) > at > hudson.util.ProcessTree$UnixProcess.killRecursively(ProcessTree.java:747) > at hudson.util.ProcessTree$Unix.killAll(ProcessTree.java:666) > at > hudson.Launcher$RemoteLauncher$KillTask.call(Launcher.java:1096) > at > hudson.Launcher$RemoteLauncher$KillTask.call(Launcher.java:1087) > at hudson.remoting.UserRequest.perform(UserRequest.java:210) > at hudson.remoting.UserRequest.perform(UserRequest.java:53) > at hudson.remoting.Request$2.run(Request.java:364) > at > hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72) > at java.util.concurrent.FutureTask.run(FutureTask.java:264) > at > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) > at > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) > at java.lang.Thread.run(Thread.java:834) > java.lang.ClassNotFoundException: Classloading from system classloader > disabled > at > hudson.remoting.RemoteClassLoader$ClassLoaderProxy.fetch4(RemoteClassLoader.java:854) > at > hudson.remoting.RemoteClassLoader$ClassLoaderProxy.fetch3(RemoteClassLoader.java:889) > at sun.reflect.GeneratedMethodAccessor9164.invoke(Unknown Source) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > at java.lang.reflect.Method.invoke(Method.java:498) > at > hudson.remoting.RemoteInvocationHandler$RPCRequest.perform(RemoteInvocationHandler.java:929) > at hudson.remoting.Request$2.run(Request.java:369) > at > hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72) > at > org.jenkinsci.remoting.CallableDecorator.call(CallableDecorator.java:19) > at > hudson.remoting.CallableDecoratorList$1.call(CallableDecoratorList.java:21) > at > jenkins.util.ContextResettingExecutorService$2.call(ContextResettingExecutorService.java:46) > at > jenkins.security.ImpersonatingExecutorService$2.call(ImpersonatingExecutorService.java:71) > at java.util.concurrent.FutureTask.run(FutureTask.java:266) > at > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) > at > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) > at java.lang.Thread.run(Thread.java:748) > Also: hudson.remoting.Channel$CallSiteStackTrace: Remote call to instance-1 > at > hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1741) > at hudson.remoting.UserResponse.retrieve(UserRequest.java:389) > at hudson.remoting.Channel.call(Channel.java:955) > at hudson.Launcher$RemoteLauncher.kill(Launcher.java:1084) > at > hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:510) > at hudson.model.Run.execute(Run.java:1819) > at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) > at > hudson.model.ResourceController.execute(ResourceController.java:97) > at hudson.model.Executor.run(Executor.java:429) > Caused: java.lang.LinkageError > at hudson.util.ProcessTree$UnixReflection.<clinit>(ProcessTree.java:789) > at hudson.util.ProcessTree$UnixProcess.kill(ProcessTree.java:726) > at > hudson.util.ProcessTree$UnixProcess.killRecursively(ProcessTree.java:747) > at hudson.util.ProcessTree$Unix.killAll(ProcessTree.java:666) > at hudson.Launcher$RemoteLauncher$KillTask.call(Launcher.java:1096) > at hudson.Launcher$RemoteLauncher$KillTask.call(Launcher.java:1087) > at hudson.remoting.UserRequest.perform(UserRequest.java:210) > at hudson.remoting.UserRequest.perform(UserRequest.java:53) > at hudson.remoting.Request$2.run(Request.java:364) > at > hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72) > at java.util.concurrent.FutureTask.run(FutureTask.java:264) > at > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) > at > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) > at java.lang.Thread.run(Thread.java:834) > Caused: java.io.IOException: Remote call on instance-1 failed > at hudson.remoting.Channel.call(Channel.java:961) > at hudson.Launcher$RemoteLauncher.kill(Launcher.java:1084) > at > hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:510) > at hudson.model.Run.execute(Run.java:1819) > at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) > at hudson.model.ResourceController.execute(ResourceController.java:97) > at hudson.model.Executor.run(Executor.java:429) > Finished: FAILURE > > > -- > You received this message because you are subscribed to the Google Groups > "Jenkins Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/jenkinsci-users/CAM__n4pZhvewoHCxkb%3D54zGQKdP7BgMFfcvN2B77Cgm7DB61yg%40mail.gmail.com > <https://groups.google.com/d/msgid/jenkinsci-users/CAM__n4pZhvewoHCxkb%3D54zGQKdP7BgMFfcvN2B77Cgm7DB61yg%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- Sent from mobile device, excuse typos if any. -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAPzcO4jDbx%2BxgTCMf-efJ4eCLc%2BqnLgcL_SoQzOkx1siTm2-9g%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
