Uploaded image for project: 'James Imap'
  1. James Imap
  2. IMAP-372

Deadlock in AbstractDelegatingMailboxListener under load

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 0.3
    • Mailbox
    • None

    Description

      In AbstractDelegatingMailboxListener::event, firing the events inside the synchronized blocks causes a deadlock involving:

      lock on HashMapDelegatingMailboxListener::listeners
      (synchronized methods) lock on SelectedMailboxImpl

      In my example, these 3 methods got interlocked:
      AbstractDelegatingMailboxListener.addListener
      SelectedMailboxImpl.msn
      AbstractDelegatingMailboxListener.removeListener

      My idea to fix it is basically to take the for loop on mListeners outside the synchronized block in org.apache.james.mailbox.store.AbstractDelegatingMailboxListener.event(Event). That will not make the propagated event processing in SelectedMailboxImpl hit the synchronized lock on listeners.

      Attachments

        1. James Listener Deadlock.txt
          29 kB
          Andrzej Rusin
        2. james-listener-deadlock-2.txt
          1.53 MB
          Eric Charles

        Issue Links

          Activity

            People

              eric@apache.org Eric Charles
              arusin Andrzej Rusin
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: