linagora / james-project

Mirror of Apache James Project
Apache License 2.0
72 stars 62 forks source link

Error when S3 upload: SdkClientException: Unable to execute HTTP request: Duplicate handler name #4819

Closed vttranlina closed 1 year ago

vttranlina commented 1 year ago

reproduce

Run test readBytesShouldReturnBigSavedByteSource(StoragePolicy)[1] – org.apache.james.blob.objectstorage.aws.S3NamespaceTest (repeat until failure )

Error:

org.apache.james.blob.api.ObjectStoreIOException: Error saving blob
    at org.apache.james.blob.objectstorage.aws.S3BlobStoreDAO.lambda$save$24(S3BlobStoreDAO.java:312)
    at reactor.core.publisher.Mono.lambda$onErrorMap$27(Mono.java:3769)
    at reactor.core.publisher.Mono.lambda$onErrorResume$29(Mono.java:3859)
...

Caused by: software.amazon.awssdk.core.exception.SdkClientException: Unable to execute HTTP request: Duplicate handler name: HttpStreamsClientHandler#0-body-subscriber
vttranlina commented 1 year ago

Some guys got the same issue, but it looks not resolved https://github.com/aws/aws-sdk-java-v2/issues/1903

vttranlina commented 1 year ago

I tried to extract the method for random get TWELVE_MEGABYTES (avoid throw error because invoke save several object with same data), but it was not fixed

    @ParameterizedTest
    @MethodSource("storagePolicies")
    default void readBytesShouldReturnBigSavedByteSource(BlobStore.StoragePolicy storagePolicy) {
        BlobStore store = testee();
        BucketName defaultBucketName = store.getDefaultBucketName();

        byte[] data = RandomStringUtils.random(12 * 1024 * 1024).getBytes(StandardCharsets.UTF_8);

        BlobId blobId = Mono.from(store.save(defaultBucketName, ByteSource.wrap(data), storagePolicy)).block();

        byte[] bytes = Mono.from(store.readBytes(defaultBucketName, blobId)).block();

        assertThat(bytes).isEqualTo(data);
    }

     private byte[] getTwelveMegabytes() {
        return RandomStringUtils.random(12 * 1024 * 1024, true, true).getBytes(StandardCharsets.UTF_8);
    }
vttranlina commented 1 year ago

I'm not sure the changing image zenko/cloudserver:8.2.6 -> registry.scality.com/cloudserver/cloudserver:8.7.25 will fix that issue at all.

But with a new image (registry.scality.com/cloudserver/cloudserver:8.7.25), I didn't see it fail (at least on my pc when running IDE with mode: repeat until failure)


zenko/cloudserver:8.2.6

image

registry.scality.com/cloudserver/cloudserver:8.7.25

Tests passed:748 image

Arsnael commented 1 year ago

@vttranlina can we consider it done then? I don't recall seeing this error lately on failing builds

vttranlina commented 1 year ago

yes, I don't see it too