Repository navigation
Conversation
PCTEJA
requested review from
amoghrajesh,
ashb,
bugraoz93,
choo121600,
ephraimbuddy,
henry3260,
jason810496,
pierrejeambrun and
shubhamraj-git
as code owners
November 24, 2026 09:14
fat-catTW
suggested changes
Nov 25, 2026
fat-catTW
left a comment
Contributor
There was a problem hiding this comment.
Thanks for the PR.
text/plain with body hello returns 500 after this change (previously 422). Could we reject raw bytes before they reach the database and add a test
Large XCom values stall the Execution API event loop because pydantic re-validates and re-serializes every element of a JsonValue on each pass through the request and response models. Values arriving from the API are already decoded JSON, and values read back come from a JSON store, so the checks cannot fail. Annotate the XCom request body and response models with DecodedJsonValue, which passes the value through unchanged while publishing the same JSON schema as JsonValue.
…th 422 A body that is not JSON reaches the endpoint as raw bytes, and those bytes reached the database, where serializing them failed with a 500. Rejecting them at validation restores the 422 the endpoint returned before this change.
PCTEJA
force-pushed
the
fix/airflow-77502-large-json-event-loop-stall
branch
from
November 29, 2026 01:52
de22a21 to
fba70ba
Compare
Contributor
Author
|
@fat-catTW, text/plain 500 fixed — raw bytes rejected before the database, returning 422, with a test. Please re-review and approve the workflow run? |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Large XCom values stall the Execution API event loop because pydantic re-validates and re-serializes every element of a
JsonValueon each pass through the request and response models. A value arriving from the API is already decoded JSON, and a value read back comes from a JSON store, so those checks cannot fail. This PR annotates the XCom request body and response models withDecodedJsonValue, aJsonValuethat passes the value through unchanged while publishing the same JSON schema.closes #77502
What changes
airflow-core/src/airflow/api_fastapi/common/types.py: addsDecodedJsonValue, defined exactly as in Speed up Execution API state store requests with large values #77113 so the two PRs converge on one definition.airflow-core/src/airflow/api_fastapi/execution_api/datamodels/xcom.py:XComResponse.value,XComSequenceIndexResponse.rootandXComSequenceSliceResponse.rootuseDecodedJsonValue.airflow-core/src/airflow/api_fastapi/execution_api/routes/xcoms.py: theset_xcomrequest body usesDecodedJsonValue.Scope relative to #77113
#77113 covers the state-store models (
task_state_store,asset_state_store) and explicitly leaves the XCom models out ("Not in this PR: The XCom models ... I will open follow-ups"). This PR covers exactly that leftover scope: the XCom models and theset_xcomrequest body. It does not touch the state-store models, the asset models, or the public API XCom models.Benchmarks
Measured with the real Execution API app and SQLite, a 688,890-byte value (100,000-element integer array), 10 requests per run, median of 3 alternating runs each. The small-value control is unchanged, so the machine was quiet.
Model level, same 689 KB value:
XComResponsevalidation 19.61 ms to 0.03 ms, JSON serialization 22.13 ms to 3.29 ms. The Cadwyn migration overhead (about 50 ms over plain FastAPI at any version) is unchanged by this PR; the remaining cost is JSON parsing, the database write, and response encoding.Tests
airflow-core/tests/unit/api_fastapi/execution_api/datamodels/test_xcom.py(9 tests): validation returns the decoded value unchanged, serialization skips theJsonValuechecks, and the published schema matches plainJsonValue. 6 of the 9 fail on the base commit for the expected reason; all 9 pass with the fix.test_types.py, headtest_xcoms.py,v2025_04_28/test_xcom.py): 210 passed, run twice with identical results.VersionChangeand no Task SDK model regeneration are needed. Thegenerate-tasksdk-datamodelsprek hook passes with no diff.mypy-airflow-corepasses.Notes
Anyfield.test_xcoms.py(test_xcom_access_denied, get and set) error at setup in this VM becauseairflow_sharedis not importable here;test_app.pyfails to collect for the same reason, identically on the base commit. The served-spec comparison above covers whattest_app.pychecks for this change.Was generative AI tooling used to co-author this PR?
Generated-by: GPT Astra following the guidelines.
I used GPT Astra only for inline code completion.