Skip to content

Using blob.upload_blob from blob.aio causes Unclosed client session #6888

Description

@pkarb

Using blob.upload_blob from blob.aio causes Unclosed client session
Test code taken from the documentation: https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/storage/azure-storage-blob
and samples: https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/storage/azure-storage-blob/tests

Code :
import azure.storage.blob.aio as storage
import asyncio

async def uploadBlob():
with open("./info.txt", "rb") as data:
await blob.upload_blob(data)

blob = storage.BlobClient.from_connection_string("DefaultEndpointsProtocol=https;AccountName=xxx;AccountKey=xxxx;EndpointSuffix=core.windows.net", container="asynctest", blob="my_blob")
#asyncio.run(uploadBlob())
loop = asyncio.get_event_loop()
loop.run_until_complete(uploadBlob())

Causes:
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x000001D33B5C8988>
Unclosed connector
connections: ['[(<aiohttp.client_proto.ResponseHandler object at 0x000001D33B7139A8>, 113308.796)]']
connector: <aiohttp.connector.TCPConnector object at 0x000001D33B5C87C8>

Metadata

Metadata

Assignees

No one assigned

    Labels

    ClientThis issue points to a problem in the data-plane of the library.StorageStorage Service (Queues, Blobs, Files)customer-reportedIssues that are reported by GitHub users external to the Azure organization.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions