Details
-
Bug
-
Resolution: Fixed
-
Minor
-
0.9.16
-
None
-
Using Logback 0.9.9, but problem is still present in trunk
Description
SocketNode implements Runnable, the implication being that a SocketNode can be run in its own thread like this:
while (true) {
// accept a client connection
new Thread(new SocketNode(...)).start();
}
However the SocketNode creates an ObjectInputStream using the socket's input stream, which blocks waiting for the stream header - so the constructor does not return, the thread cannot start and the loop shown above cannot continue until data has been received from the client.
Typically a client would connect and immediately send data, so this wouldn't be an issue, but if someone just telnets to the log server and doesn't send any data, the above loop will block and prevent other clients' log messages from being processed.
It would be better if the ObjectInputStream was created in the run() method to avoid the constructor blocking.