pierrejeambrun commented on code in PR #61281:
URL: https://github.com/apache/airflow/pull/61281#discussion_r2783495984
##########
airflow-core/src/airflow/api_fastapi/main.py:
##########
@@ -23,6 +23,24 @@
# This ensures plugins loaded at import time get the correct secrets backend
chain
os.environ["_AIRFLOW_PROCESS_CONTEXT"] = "server"
+# Defensive: Disable uvloop if PYTHONASYNCIODEBUG=1 is set (see Airflow issue
#61214)
+if os.environ.get("PYTHONASYNCIODEBUG") == "1":
+ import warnings
+
+ warnings.warn(
+ "PYTHONASYNCIODEBUG=1 detected: uvloop is not compatible with asyncio
debug mode on Python 3.13+. "
+ "Falling back to default asyncio event loop.",
+ RuntimeWarning,
+ stacklevel=2,
+ )
+else:
+ try:
+ import uvloop
+
+ uvloop.install()
+ except ImportError:
+ pass
+
Review Comment:
What is that else case for?
##########
airflow-core/newsfragments/61214.significant.rst:
##########
@@ -0,0 +1,26 @@
+fix(api): disable uvloop if PYTHONASYNCIODEBUG=1 to prevent segfault (issue
#61214)
+
+<!--
+Thank you for contributing!
+
+This PR disables uvloop and falls back to the default asyncio event loop if
PYTHONASYNCIODEBUG=1 is set, preventing a segmentation fault in the Airflow API
server on Python 3.13+ (see issue #61214). A warning is emitted at startup if
this configuration is detected.
+
+* related: #61214
+-->
+
+---
+
+##### Was generative AI tooling used to co-author this PR?
+
+- [X] Yes (GitHub Copilot)
+
+<!--
+Generated-by: GitHub Copilot following [the
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
+-->
+
+---
+
+* Read the **[Pull Request
Guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#pull-request-guidelines)**
for more information. Note: commit author/co-author name and email in commits
become permanently public when merged.
+* For fundamental code changes, an Airflow Improvement Proposal
([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+Proposals))
is needed.
+* When adding dependency, check compliance with the [ASF 3rd Party License
Policy](https://www.apache.org/legal/resolved.html#category-x).
+* For significant user-facing changes create newsfragment:
``{pr_number}.significant.rst`` or ``{issue_number}.significant.rst``, in
[airflow-core/newsfragments](https://github.com/apache/airflow/tree/main/airflow-core/newsfragments).
Review Comment:
What is that newsfragment for? Looks like hallucinated code from AI tool
--
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]