dabla opened a new issue, #77240:
URL: https://github.com/apache/airflow/issues/77240

   ### Apache Airflow version
   
   main (development)
   
   ### What happened?
   
   `CommsDecoder._exchange` writes a request and then reads the next frame as 
its response. `_get_response` does not check the frame id against the request 
id. When an exception unwinds `_exchange` between the write and the read, the 
response stays on the socket and the next request reads it as its own.
   
   On the main thread, a signal handler that raises can cause this:
   
   - the `AirflowTaskTimeout` raised by the `execution_timeout` alarm, which 
any task can hit while it makes an SDK call;
   - a `DeadlockImminentError` raised into a request by a handler that calls 
`send()` itself (for example `on_kill()` making an SDK call).
   
   The task may then get a wrong value back, for example the previous 
`GetVariable`'s answer for a `GetConnection`, or fail to decode it.
   
   ### What you think should happen instead?
   
   A request never reads a response that belongs to another request. Possible 
fixes: check the response id and drain frames that belong to an abandoned 
request, read a partly read frame to the end before the next request, or mark 
the channel unusable after an interrupted exchange so the next call fails 
loudly.
   
   ### How to reproduce
   
   Make the response of a `send()` arrive after an `execution_timeout` alarm 
fires while the task waits for it, then make another SDK call in the same 
process: it returns the first request's response.
   
   ### Anything else?
   
   Found while working on #76545 (and earlier on #62922).
   
   ### Are you willing to submit PR?
   
   - [x] Yes I am willing to submit a PR!
   


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