0

I try to download the large file from azure blob storage by these line of code:

            BlobClient blobAsyncClient = new BlobServiceClientBuilder().connectionString(connectionString1)
                    .buildClient()
                    .getBlobContainerClient(blob)
                    .getBlobClient(client);
blobAsyncClient.downloadToFile(path);

And i got this exception:

reactor.core.Exceptions$ReactiveException: reactor.netty.http.client.HttpClientOperations$PrematureCloseException: Connection prematurely closed DURING response
    at reactor.core.Exceptions.propagate(Exceptions.java:326)
    at reactor.core.publisher.BlockingSingleSubscriber.blockingGet(BlockingSingleSubscriber.java:91)
    at reactor.core.publisher.Mono.block(Mono.java:1500)
    at com.azure.storage.common.implementation.StorageImplUtils.blockWithOptionalTimeout(StorageImplUtils.java:99)
    at com.azure.storage.blob.specialized.BlobClientBase.downloadToFileWithResponse(BlobClientBase.java:557)
    at com.gooddata.cloudresource.service.connection.BlobStorageDataSourceService.validateConnection(BlobStorageDataSourceService.java:89)
    at com.gooddata.cloudresource.model.worker.CloudConnectionValidationWorker.lambda$doProcessTask$1(CloudConnectionValidationWorker.java:55)
    at java.util.Optional.ifPresent(Optional.java:159)
    at com.gooddata.cloudresource.model.worker.CloudConnectionValidationWorker.doProcessTask(CloudConnectionValidationWorker.java:55)
    at com.gooddata.cloudresource.model.worker.CloudConnectionValidationWorker.doProcessTask(CloudConnectionValidationWorker.java:33)
    at com.gooddata.gcf.worker.AbstractWorker.processTask(AbstractWorker.java:27)
    at com.gooddata.gcf.http.TaskHolder.call(TaskHolder.java:52)
    at com.gooddata.gcf.http.TaskHolder.call(TaskHolder.java:26)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
    Suppressed: java.lang.Exception: #block terminated with an error

After changing downloadToFileWithResponse with ParallelTransferOptions has block size is 0.5MB for each chunk some times its works.

Can someone help tell me why it happened?

Do we have any stable solution for this?

1 Answers1

0

Please check with this link

If you are downloading large file from Azure blob you could try to use Shared Access Signature (SAS), or serve the file in chunk

To serve the file in chunk please check with this thread

ShrutiJoshi-MT
  • 1,622
  • 1
  • 4
  • 9