Skip to content

azure-storage-blob[aio] users can hit aiohttp 3.12.4 SSL shutdown timeout during async client close #47568

@sekihan02

Description

@sekihan02
  • Package Name: azure-storage-blob[aio]
  • Package Version: azure-storage-blob 12.30.0, azure-core 1.41.0, azure-identity 1.25.3, aiohttp 3.12.4
  • Operating System: Linux / WSL2
  • Python Version: 3.12.13

Describe the bug

Hi, thank you for maintaining the Azure SDK for Python.

I could not comment on the existing closed issue, so I am opening this as an additional Azure Blob-specific data point and a request for user-facing guidance.

This appears to be the same underlying issue as aio-libs/aiohttp#11091 and #41363. I understand that the underlying shutdown behavior is likely in aiohttp and has been addressed in newer aiohttp versions. However, users of azure-storage-blob[aio] can still hit this issue if their environment resolves or pins aiohttp==3.12.4.

In my test, the Azure Blob download itself succeeds, but closing the async client/connector blocks for about 30 seconds and logs:

Error while closing connector: ClientConnectionError('Connection lost: SSL shutdown timed out')

Observed result with a 32 MiB blob:

bytes_read: 33554432
download_seconds: about 1.0s
close_seconds: about 30.0s
exception: null
pending_task_count_after: 0

So this is not a failed blob download. The result is returned successfully, but cleanup can unexpectedly add about 30 seconds.

To Reproduce

Steps to reproduce the behavior:

  1. Create or use an Azure Blob of around 32 MiB.
  2. Install the async Azure Blob SDK with aiohttp==3.12.4.
python -m pip install "azure-storage-blob[aio]==12.30.0" azure-identity "aiohttp==3.12.4"
  1. Download the blob using the async client and readall() with chunked/ranged download settings, for example:
from azure.storage.blob.aio import BlobClient

async with BlobClient.from_connection_string(
    conn_str,
    container_name=container_name,
    blob_name=blob_name,
    max_single_get_size=4 * 1024 * 1024,
    max_chunk_get_size=4 * 1024 * 1024,
) as blob:
    downloader = await blob.download_blob(max_concurrency=4)
    data = await downloader.readall()
  1. Observe that readall() succeeds, but closing the async client/connector takes about 30 seconds and logs the SSL shutdown timeout.

I also tested the same setup with aiohttp==3.12.3, and it did not show the 30-second close delay.

Expected behavior

The blob download should complete and the async client/connector should close promptly without adding an unexpected 30-second delay.

If this is considered an aiohttp-specific regression rather than an Azure SDK bug, would it be possible to document the workaround for Azure SDK users, or consider excluding the affected aiohttp version from the async dependency range?

For example, a practical workaround appears to be avoiding aiohttp==3.12.4:

aiohttp!=3.12.4

or upgrading to a newer aiohttp version where the SSL shutdown behavior has changed.

Screenshots

Not applicable.

Additional context

This matters especially for short-lived jobs, serverless workloads, and batch processes. The storage operation itself succeeds, but cleanup can unexpectedly add about 30 seconds per async storage client close.

I would be happy to provide the full reproduction script, version matrix, or additional logs if that would help.

Metadata

Metadata

Assignees

No one assigned

    Labels

    customer-reportedIssues that are reported by GitHub users external to the Azure organization.needs-triageWorkflow: This is a new issue that needs to be triaged to the appropriate team.questionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions