-
Bug
-
Resolution: Unresolved
-
Major
-
core:2.375.1
-
-
2.388
When the TCP Agent listener crashes, it prints:
2022-12-22 01:29:20.541+0000 [id=632] WARNING hudson.TcpSlaveAgentListener$1#run: Connection handler failed, restarting listener
However, it never seems to be restarted.
How to Reproduce
(thanks duemir for providing those steps)
It can be reproduced with a debugger (at least an IntelliJ one)
- Start a 2.375.1 Jenkins instance with debugger enabled
- Prepare the IDE
- Checkout tag jenkins-2.375.1 from the jenkinsci/jenkins repo
- Open hudson.TcpSlaveAgentListener
- Set breakpoint somewhere in the run method of the ConnectionHandler (line 279)
- Enable the TCP port
- Set up an inbound agent and test that it connects
- Connect the debugger to the controller
- Use Throw an exception to throw some exception that is not handled in the run, e.g. new IllegalStateException("BOOM")
As a result, something similar to the lines below should be printed in the controller logs
2022-12-22 01:29:20.540+0000 [id=632] SEVERE h.TcpSlaveAgentListener$ConnectionHandler#lambda$new$0: Uncaught exception in TcpSlaveAgentListener ConnectionHandler Thread[TCP agent connection handler #6 with /127.0.0.1:61392,5,main] java.lang.IllegalStateException: BOOM at hudson.TcpSlaveAgentListener$ConnectionHandler.run(TcpSlaveAgentListener.java:280) 2022-12-22 01:29:20.541+0000 [id=632] WARNING hudson.TcpSlaveAgentListener$1#run: Connection handler failed, restarting listener java.lang.IllegalStateException: BOOM at hudson.TcpSlaveAgentListener$ConnectionHandler.run(TcpSlaveAgentListener.java:280)
May need to fiddle a bit with a breakpoint (it didn't work the first time for me for some reason. I ended up with a breakpoint that only suspended a Thread, and I had to do the "Throw exception" action twice)
Expected: As the log says, the TCP Agent listener is restarted after the crash
Actual: It is not. The Port is not up, and agents cannot connect.
The workaround is to disable the port and then enable it again.
- is related to
-
JENKINS-59910 Java 11 agent disconnection: UnsupportedOperationException from ProtocolStack$Ptr.isSendOpen
- Open
- links to
Right. I am not referring to the exception used to reproduce the problem. This reproduction script was used initially to reproduce the problem because anything that wasn't an IOException or InterruptedException was uncaught... Now we catch Throwable so we should not except to reach uncaught exception..
If the thread died, there should be logs and/or a stacktrace mentioning TcpSlaveAgentListener in the log.