This is an automated email from the ASF dual-hosted git repository. btellier pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/james-project.git
commit 8b9cbf138555b9c3c5027f9a0872323da511486a Author: Benoit TELLIER <btell...@linagora.com> AuthorDate: Wed Feb 21 14:28:29 2024 +0100 JAMES-4007 Prevent channel inactivity to clear literal while IMAP APPEND is in progress --- .../apache/james/imapserver/netty/ImapRequestFrameDecoder.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/server/protocols/protocols-imap4/src/main/java/org/apache/james/imapserver/netty/ImapRequestFrameDecoder.java b/server/protocols/protocols-imap4/src/main/java/org/apache/james/imapserver/netty/ImapRequestFrameDecoder.java index 4adab34f09..3e3e26d043 100644 --- a/server/protocols/protocols-imap4/src/main/java/org/apache/james/imapserver/netty/ImapRequestFrameDecoder.java +++ b/server/protocols/protocols-imap4/src/main/java/org/apache/james/imapserver/netty/ImapRequestFrameDecoder.java @@ -221,7 +221,12 @@ public class ImapRequestFrameDecoder extends ByteToMessageDecoder implements Net try { parseImapMessage(ctx, null, attachment, Pair.of(reader, size), readerIndex) - .ifPresent(ctx::fireChannelRead); + .ifPresent(message -> { + ctx.fireChannelRead(message); + // Remove ongoing subscription: now on lifecycle of the message will be managed by ImapChannelUpstreamHandler. + // Not doing this causes IDLEd IMAP connections to clear IMAP append literal while they are processed. + attachment.remove(SUBSCRIPTION); + }); } catch (DecodingException e) { ctx.fireExceptionCaught(e); } @@ -237,6 +242,7 @@ public class ImapRequestFrameDecoder extends ByteToMessageDecoder implements Net }); attachment.put(SUBSCRIPTION, (Disposable) () -> { + // Clear the file if the connection is reset while buffering the litteral. subscribe.dispose(); fileChunkConsumer.discard(); }); --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For additional commands, e-mail: notifications-h...@james.apache.org