Skip to content

[FIX] IMAP execution management #2090

Merged
Arsnael merged 6 commits intoapache:masterfrom
chibenwa:imap-logout
Mar 6, 2024
Merged

[FIX] IMAP execution management #2090
Arsnael merged 6 commits intoapache:masterfrom
chibenwa:imap-logout

Conversation

@chibenwa
Copy link
Copy Markdown
Contributor

@chibenwa chibenwa commented Mar 5, 2024

That is my best shot at explaining:

java.lang.NullPointerException: Cannot invoke "org.apache.james.imap.api.process.SelectedMailbox.existsCount()" because "selected" is null

CF linagora#4688 which was mostly fixed incorrectly...

The Netty stack enforce linearisability of operation conducted on the event loop for a single channel, including command decoding.

For command execution, we trigger the processing only reactor. We rely on a linarizer to enforce sequential IMAP execution.

So in theory we do never execute two IMAP commands of a given connection at the same time.

However no mechanism prevents decoding at the same time than command execution - and that is fine - however the channel operations (inactive, idle, parsing failures) MAY interfere with command execution by deciding a logout eventually deselecting the current mailbox and resulting in the NPE.

Lessons learned: always cancel current command execution before deciding to log out!

That, and we were executing blocking code onto the netty event loop which IS BAD.

@chibenwa chibenwa added the bug label Mar 5, 2024
@Arsnael Arsnael merged commit bbe97c5 into apache:master Mar 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants