Uploaded image for project: 'James Server'
  1. James Server
  2. JAMES-2465

Concurrency issue in LocalDelivery upon INBOX provisionning

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 3.2.0
    • Mailet Contributions, tests
    • None

    Description

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

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

      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:

      org.apache.james.mailbox.exception.MailboxExistsException: Mailbox with name=#private:touser@james.org: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)
      

      We need to ignore such errors...

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

      ToRepositoryTest.userShouldBeAbleToAccessReprocessedMails:133 ยป ConditionTimeout
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            btellier Benoit Tellier
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: