[BUG] BlobClient.downloadToFile hangs under concurrent usage
See original GitHub issueDescribe 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:
- 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.
- 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.
- 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:
- Created 3 years ago
- Comments:17 (9 by maintainers)
Sounds good. I will try reproduce at the end of my day. If it occurs, I’ll send the logs.
@donfai Thank you for taking a look. We will look at this shortly