How to troubleshoot JNLP agents connection issues with Jenkins?

Precondition: The agent (formerly agent) was not working before

Symptoms

  • I am not able to connect the agent to the Master

Diagnosis/Treatment

Ensure that the Java version is at least on the same line on both master and agent

A good practice is to run the exactly same Java version in both Jenkins and agent, but when this is not possible it is recommendable to be running at least the same base line.

Run java -version in both Jenkins master box and agent to check the java version you are running in both.

Ensure that the version of agent.jar matches with the one

The main problem of running JNLP as a agent Launcher is that when you upgrade Jenkins slave.jar is not automatically upgraded on the agent - which by the way happens in SSH Launcher out of the box. It can be solved by using JNLP + winsw configuring the tag fro the service wrapper.

Check that slave.jar is the same using for example md5sum agent.jar. agent.jar can be downloaded from Jenkins master from the URL below:

http://<JENKINS_URL>/jnlpJars/agent.jar

Connectivities checks

Use jenkins-cli to check the connection

In the agent box, download the CLI and run a help command in your favorite mode. For example, using http

java -jar jenkins-cli.jar [-s JENKINS_URL] -auth <user>:<token> help

Check that the agent is able to see the JENKINS headers

# curl -IvL <JENKINS_URL>
curl -IvL https://jenkins:8443

Curl command can be available on a Windows box using for example curl Download Wizard

Check that the JNLP port is accesible to the agent

# telnet <JENKINS_HOST> <JNLP_PORT>
telnet jenkins.host.example.com 50234

Load balancer or ha-proxy

Check CloudBees Jenkins platform (CJP) JNLP connectivity Best Practices.

Clear the Java Web Start Cache

If, when starting the JNLP file, you see an error like the one below, run the command javaws -clearcache to clear the cache of the java webstart program.

java.net.SocketException: Connection reset
	at java.net.SocketInputStream.read(Unknown Source)
	at java.net.SocketInputStream.read(Unknown Source)
	at sun.security.ssl.InputRecord.readFully(Unknown Source)
	at sun.security.ssl.InputRecord.read(Unknown Source)
	at sun.security.ssl.SSLSocketImpl.readRecord(Unknown Source)
	at sun.security.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)
	at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
	at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
	at sun.net.www.protocol.https.HttpsClient.afterConnect(Unknown Source)
	at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Unknown Source)
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source)
	at sun.net.www.protocol.http.HttpURLConnection.access$200(Unknown Source)
	at sun.net.www.protocol.http.HttpURLConnection$9.run(Unknown Source)
	at sun.net.www.protocol.http.HttpURLConnection$9.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.AccessController.doPrivilegedWithCombiner(Unknown Source)
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
	at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(Unknown Source)
	at com.sun.deploy.net.HttpUtils.followRedirects(Unknown Source)
	at com.sun.deploy.net.BasicHttpRequest.doRequest(Unknown Source)
	at com.sun.deploy.net.BasicHttpRequest.doGetRequestEX(Unknown Source)
	at com.sun.deploy.cache.ResourceProviderImpl.checkUpdateAvailable(Unknown Source)
	at com.sun.deploy.cache.ResourceProviderImpl.isUpdateAvailable(Unknown Source)
	at com.sun.deploy.cache.ResourceProviderImpl.getResource(Unknown Source)
	at com.sun.deploy.cache.ResourceProviderImpl.getResource(Unknown Source)
	at com.sun.javaws.LaunchDownload$DownloadTask.call(Unknown Source)
	at java.util.concurrent.FutureTask.run(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)

Information to be attached in case you need to open a Support ticket at CloudBees Support

Required Data: JNLP dedicated agents

Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.