This is an automated email from the ASF dual-hosted git repository.

btellier pushed a commit to branch 3.6.x
in repository https://gitbox.apache.org/repos/asf/james-project.git


The following commit(s) were added to refs/heads/3.6.x by this push:
     new 3926a3d  JAMES-1436 SwitchableLineBasedFrameDecoder: clean up 
cumulation buffer (#674)
3926a3d is described below

commit 3926a3d4b9077789c3e0feebde34e0386f073ab7
Author: Benoit TELLIER <[email protected]>
AuthorDate: Fri Oct 1 08:58:28 2021 +0700

    JAMES-1436 SwitchableLineBasedFrameDecoder: clean up cumulation buffer 
(#674)
    
    Thanks https://github.com/jtconsolq for the report.
    
    If data remains in the cumulation buffer after say a APPEND, we flush it, 
as it avoids
    APPEND to wait indefinitly for data. However this did let the cumulation 
buffer in a
    non usable state causing following commands to fail.
    
    We should this set the cumulation buffer to null to no longer use it (and 
allocate a new one)
    in order to prevent failures in follow up message processing.
---
 .../apache/james/imapserver/netty/SwitchableLineBasedFrameDecoder.java | 1 +
 .../test/java/org/apache/james/imapserver/netty/IMAPServerTest.java    | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git 
a/server/protocols/protocols-imap4/src/main/java/org/apache/james/imapserver/netty/SwitchableLineBasedFrameDecoder.java
 
b/server/protocols/protocols-imap4/src/main/java/org/apache/james/imapserver/netty/SwitchableLineBasedFrameDecoder.java
index 64ce9c4..fb5d58e 100644
--- 
a/server/protocols/protocols-imap4/src/main/java/org/apache/james/imapserver/netty/SwitchableLineBasedFrameDecoder.java
+++ 
b/server/protocols/protocols-imap4/src/main/java/org/apache/james/imapserver/netty/SwitchableLineBasedFrameDecoder.java
@@ -58,6 +58,7 @@ public class SwitchableLineBasedFrameDecoder extends 
AllButStartTlsLineBasedChan
         this.framingEnabled = false;
         if (this.cumulation != null && this.cumulation.readable()) {
             final ChannelBuffer spareBytes = 
this.cumulation.readBytes(this.cumulation.readableBytes());
+            this.cumulation = null;
             Channels.fireMessageReceived(ctx, spareBytes);
         }
     }
diff --git 
a/server/protocols/protocols-imap4/src/test/java/org/apache/james/imapserver/netty/IMAPServerTest.java
 
b/server/protocols/protocols-imap4/src/test/java/org/apache/james/imapserver/netty/IMAPServerTest.java
index 8e30c08..e434751 100644
--- 
a/server/protocols/protocols-imap4/src/test/java/org/apache/james/imapserver/netty/IMAPServerTest.java
+++ 
b/server/protocols/protocols-imap4/src/test/java/org/apache/james/imapserver/netty/IMAPServerTest.java
@@ -44,6 +44,7 @@ import org.apache.james.utils.TestIMAPClient;
 import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Nested;
+import org.junit.jupiter.api.RepeatedTest;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.extension.RegisterExtension;
 
@@ -146,7 +147,7 @@ class IMAPServerTest {
                 .contains("\r\n" + _65K_MESSAGE + ")\r\n");
         }
 
-        @Test
+        @RepeatedTest(200)
         void largeAppendsShouldWork() throws Exception {
             assertThatCode(() ->
                 testIMAPClient.connect("127.0.0.1", port)

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

Reply via email to