Windows Slave : Undocumented DCOM Issue : "JIException: Service Already Running" after reboot.

458 views
Skip to first unread message

Fred Clausen

unread,
Jun 6, 2016, 1:50:23 AM6/6/16
to Jenkins Users
 Hello All,

We want to use DCOM to control the Windows slaves/nodes because we'd like to fully automate the slave provisioning process and just point Jenkins to a slave and have it connect without having to manually log and in and do the JNLP thing.

I've been able to set up a remote Jenkins node running Windows using the indispensable DCOM troubleshooting guide. It actually works once set up but then if I reboot a node Jenkins cannot successfully reconnect. I'm seeing the following in the log files that is not represented in the DCOM troubleshooting guide :

Connecting to computer.example.com
Checking if Java exists
java -version returned 1.8.0.
Copying jenkins-slave.xml
Copying slave.jar
Starting the service
ERROR: Unexpected error in launching a slave. This is probably a bug in Jenkins
java.lang.reflect.UndeclaredThrowableException
	at com.sun.proxy.$Proxy148.start(Unknown Source)
	at hudson.os.windows.ManagedWindowsServiceLauncher.launch(ManagedWindowsServiceLauncher.java:334)
	at hudson.slaves.SlaveComputer$1.call(SlaveComputer.java:253)
	at jenkins.util.ContextResettingExecutorService$2.call(ContextResettingExecutorService.java:46)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.reflect.InvocationTargetException
	at sun.reflect.GeneratedMethodAccessor82593.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.kohsuke.jinterop.JInteropInvocationHandler.invoke(JInteropInvocationHandler.java:140)
	... 8 more
Caused by: org.jinterop.dcom.common.JIException: Service Already Running
	at org.jvnet.hudson.wmi.Win32Service$Implementation.start(Win32Service.java:149)
	... 12 more

If I then RDP into the Windows machine and stop the service the master is subsequently able to start it. Is there a way to have the master attempt to stop the slave agent on Windows prior to attempting to start it? This would allow reboots of Windows slaves not to require manual intervention if they are restared for whatever reason (updates, etc).

Thanks,

Fred.

Fred Clausen

unread,
Jun 15, 2016, 3:10:09 AM6/15/16
to Jenkins Users
Some of this was caused by me accidentally having two Jenkins computers pointing at the same VM. But even once that was fixed it still happened from time to time after a reboot.

So I worked around this by installing a scheduled task to run at bootup to disable the Jenkins slave. Then the Jenkins master can start up the slave service properly. 

Cheers,

Fred.
Reply all
Reply to author
Forward
0 new messages