jason810496 commented on code in PR #61281:
URL: https://github.com/apache/airflow/pull/61281#discussion_r2802757594
##########
airflow-core/src/airflow/api_fastapi/main.py:
##########
@@ -18,11 +18,26 @@
from __future__ import annotations
import os
+import sys
# Mark this as a server context before any airflow imports
# This ensures plugins loaded at import time get the correct secrets backend
chain
os.environ["_AIRFLOW_PROCESS_CONTEXT"] = "server"
+# Warn if PYTHONASYNCIODEBUG or PYTHONDEVMODE is set on Python 3.12+ (see
Airflow issue #61214)
+if sys.version_info >= (3, 12) and (
+ os.environ.get("PYTHONASYNCIODEBUG") == "1" or
os.environ.get("PYTHONDEVMODE")
Review Comment:
```suggestion
os.environ.get("PYTHONASYNCIODEBUG") == "1" or
os.environ.get("PYTHONDEVMODE") == "1"
```
##########
airflow-core/docs/administration-and-deployment/web-stack.rst:
##########
@@ -58,6 +58,27 @@ separately. This might be useful for scaling them
independently or for deploying
# serve only the Execution API Server
airflow api-server --apps execution
+Known Issues
+------------
+
+Incompatibility with ``PYTHONASYNCIODEBUG`` and ``PYTHONDEVMODE``
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+.. warning::
+
+ The API server may crash with a segmentation fault when the environment
variable
+ ``PYTHONASYNCIODEBUG=1`` is set or when running in ``PYTHONDEVMODE`` on
Python 3.12 or later.
+ This is due to an incompatibility between ``uvloop`` (used by Uvicorn for
improved performance)
+ and Python's ``asyncio`` debug mode.
+
+ If you need to debug ``asyncio`` issues in the API server, consider:
+
+ * Debugging at the application level rather than relying on
``PYTHONASYNCIODEBUG``
+ * Using the Triggerer for async debugging (where ``PYTHONASYNCIODEBUG`` is
safe to use)
+ * Setting up a development environment without uvloop installed
Review Comment:
Triggerer and API server are separated components, I would prefer not to
mentioning Triggerer at all to avoid confusing user.
```suggestion
* Debugging at the application level rather than relying on
``PYTHONASYNCIODEBUG`` or ``PYTHONDEVMODE``
* Setting up a development environment without uvloop installed
```
--
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]