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.

[Storage] No exception about connection error during blob download

See original GitHub issue
  • Package Name:azure-storage-blob:
  • Package Version:12.7.1:
  • Operating System:Ubuntu 18.4 LTS:
  • Python Version:python:3.8.3:

Describe the bug the data downloaded using download_blob method seems small size compare to source blob. This issue happen when the NetworkError occurred . And there are no exception when NetworkError occurred.

To Reproduce Steps to reproduce the behavior: Before that we should enable the storage analytics logs to check the NetworkError.

  1. Create the blob ( at least more than 15MB . this need for step 3).
  2. Start to download using download_blob method.
  3. during the download, we make connectivity error explicitly. I did turn off the Wifi on my laptop
  4. We see the NetworkError on Storage analytics logs like below and the dowloaded file is small size. 2.0;2021-02-25T07:00:08.9500298Z;GetBlob;NetworkError;206;
  5. But there are no exception.

sample code

try:
    connect_str = os.getenv('AZURE_STORAGE_CONNECTION_STRING')
    containername = "test"
    blobfilename = "test"
    downloadfilepath = "./path/to/data/test"
    dt_before = datetime.datetime.now()
    print("Azure Blob Storage v" + __version__ + " - Python quickstart sample")
    blobserviceclient = BlobServiceClient.from_connection_string(connect_str)
    print("before" ,dt_before)
    blobclient = blobserviceclient.get_blob_client(container=containername, blob=blobfilename)
    with open(downloadfilepath, "wb") as downloadfile:downloadfile.write(blobclient.download_blob().readall())
    dt_after = datetime.datetime.now()
    print("after" ,dt_after)
except Exception as ex:
    print('Exception:')
    print(ex)

Expected behavior it should return the exception for NetworkError if the blob download incomplete.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
annatischcommented, Mar 1, 2021

Thanks for the report @kekatahi! Adding @xiafu-msft and @tasherif-msft for a closer look. Looks like it might be something in the retry streaming logic? Maybe related to https://github.com/Azure/azure-sdk-for-python/pull/16783

0reactions
tasherif-msftcommented, Apr 21, 2021

The fix has been merged here https://github.com/Azure/azure-sdk-for-python/commit/7e74cb317f916269c3e65b0f6691524769eacf87 it will be available in the release happening in the next couple of days!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Downloading page blob with azure.storage.blob's ... - GitHub
Downloading page blob with azure.storage.blob's BlobServiceClient fails with ConnectionReset (10054) error. #24958.
Read more >
Azure Blob Storage error codes - Microsoft Learn
Error code HTTP status code User message BlobAlreadyExists Conflict (409) The specified blob already exists. BlobNotFound Not Found (404) The specified blob does not exist. ContainerAlreadyExists...
Read more >
When downloading from azure blob, I get "Unable to read data ...
exception - When downloading from azure blob, I get "Unable to read data from the transport connection: The connection was closed." - Stack ......
Read more >
Fix file download errors - Google Chrome Help
If you try to download a file and it doesn't work, try to fix the error with these troubleshooting steps: Make sure that...
Read more >
Troubleshooting | Cloud Storage
Attempting to use an authenticated browser download for non-public objects results in a 403 response. This restriction exists to prevent phishing for Google...
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