On some cases, it can happen that the connection ends up in a very bad state, and it could throw a StreamCorruptedException and some stack trace like :
WARNING: Failed to construct Command
java.io.StreamCorruptedException: invalid stream header: 436C6173
at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:857)
at java.io.ObjectInputStream.<init>(ObjectInputStream.java:349)
at hudson.remoting.ObjectInputStreamEx.<init>(ObjectInputStreamEx.java:48)
at hudson.remoting.AbstractByteBufferCommandTransport.processCommand(AbstractByteBufferCommandTransport.java:201)
at hudson.remoting.AbstractByteBufferCommandTransport.receive(AbstractByteBufferCommandTransport.java:188)
In such cases, there's few chance that the application will be written/designed to recover. In this case, Remoting should probably just forcibly terminate the connection, so that it gets reestablished cleanly from scratch. |