uranusjr commented on code in PR #68377:
URL: https://github.com/apache/airflow/pull/68377#discussion_r3490484967


##########
task-sdk/src/airflow/sdk/execution_time/comms.py:
##########
@@ -118,6 +122,39 @@
 ReceiveMsgType = TypeVar("ReceiveMsgType", bound=BaseModel)
 
 
+class DeadlockImminentError(BaseException):
+    """
+    Raised when ``CommsDecoder.send()`` is called from the event loop thread.
+
+    Inherits from :class:`BaseException` rather than :class:`Exception` so that
+    ``contextlib.suppress(Exception)`` — used in 
:func:`airflow.sdk.log.mask_secret`
+    and similar helpers — does **not** catch it.  This ensures the error always
+    surfaces to the caller, pinpointing the incorrect use of a sync API from an
+    async context (e.g. ``BaseHook.get_hook()`` inside ``aexecute()``).
+
+    Fix: replace ``BaseHook.get_hook()`` with ``await BaseHook.aget_hook()``.
+    """
+
+    def __init__(self, msg: object, *, deadlock_imminent: bool) -> None:
+        import traceback

Review Comment:
   This should be imported at the top. It is cheap.



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