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.
That is my best shot at explaining:
CF https://github.com/linagora/james-project/issues/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.