-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Open
Labels
ClientThis issue points to a problem in the data-plane of the library.This issue points to a problem in the data-plane of the library.Document Intelligencecustomer-reportedIssues that are reported by GitHub users external to the Azure organization.Issues that are reported by GitHub users external to the Azure organization.needs-team-attentionWorkflow: This issue needs attention from Azure service team or SDK teamWorkflow: This issue needs attention from Azure service team or SDK teamquestionThe issue doesn't require a change to the product in order to be resolved. Most issues start as thatThe issue doesn't require a change to the product in order to be resolved. Most issues start as that
Description
- Package Name: azure-ai-documentintelligence
- Package Version: 1.0.0 - 1.0.2
- Operating System: Windows 11, Linux (Azure Functions Python 4.x Docker base image)
- Python Version: Python 3.11
Describe the bug
The begin_analyze_document
method of DocumentIntelligenceClient
(from the async azure.ai.documentintelligence.aio
package) and its returned poller’s result()
method perform blocking I/O internally. Despite being part of the async SDK, these calls block the asyncio event loop, causing delays and concurrency issues in frameworks like FastAPI.
To Reproduce
Steps to reproduce the behavior:
- Use DocumentIntelligenceClient from azure.ai.documentintelligence.aio in an async FastAPI endpoint.
- Call await client.begin_analyze_document(...).
- Await poller.result().
- Observe that the FastAPI event loop is blocked during the call, causing other requests to stall.
Expected behavior
Both begin_analyze_document
and poller.result()
should perform non-blocking async I/O, allowing other asyncio tasks to run concurrently without delay.
Screenshots
N/A
Additional context
As a temporary workaround, offloading the blocking calls to a thread using asyncio.to_thread() avoids event loop blocking.
Metadata
Metadata
Assignees
Labels
ClientThis issue points to a problem in the data-plane of the library.This issue points to a problem in the data-plane of the library.Document Intelligencecustomer-reportedIssues that are reported by GitHub users external to the Azure organization.Issues that are reported by GitHub users external to the Azure organization.needs-team-attentionWorkflow: This issue needs attention from Azure service team or SDK teamWorkflow: This issue needs attention from Azure service team or SDK teamquestionThe issue doesn't require a change to the product in order to be resolved. Most issues start as thatThe issue doesn't require a change to the product in order to be resolved. Most issues start as that