You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by bt...@apache.org on 2021/12/06 07:22:37 UTC
[james-project] 01/09: JAMES-3676 S3 blob store should not fail upon many partial reads
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 361693864af4fa2bf71a301d928ed45c57721c34
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Thu Nov 25 14:20:27 2021 +0700
JAMES-3676 S3 blob store should not fail upon many partial reads
---
.../blob/objectstorage/aws/S3BlobStoreDAOTest.java | 25 ++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/server/blob/blob-s3/src/test/java/org/apache/james/blob/objectstorage/aws/S3BlobStoreDAOTest.java b/server/blob/blob-s3/src/test/java/org/apache/james/blob/objectstorage/aws/S3BlobStoreDAOTest.java
index 2786acd..5f19f46 100644
--- a/server/blob/blob-s3/src/test/java/org/apache/james/blob/objectstorage/aws/S3BlobStoreDAOTest.java
+++ b/server/blob/blob-s3/src/test/java/org/apache/james/blob/objectstorage/aws/S3BlobStoreDAOTest.java
@@ -21,6 +21,11 @@ package org.apache.james.blob.objectstorage.aws;
import static org.apache.james.blob.api.BlobStoreDAOFixture.ELEVEN_KILOBYTES;
import static org.apache.james.blob.api.BlobStoreDAOFixture.TEST_BUCKET_NAME;
import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatCode;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.stream.IntStream;
import org.apache.james.blob.api.BlobStoreDAO;
import org.apache.james.blob.api.BlobStoreDAOContract;
@@ -34,6 +39,7 @@ import org.junit.jupiter.api.extension.ExtendWith;
import com.google.common.io.ByteSource;
import reactor.core.publisher.Flux;
+import reactor.core.publisher.Mono;
@ExtendWith(DockerAwsS3Extension.class)
public class S3BlobStoreDAOTest implements BlobStoreDAOContract {
@@ -82,4 +88,23 @@ public class S3BlobStoreDAOTest implements BlobStoreDAOContract {
assertThat(Flux.from(testee().listBlobs(TEST_BUCKET_NAME)).count().block())
.isEqualTo(count);
}
+
+ @Test
+ void readShouldNotLeakHttpConnexionsForUnclosedStreams() {
+ BlobStoreDAO store = testee();
+
+ TestBlobId blobId = new TestBlobId("id");
+ Mono.from(store.save(TEST_BUCKET_NAME, blobId, ByteSource.wrap(ELEVEN_KILOBYTES))).block();
+
+ assertThatCode(() -> IntStream.range(0, 256)
+ .forEach(i -> {
+ InputStream inputStream = store.read(TEST_BUCKET_NAME, blobId);
+ // Close the stream without reading it
+ try {
+ inputStream.close();
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ })).doesNotThrowAnyException();
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org