henry3260 opened a new issue, #76683:
URL: https://github.com/apache/airflow/issues/76683

   ### Body
   
   An `Iterable[...] `response field is validated lazily, so its rows are 
fetched while FastAPI serializes the response — on the event loop, on the sync 
engine. Once the connection pool is busy, that blocks the whole API server.
   
   The seven routes below hand the field the lazy `session.scalars(...)` 
directly. #74247 and #76525 fixed the same shape for pools, dags and deadlines. 
#76537 adds a test that lists these seven in 
`generated/known_lazy_response_fields.txt` as strict `xfails`, so the list 
cannot grow.
   
   Field, then the route that feeds it lazily.
   
   - [ ] AssetAliasCollectionResponse.asset_aliases — 
routes/public/assets.py:377
   - [ ] BackfillCollectionResponse.backfills — routes/public/backfills.py:114 
(the UI route already builds a list)
   - [ ] ConnectionCollectionResponse.connections — 
routes/public/connections.py:253
   - [ ] DAGVersionCollectionResponse.dag_versions — 
routes/public/dag_versions.py:223
   - [ ] DAGWarningCollectionResponse.dag_warnings — 
routes/public/dag_warning.py:76
   - [ ] DeadlineAlertCollectionResponse.deadline_alerts — 
routes/ui/deadlines.py:237
   - [ ] VariableCollectionResponse.variables — routes/public/variables.py:127
   
   ### How to fix
   
   1. Annotate the field list[X] instead of Iterable[X], and materialize at the 
route with .all() or list(...). The OpenAPI schema is unchanged, so no client 
is affected.
   2. Eager-load anything the items resolve on access, or serialization still 
runs a query per item.
   3. Delete the field's line from generated/known_lazy_response_fields.txt. 
Each line is a strict xfail, so the run fails until it is removed.
   
   One field per PR is fine.
   ### Not in scope
   
   Thirteen other Iterable[...] fields are exempt: their routes resolve the 
items first, and Iterable there is the deliberate choice from #57878.
   
   ### Committer
   
   - [x] I acknowledge that I am a maintainer/committer of the Apache Airflow 
project.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to