kalluripradeep opened a new pull request, #64869:
URL: https://github.com/apache/airflow/pull/64869

   # #64620 fix: TriggerCommsDecoder.asend() asyncio.Lock is not thread-safe
   
   ### Description
   The `TriggerCommsDecoder` used an `asyncio.Lock` to protect access to the 
communication socket. When called from a different event loop (e.g., via 
`sync_to_async` inside a trigger), `asyncio.Lock` would either fail to provide 
mutual exclusion or raise a `RuntimeError`.
   
   This PR replaces the `asyncio.Lock` with an asynchronously-acquired 
`threading.Lock`, which is safe across all threads and loops. It also adds an 
explicit `drain()` to ensure reliability.
   
   ### Changes
   - Replaced loop-bound `asyncio.Lock` with `threading.Lock` acquired via 
`run_in_executor`.
   - Added `await self._async_writer.drain()` to `asend()` to ensure reliable 
message delivery.
   


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