SocketNode constructor blocks due to ObjectInputStream creation
---------------------------------------------------------------

                 Key: LBCLASSIC-123
                 URL: http://jira.qos.ch/browse/LBCLASSIC-123
             Project: logback-classic
          Issue Type: Bug
          Components: Other
    Affects Versions: 0.9.16
         Environment: Using Logback 0.9.9, but problem is still present in trunk
            Reporter: Richard Fearn
            Assignee: Logback dev list
            Priority: Minor


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.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.qos.ch/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        
_______________________________________________
logback-dev mailing list
[email protected]
http://qos.ch/mailman/listinfo/logback-dev

Reply via email to