question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] BlobClient.downloadToFile hangs under concurrent usage

See original GitHub issue

Describe the bug The BlobClient locks permanently when there is concurrent usage of downloadToFile within the JVM.

I went through the following stages until I arrived at my current working solution, which is to have NO concurrency at all of the Azure SDK.

In all cases below, the BlobContainerClient is created as follows:

` final BlobContainerClient blobContainerClient = new BlobContainerClientBuilder() .endpoint(azureEndpoint) .sasToken(sasToken) .containerName(containerName) .buildClient();

            return blobContainerClient.getBlobClient(blobName);`

Approaches tried:

  1. A long lived BlobContainerClient that produced BlobClient as needed within a Spring application. The BlobContainerClient was used to produce BlobClient as needed for different threads.
  2. A BlobContainerClient created PER download which was used to create a single BlobClient. In this case there is no multi threaded access to the BlobContainerClient.
  3. A BlobContainerClient created PER download that produces a single BlobClient where all requests are serialized so that there is only a single download via the Azure SDK at a time within the entire JVM.

Investigating a thread dump, I could see that the call to BlobClient.downloadToFile was blocked at the following location:

com.azure.storage.common.implementation.StorageImplUtils.blockWithOptionalTimeout(StorageImplUtils.java:99)

The solution 3 is the only working solution I have found. Within my application, the download is not the bottle neck so we are able to live with serializing all downloads.

Exception or Stack Trace Add the exception log and stack trace if available

To Reproduce Steps to reproduce the behavior:

This issue showed up when there was concurrent usage of the Azure SDK. The number of files that could have been downloaded at any given time would have been in the region of 12 to 36. The blob files were sized between 25MB and 60MB.

Code Snippet Add the code snippet that causes the issue.

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

Setup (please complete the following information): Docker image running on a VM in Azure. uname -a Linux <hostname> 5.3.0-1031-azure #32~18.04.1-Ubuntu SMP Mon Jun 22 15:27:23 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

  • Version of the Library used <dependency> <groupId>com.azure</groupId> <artifactId>azure-storage-blob</artifactId> <version>12.7.0</version> </dependency>

Additional context Add any other context about the problem here.

Information Checklist Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report

  • Bug Description Added
  • Repro Steps Added
  • Setup information Added

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:17 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
donfaicommented, Jul 16, 2020

Sounds good. I will try reproduce at the end of my day. If it occurs, I’ll send the logs.

1reaction
rickle-msftcommented, Jul 13, 2020

@donfai Thank you for taking a look. We will look at this shortly

Read more comments on GitHub >

github_iconTop Results From Across the Web

Azure StorageClient Transient Connection testing - hanging
I am testing my WPF application connecting to Azure Blob Storage to download a bunch of images using TPL (tasks). It is expected...
Read more >
Managing concurrency in Blob storage - Azure - Microsoft Learn
Azure Storage uses snapshot isolation to allow read operations concurrently with write operations within a single partition.
Read more >
com.azure.storage.blob.BlobContainerAsyncClient java ...
Learn how to use java api com.azure.storage.blob. ... BlobContainerAsyncClient} this instance will use to read and update * blobs in the storage container....
Read more >
Azure blob file download failed after downloadi...anycodings
I tried to download blob files using anycodings_java BlobClient.downloadToFile(dest), but it anycodings_java failed after downloading a few ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found