JNLP inbound Agent

58 views
Skip to first unread message

Vitaliy Freidovich

unread,
Oct 31, 2020, 4:27:09 PM10/31/20
to Jenkins Users
Hi,

I'm trying to configure inbound agent (slave).
For this purpose I've defined in Jenkin's Global security setting

TCP port for inbound agents: Fixed: 8081, and created a new node.

The node settings page suggests the following command to be run on the agent:
java -jar agent.jar -jnlpUrl http://ip:8080/computer/NODE/slave-agent.jnlp -secret SECRET -workDir "/home/pi/jenkins"
This is strange, as I configured the TCP Port for inbound connections to be 8081, not 8080.
Moreover, the server itself is secuted with TLS, however jenkins suggests to use HTTP.

Running the command produces the following error:
Failed to obtain http://ip:8080/computer/NODE/slave-agent.jnlp?encrypt=true
java.net.SocketException: Unexpected end of file from server
at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:851)
at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:678)
at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:848)
at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:678)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1593)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1498)
at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480)
at hudson.remoting.Launcher.parseJnlpArguments(Launcher.java:517)
at hudson.remoting.Launcher.run(Launcher.java:347)
at hudson.remoting.Launcher.main(Launcher.java:298)
Waiting 10 seconds before retry


Trying to change port to 8081 produces:
Failed to obtain http://ip:8081/computer/NODE/slave-agent.jnlp?encrypt=true
java.io.IOException: Failed to load http://ci.adam-cogtec.com:8081/computer/VitaliysAutoPi/slave-agent.jnlp?encrypt=true: 404 Not Found
at hudson.remoting.Launcher.parseJnlpArguments(Launcher.java:519)
at hudson.remoting.Launcher.run(Launcher.java:347)
at hudson.remoting.Launcher.main(Launcher.java:298)
Waiting 10 seconds before retry


Changing the URL to https & port 8081 hangs for a long time.

Changing the URL to https & port 8080 produces the following error:
Oct 31, 2020 7:23:14 PM hudson.remoting.jnlp.Main$CuiListener error
SEVERE: Handshake response not received.
io.jenkins.remoting.shaded.javax.websocket.DeploymentException: Handshake response not received.
at io.jenkins.remoting.shaded.org.glassfish.tyrus.client.ClientManager$3$1.run(ClientManager.java:694)
at io.jenkins.remoting.shaded.org.glassfish.tyrus.client.ClientManager$3.run(ClientManager.java:712)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at io.jenkins.remoting.shaded.org.glassfish.tyrus.client.ClientManager$SameThreadExecutorService.execute(ClientManager.java:866)
at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:112)
at io.jenkins.remoting.shaded.org.glassfish.tyrus.client.ClientManager.connectToServer(ClientManager.java:511)
at io.jenkins.remoting.shaded.org.glassfish.tyrus.client.ClientManager.connectToServer(ClientManager.java:355)
at hudson.remoting.Engine.runWebSocket(Engine.java:628)
at hudson.remoting.Engine.run(Engine.java:470)


So which URL should be the right URL, and how would you troubleshoot this issue?

Many Thanks!
Vitaliy

Ivan Fernandez Calvo

unread,
Nov 1, 2020, 1:16:55 PM11/1/20
to Jenkins Users
The inbound agents negotiate the connection calling a HTTP/S URL, because of that your fixed inbound does not apear in the URL you see in the UI. The URL you see there, it is generated with the setting Jenkins URL you have in Manage Jenkins/System Configuration,. Because you see an HTTP URL and you said that you have an HTTPS connection probably you have a warning on Manage Jenkins about that you do not have your Jenkins URL well configured. So if you have a Apache or Nginx in front Jenkins to configure the HTTPS you have to set the Jenkins URL to the effective URL that should use all clients/agents, it is the URL exposed by Apace/Nginx, then your URL to connect you will see in the UI wil be the correct and the negotiation of the inbound port will work. 
One last thing, take care that the agent can reach the HTTP/S and inbound ports.
 

Vitaliy Freidovich

unread,
Nov 2, 2020, 12:39:41 PM11/2/20
to Jenkins Users
Thanks Ivan for your response,

I'm running Jenkins in a standalone mode, without any web server such as Apache / Nginx in front of it,
Jenkins is configured for TSL 8080,
and I've configured the inbound agents fixed 8081 port, so I'm not following what kind of port negotiation should be happening?

All relevant ports are open both on the Jenkins side, and on the slave side,
and I do not see any hints other then those I posted herein.
Where can I find more clues regarding the issue?
How would you troubleshoot it?

Many Thanks!
Vitaliy

Ivan Fernandez Calvo

unread,
Nov 2, 2020, 2:05:41 PM11/2/20
to Jenkins Users
El lunes, 2 de noviembre de 2020 a las 18:39:41 UTC+1, vit...@1-family.net escribió:
Thanks Ivan for your response,

I'm running Jenkins in a standalone mode, without any web server such as Apache / Nginx in front of it,
Jenkins is configured for TSL 8080,
and I've configured the inbound agents fixed 8081 port, so I'm not following what kind of port negotiation should be happening?


Basically, the remoting process connects to the HTTP/S port and the Jenkins instance return the inboud port to connect, if you want to know more see https://docs.oracle.com/javase/tutorial/deployment/deploymentInDepth/jnlp.htmlhttps://github.com/jenkinsci/remoting, and this presentation https://oleg-nenashev.github.io/troubleshooting-remoting-issues/
 
All relevant ports are open both on the Jenkins side, and on the slave side,
and I do not see any hints other then those I posted herein.
Where can I find more clues regarding the issue?
How would you troubleshoot it?


First of all, as I commented before you have to check which Jenkins URL you have configured in Manage Jenkins/System Configuration/Jenkins URL (80% sure it is your issue). Then go to the agent status page and copy the connection command line you have there, with that command line start testing it from your local environment if you have access to both ports 8080 and 8081, if it does not work, the exception should have some information about the error. for troubleshooting the error from here check :



Reply all
Reply to author
Forward
0 new messages