subhash-0000 commented on code in PR #61281:
URL: https://github.com/apache/airflow/pull/61281#discussion_r2786228280


##########
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:
   @pierrejeambrun. 
   You're right - the else block introduced new behavior that wasn't there 
before. Airflow doesn't explicitly install uvloop; Uvicorn handles that.
   
   I've removed the else block in commit 0b1e099. The fix now only handles the 
PYTHONASYNCIODEBUG=1 case by explicitly setting 
`asyncio.DefaultEventLoopPolicy()`, preventing uvloop without changing normal 
operation.
   
   Thanks for the review



-- 
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