Uploaded image for project: 'logback'
  1. logback
  2. LOGBACK-350

SocketNode constructor blocks due to ObjectInputStream creation

    XMLWordPrintable

Details

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • 1.1.0
    • 0.9.16
    • logback-classic
    • 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.

      Attachments

        Activity

          People

            tony19 Tony Trinh
            richardfearn Richard Fearn
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: