-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AttributeError: 'NoneType' object has no attribute '__aenter__' when using asyncio.gather #505
Comments
The issue might be related to this other discussion: Azure/azure-sdk-for-python#32309. We get the same error but we're not using |
I have the same problem, but with ClientSecretCredential |
Same here with |
Same Issue here |
Same Issue here
|
This does not only happen when |
I got the same error in an
|
This solved for me: changed this The synchronous version of |
I'm using this SDK in Azure Durable Functions. I also get this error and it seems more likely to see it the more requests are being made in a certain time period. |
I confirm I have the same issue in Azure (Durable) Functions. I'm using ClientSecretCredential from azure.identity.aio. |
I have the same issue even in local |
It may block some parts of the execution. But in my experience with asyncio, multiprocessing, and threading, the GIL doesn't make sure the aio improvement doesn't trickle down into faster execution. So it might not be an issue for you here. |
Hello @danielniccoli thanks for using the SDK and for raising. On investigating this, it looks to be an issue with Azure_identity's management of sync and async requests rather that on the Graph SDK. Closing this and moving the workarounds to discussion forums to help anyone who experiences this in the future. |
Hello,
i am using the OnBehalfOf-Flow to fetch informations about applications from graphapi.
When using
asyncio.gather
to "parallelize" multiple requests (e.g. to fetch application infos and application owners) i get this errorAttributeError: 'NoneType' object has no attribute '__aenter__
.This is a minimal example the reproduce the error:
When running those two requests sequentially they work without any problems. So i think there is some sort of race condition going on?
For a large amount of requests, this can have quite a performance impact, because it limits the benefits of actually it runnung concurrently.
Maybe there is an easy fix for it, that i might have overlooked. (E.g. manually trigger token exchange before the
asyncio.gather
call)The text was updated successfully, but these errors were encountered: