Tellier Benoit created JAMES-2465:
-------------------------------------

             Summary: Concurrency issue in LocalDelivery upon INBOX 
provisionning
                 Key: JAMES-2465
                 URL: https://issues.apache.org/jira/browse/JAMES-2465
             Project: James Server
          Issue Type: Bug
          Components: Mailet Contributions, tests
            Reporter: Tellier Benoit


MailAppender attempt to create the mailbox if it do not exist yet:

{code:java}
    private void createMailboxIfNotExist(MailboxSession session, MailboxPath 
path) throws MailboxException {
        if (!mailboxManager.mailboxExists(path, session)) {
            mailboxManager.createMailbox(path, session);
        }
    }
{code}

The problem is that in a concurrent environment, a mailbox can be created 
between the test and the mailbox creation. In that case mailboc creation fails:

{code:java}
org.apache.james.mailbox.exception.MailboxExistsException: Mailbox with 
name=#private:[email protected]:INBOX already exists.
        at 
org.apache.james.mailbox.store.StoreMailboxManager.createMailbox(StoreMailboxManager.java:497)
        at 
org.apache.james.transport.mailets.delivery.MailboxAppender.createMailboxIfNotExist(MailboxAppender.java:86)
        at 
org.apache.james.transport.mailets.delivery.MailboxAppender.appendMessageToMailbox(MailboxAppender.java:73)
        at 
org.apache.james.transport.mailets.delivery.MailboxAppender.append(MailboxAppender.java:64)
        ... 40 common frames omitted
Wrapped by: javax.mail.MessagingException: Unable to access mailbox.
        at 
org.apache.james.transport.mailets.delivery.MailboxAppender.append(MailboxAppender.java:66)
        at 
org.apache.james.transport.mailets.delivery.MailboxAppender.append(MailboxAppender.java:46)
        at 
org.apache.james.transport.mailets.delivery.SimpleMailStore.storeMail(SimpleMailStore.java:95)
        at 
org.apache.james.transport.mailets.delivery.MailDispatcher.deliver(MailDispatcher.java:125)
        at 
org.apache.james.transport.mailets.delivery.MailDispatcher.customizeHeadersAndDeliver(MailDispatcher.java:113)
        at 
org.apache.james.transport.mailets.delivery.MailDispatcher.dispatch(MailDispatcher.java:90)
        at 
org.apache.james.transport.mailets.LocalDelivery.service(LocalDelivery.java:62)
{code}

We need to ignore such errors...

note that this issue was causing 
*ToRepositoryTest.userShouldBeAbleToAccessReprocessedMails* test to be 
unstable...


{code:java}
ToRepositoryTest.userShouldBeAbleToAccessReprocessedMails:133 ยป ConditionTimeout
{code}




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to