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
The following commit(s) were added to refs/heads/master by this push:
new 6b07bc8 JAMES-1436 SwitchableLineBasedFrameDecoder: clean up
cumulation buffer (#673)
6b07bc8 is described below
commit 6b07bc883cc67a7b694e6ddbff61382aeb9f3d33
Author: Benoit TELLIER <[email protected]>
AuthorDate: Fri Oct 1 08:58:21 2021 +0700
JAMES-1436 SwitchableLineBasedFrameDecoder: clean up cumulation buffer
(#673)
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 02ef6e4..b03157d 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
@@ -64,6 +64,7 @@ import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
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;
@@ -185,7 +186,7 @@ class IMAPServerTest {
.hasMessage("Login failed");
}
- @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]