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

Benoit Tellier commented on JAMES-3177:
---------------------------------------

https://github.com/linagora/james-project/pull/3367 proposes a fix for this.

> NPE upon SelectedMailboxImpl event processing
> ---------------------------------------------
>
>                 Key: JAMES-3177
>                 URL: https://issues.apache.org/jira/browse/JAMES-3177
>             Project: James Server
>          Issue Type: Improvement
>          Components: IMAPServer
>            Reporter: Benoit Tellier
>            Priority: Major
>              Labels: bug
>
> We noticed the following exception:
> {code:java}
>       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)
> {code}
> 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.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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

Reply via email to