Uploaded image for project: 'ActiveMQ Classic'
  1. ActiveMQ Classic
  2. AMQ-5269

NIO transports using blocking accept calls, very slow shutdown

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 5.10.0
    • 5.11.0
    • Transport
    • None

    Description

      Currently, all the TCP based transports are using the old blocking style of socket.accept() to accept connections. This works "OK" except that for sockets that have a channel associated with them, the socket.close() doesn't cause it to return immediately. It still waits for the SoTimeout which is currently set a 2 seconds. That can cause 2 second delays for any shutdown which causes long, unnecessary delays, particularly in the tests.

      One possible "fix" is to drop the socket.setSoTimeout(2000) call to something much smaller. However, that would turn the accept thread into a more "busy wait" scenario which is undesirable.

      A better fix is to change the accepts for the sockets that have a ServerSocketChannel to use the NIO based selectors for the accept operations. The selector.disable()/selector.close() allows the socket and everything to close immediately. The result is that the NIO based tests now take the same amount of time as the non-NIO based tests (for which socket.close() causes the accept to return immediately).

      Pull request forthcoming.

      Attachments

        1. AMQ-5269.patch
          9 kB
          Daniel Kulp

        Activity

          People

            dkulp Daniel Kulp
            dkulp Daniel Kulp
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: