Uploaded image for project: 'Application Server 3  4  5 and 6'
  1. Application Server 3 4 5 and 6
  2. JBAS-4090

Race condition in Connection.close() can deadlock the JBossMQ's ping thread.

    XMLWordPrintable

Details

    Description

      There is a race condition between the JBossMQ ping thread and connection.close()
      that can cause the ping thread to become deadlocked.
      Besides meaning that the ping stops working so broken connections are not detected,
      this can also evenutally lead to a memory leak.

      The problem occurs when the connection.close()
      requests to cancel the ping for that connection, and then aquires the semaphore
      to make sure the ping has stopped working.

      Just at that moment, the ping was scheduled to run and tries to aquire the semaphore
      (with no timeout), but it never can because the connection.close() has permenantly
      aquired it.

      The obvious fix is to include a timeout in the ping task such that when it fails
      to acquire the semaphore it can assume that the connection was closed and return
      immediately.

      Additionally, checking the "closing" flag should also avoid even trying to acquire
      the semaphore when the connection is being closed (in most cases).

      Attachments

        Activity

          People

            adrian.brock Adrian Brock (Inactive)
            adrian.brock Adrian Brock (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: