why are my azure blob container uploads suddenly timing out?

David Flannery 10 Reputation points
2026-11-26T20:28:37.1766667+00:00

I'm using a python script that has worked perfectly for months and even many times earlier today. It imports MatchConditions from the azure.core package and imports BlobServiceClient from the azure.storage.blob.

The code to upload a blob (text file) is:

    blob_name = os.path.basename(flac_path)
    blob_service_client = BlobServiceClient.from_connection_string(connection_string)
    container_client = blob_service_client.get_container_client(container_name)
    blob_client =  container_client.get_blob_client(blob_name.replace(' ','_'))
    #upload_file_path = f'D:\\MTOI\\ProcessedAudio\\{bname}'
    with open(flac_path,"rb") as data:
        blob_client.upload_blob(data)

The only information provided in the exception is that it timed out.

Azure Blob Storage
Azure Blob Storage

An Azure service that stores unstructured data in the cloud as blobs.


2 answers

Sort by: Most helpful
  1. David Flannery 10 Reputation points
    2026-11-28T11:41:36.6133333+00:00

    Everything has returned to normal. Both the sluggishness and timeouts of portal.azure.com and my blob upload timeouts have disappeared. None of this was due to any change in my code so either it was a network problem or an Azure server problem.

    Was this answer helpful?

    0 comments No comments

  2. AI answer

    2026-11-26T20:29:42.8233333+00:00

    Enable SDK logging for one failed upload and compare Azure Monitor’s server and end-to-end latency metrics; a timeout alone does not identify whether the delay is in Azure Storage, the network, or the Python client.

    Your upload_blob() pattern is supported and automatically chunks data when necessary, so no structural rewrite is required ^1^. The public Azure status page currently shows no widespread active event, but account- or region-specific incidents may appear only in Azure Service Health ^2^.

    1. Capture the actual failure category

    Temporarily enable SDK logging and print the exception type, HTTP status, storage error code, and request ID:

    import logging
    from azure.core.exceptions import AzureError
    
    logging.basicConfig(level=logging.INFO)
    logging.getLogger("azure.storage.blob").setLevel(logging.DEBUG)
    
    service = BlobServiceClient.from_connection_string(
        connection_string, logging_enable=True)
    
    try:
        blob = service.get_blob_client(
            container_name, os.path.basename(flac_path).replace(" ", "_"))
        with open(flac_path, "rb") as data:
            blob.upload_blob(data, overwrite=True, logging_enable=True)
    except AzureError as exc:
        print("type:", type(exc).__name__)
        print("error_code:", getattr(exc, "error_code", None))
        response = getattr(exc, "response", None)
        print("status:", getattr(response, "status_code", None))
        print("request_id:", response.headers.get("x-ms-request-id") if response else None)
        raise
    

    ServiceRequestError generally means the request could not be sent, such as a connectivity, DNS, or endpoint problem. ServiceResponseError means the response could not be processed. HttpResponseError exposes service HTTP failures and their status codes ^3^.

    Detailed logging can expose headers or credentials. Redact the connection string, authorization data, SAS values, and account keys before sharing logs ^4^.

    2. Distinguish the likely path

    In Azure portal → Storage account → Monitoring → Metrics, inspect the failure period:

    • Add Transactions, split by ResponseType.
    • Add Success E2E Latency and Success Server Latency.
    • Check Availability.

    Interpret the results as follows:

    • ServerBusyError, ClientThrottlingError, account request throttling, or bandwidth throttling: the workload is being throttled. HTTP 503 and 500 operation timeouts can indicate a hot partition or exceeded scalability target ^5^.
    • High server latency: investigate a service-side or regional issue. Check Azure portal → Help + support → Service Health, filtering for Storage and the account’s region.
    • High E2E latency but low server latency: investigate the client and network path—VPN/proxy/firewall inspection, packet loss, exhausted connections, CPU, memory, and available bandwidth.
    • Low Azure latency while the script waits: inspect logs for repeated retries or a delay before the request reaches Blob Storage. Multiple entries with the same client request ID indicate retries ^6^.

    Testing the same small file from another network or Azure VM is a useful discriminator. If that succeeds, focus on the original machine’s network path rather than changing blob code.

    3. Tune retries only for transient failures

    The Storage Python client already uses exponential retries. If logs show retryable 408, 429, 500, 502, 503, or 504 failures, increase all four retry counters together:

    service = BlobServiceClient.from_connection_string(
        connection_string,
        retry_total=5,
        retry_connect=5,
        retry_read=5,
        retry_status=5,
        connection_timeout=30,
        read_timeout=120,
    )
    

    Setting only retry_total might not increase retries because the effective count is the minimum of the total, connect, read, and status counters ^7^. The documented socket defaults are 20 seconds for connection establishment and 60 seconds between consecutive response reads; increasing them is appropriate only when logs identify connect/read timeout behavior ^4^.

    Do not retry 400, 401, 403, or 404 failures as timeout remediation; correct the request, credentials, permissions, or resource name instead ^3^.

    If failures continue, retain the UTC timestamp, storage account region, exception type, HTTP status/error code, and x-ms-request-id for an Azure support case.


    References

    1. Upload a blob with Python - Azure Storage | Microsoft Learn
    2. Azure status
    3. Handle errors produced by the Azure SDK for Python
    4. Azure Storage Blobs client library for Python - version 12.32.0
    5. Hot partitions in Azure Blob Storage: detection, monitoring, and mitigation
    6. Troubleshoot performance in Azure storage accounts
    7. Implement a retry policy with Python
    AI-generated content may be incorrect. Read our transparency notes for more information.

    Was this answer helpful?

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.