Jetty
  1. Jetty
  2. JETTY-1444

Embedded server - Setting a ThreadPool to SelectChannelConnector will cause all requests to freeze

    Details

    • Type: Bug Bug
    • Status: Resolved Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 7.5.2, 8.0.2
    • Fix Version/s: None
    • Component/s: NIO
    • Labels:
    • Environment:
      Windows XP, Linux RedHat. JDK1.6.0_10 and JDK1.6.0_26.
    • Testcase included:
      yes
    • Number of attachments :
      1

      Description

      Upgrading from 7.2 to 7.5/8.0 caused the following code to freeze/hang all requests to the created instance indefinitely.

      Server server = new Server();
      SelectChannelConnector connector = new SelectChannelConnector();
      connector.setPort(9090);
      
      QueuedThreadPool threadPool = new QueuedThreadPool();
      connector.setThreadPool(threadPool);
      
      server.addConnector(connector);
      
      // ... add a servlet handler
      
      server.start();
      

      If you explicitly start the QueuedThreadPool instance before starting the server instance it will work. This seems very odd, since the thread pool is started in AbstractConnector.doStart().

      Attached is a maven project with a test case that reproduces the problem.

      JETTY-1428 seems to be the same issue, but it was dismissed because a custom built threadpool was used.

        Activity

        Hide
        Greg Wilkins added a comment -

        Fixed by ensuring the threadpool is started before starting the selector manager.

        Show
        Greg Wilkins added a comment - Fixed by ensuring the threadpool is started before starting the selector manager.

          People

          • Assignee:
            Greg Wilkins
            Reporter:
            Jeff Erlandsson
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: