[FIX] IMAP execution management #2090
Merged
Arsnael merged 6 commits intoapache:masterfrom Mar 6, 2024
Merged
Conversation
- Abort ongoing processing first - Logout asynchronously
Arsnael
approved these changes
Mar 6, 2024
quantranhong1999
approved these changes
Mar 6, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
That is my best shot at explaining:
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.