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

NPE upon SelectedMailboxImpl event processing

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 3.6.0
    • IMAPServer

    Description

      We noticed the following exception:

       	java.lang.NullPointerException: null
      	at org.apache.james.imap.processor.base.SelectedMailboxImpl.mailboxEvent(SelectedMailboxImpl.java:363)
      	at org.apache.james.imap.processor.base.SelectedMailboxImpl.event(SelectedMailboxImpl.java:308)
      	at org.apache.james.mailbox.events.MailboxListenerExecutor.execute(MailboxListenerExecutor.java:42)
      	at org.apache.james.mailbox.events.EventDispatcher.lambda$executeListener$6(EventDispatcher.java:105)
      	at reactor.core.publisher.MonoFromPublisher.subscribe(MonoFromPublisher.java:55)
      	at reactor.core.publisher.Mono.subscribe(Mono.java:4087)
      	at reactor.core.publisher.MonoSubscribeOn$SubscribeOnSubscriber.run(MonoSubscribeOn.java:124)
      	at reactor.core.scheduler.WorkerTask.call(WorkerTask.java:84)
      	at reactor.core.scheduler.WorkerTask.call(WorkerTask.java:37)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
      	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
      	at java.lang.Thread.run(Thread.java:748)
      

      In order not to miss updates, SelectedMailboxImpl starts processing events before have completed it's initialization. Thus, if a concurrent mailbox operation happens, the `event` method can be executed before the applicableFlags variable is initialized. Leading to the above null pointer exception.

      We should rely on indempoteance of the add only set (applicableFlags) to keep track of applicable flags changes during the initialization. Merging them with the one being stored ensures the data is up to date.

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: