Uploaded image for project: 'Qpid'
  1. Qpid
  2. QPID-8532

[Broker-J] Inaccurate calculation of selection timeout

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Broker-J

      Description

      The SelectorThread.SelectTask inner class is responsible for selecting the incoming data from the connection socket.

      The selection timeout in SelectorThread.SelectionTask defines how long will be the IO-thread blocked in select method waiting for new connection data.
      The timeout is calculated based on the nearest connection event of all registered connection.
      SelectionTask is working in the loop:

      1. IO-thread waits for new connection data, the timeout is utilized.
      2. The new connection jobs are registered pushed into the scheduler queue.
      3. The nearest connection event is picked up from all registered connections.
      4. The next timeout is calculated based on current time.
      5. IO-thread processes all new connection jobs.

      Hence, the calculated timeout is inaccurate and absolute when the 'select' method is called.
      The '_nextTimeout' is neither volatile nor atomic variable despite the fact that it could be used by multiple IO-threads.

      If the SelectionTask kept the time of the nearest connection event instead of the next timeout then the timeout would be calculated just before calling the select method based on the current time.
      If the timeout is bigger than zero then the select method (blocking selection operation) will be called. If the time of the nearest connection event has passed then the selectNow (non-blocking selection operation) method will be called.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              lacam Marek Laca
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: