You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by "Andreas Joseph Krogh (JIRA)" <se...@james.apache.org> on 2014/02/03 15:50:10 UTC

[jira] [Commented] (IMAP-372) Deadlock in AbstractDelegatingMailboxListener under load

    [ https://issues.apache.org/jira/browse/IMAP-372?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13889520#comment-13889520 ] 

Andreas Joseph Krogh commented on IMAP-372:
-------------------------------------------

I had this problem using 3.0-beta4 and adopted the code in trunk in a custom DelegatingMailboxListene I use, hoping it will fix things (deploying to production this evening).

This led me to look at the code in AbstractDelegatingMailboxListener.event(), where I found some code I have some comments on.

It looks like the second synchronized-block's use of "closedListener" is useless; It is never updated and therefore always empty, so the call to globalListeners.removeAll(closedListener) will never be made. Is this on purpose or is it an oversight and something else is intended?

Tanks for any clarification.

> Deadlock in AbstractDelegatingMailboxListener under load
> --------------------------------------------------------
>
>                 Key: IMAP-372
>                 URL: https://issues.apache.org/jira/browse/IMAP-372
>             Project: James Imap
>          Issue Type: Bug
>          Components: Mailbox
>            Reporter: Andrzej Rusin
>            Assignee: Eric Charles
>             Fix For: 0.3
>
>         Attachments: James Listener Deadlock.txt, james-listener-deadlock-2.txt
>
>
> 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.



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org