Scenario / Questions

I have a win2k8 machine used as our CI master server (Jenkins)

I have various other servers running as slaves

The master is listening for slave connections on port 2000

  • SlaveA – can connect to master on 2000
  • SlaveB – is unable to connect to master on 2000
  • SlaveB – can connect to master on another port
  • SlaveA – only has 2000 available as an open port
  • SlaveB – does not seemingly use port 2000 for anything and does not have any firewall rules peventing it’s use as demonstrated with netstat

The behaviours of SlaveA and SlaveB are common amoung several different machines. I.e. I have 3 unrelated servers (different hosts, different networks) that do not connect and several that can connect.

The output of the slave agent when failing to connect is:

03-Oct-2011 15:07:22 hudson.remoting.jnlp.Main$CuiListener <init>
INFO: Hudson agent is running in headless mode.
03-Oct-2011 15:07:22 hudson.remoting.jnlp.Main$CuiListener status
INFO: Locating server among [http://myserver:8080/]
03-Oct-2011 15:07:22 hudson.remoting.jnlp.Main$CuiListener status
INFO: Connecting to myserver:2000
03-Oct-2011 15:07:22 hudson.remoting.jnlp.Main$CuiListener status
INFO: Handshaking
03-Oct-2011 15:08:23 hudson.remoting.jnlp.Main$CuiListener error
SEVERE: Connection reset
java.net.SocketException: Connection reset
        at java.net.SocketInputStream.read(Unknown Source)
        at java.io.BufferedInputStream.fill(Unknown Source)
        at java.io.BufferedInputStream.read(Unknown Source)
        at hudson.remoting.Engine.readLine(Engine.java:279)
        at hudson.remoting.Engine.run(Engine.java:211)

Because the telnet works the network people claim innocence

Because the app works on a different port I can’t get much input from the software side of things

I’m at a loss as to what to try next to help debug this scenario 🙁

Any suggestions greatly appreciated.

UPDATE: It appears a connection between slave and master is being established as on the master log I get the following output:

INFO: Accepted connection #13 from /MY.SLAVE.IP.ADDRESS:58545
Oct 3, 2011 5:38:09 PM hudson.TcpSlaveAgentListener$ConnectionHandler run
WARNING: Connection #13 failed
java.net.SocketException: Connection reset
    at java.net.SocketInputStream.read(Unknown Source)
    at java.net.SocketInputStream.read(Unknown Source)
    at java.io.DataInputStream.readUnsignedShort(Unknown Source)
    at java.io.DataInputStream.readUTF(Unknown Source)
    at java.io.DataInputStream.readUTF(Unknown Source)
    at hudson.TcpSlaveAgentListener$ConnectionHandler.run(TcpSlaveAgentListener.java:178)

However, I’ve no idea why the connection is reset and have no idea where to look 🙁

Find below all possible solutions or suggestions for the above questions..

Suggestion: 1

I’ve bumped into that exact error myself, when tried to connect a w2k8 jenkins slave myself.

I’ve compiled this list of things which eventually caused Jenkins slave to connect successfully to a master:

1. Make sure that Java 1.8 is installed on the server.
2. Download Jenkins from:
https://jenkins.io/content/thank-you-downloading-windows-installer/#stable
and install it.
3. Make sure that the user windows user is a member of the local administrative account on the server.
4. Once Jenkins is installed, open services, find Jenkins service, right click and properties, click the “Log on” tab and make sure that “This account” is set with the windows user you chose, save and restart the service.
5. Open “Local security Policy” on the server, on the left panel, under “Security settins” -> “Local Policies” -> “User rights assignments” -> find policy: “Log on as a batch job”, open it and make sure that the local administrative group is added there.
6. Repeat the same steps for the policy “Log on as a service”.
7. Open “regedit”, find the following keys and repeat the steps on both of them:
HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Wow6432Node\CLSID\{72C24DD5-D70A-438B-8A42-98424B88AFB8}
HKEY_CLASSES_ROOT\CLSID\{76A64158-CB41-11D1-8B02-00600806D9B6}
a. Right click the key and choose permissions.
b. Click “Advanced”.
c. In the line of “Owner”, click “change”.
d. Click “Locations” and choose the first line (this computer).
Then, in the lower box write “Administrators” and click “Check Names”, then click ok and apply.
e. Double click the Administrators line and choose under Basic permissions “Full Control” and click ok and apply.
f. In the line of “Owner”, click “change”.
g. Click “Locations” and choose the first line (this computer).
Then, in the lower box write “NT Service\trusted” and click “Check Names”, then click ok and apply.
8. Restart the server.
9. When the server is back up, open the browser and browse to:
http://JENKINS_IP:8080 and log in.
10. Then on the left panel click Jenkins -> Manage server -> Manage nodes.
11. On the left panel, click “New Node”, name it and choose “Permanent agent”.
Then in the node settings:
12. Set # of executors.
13. Set Remote root directory c:\jenkins.
14. Set: 
a. a label as the name of server.
b. Launch method: choose “Let Jenkins controlthis Windows slave as a windows service”.
c. Use javab as the “Administrator” (set user and password).
d. Run service as: choose “Use administrator account given above”.
e. Click save.
15. Once the node appears in the list of nodes, click it and choose connect node and allow 3 minutes to make the connection, even if you get an error, ignore it and it will eventually connect to the node.
At this point the new node is ready to accept jobs.

I hope this helps.