meel-ayush opened a new pull request, #76555:
URL: https://github.com/apache/airflow/pull/76555

   ### Description
   
   When `handle_requests()` fails to deserialize or validate an incoming 
request frame — due to a missing discriminator, schema mismatch, or malformed 
payload — it was logging the exception and issuing `continue`. No response 
frame was sent back.
   
   The task runner's `CommsDecoder.send()` blocks on `socket.recv(4)` waiting 
for the 4-byte length header of the reply. With nothing coming, the child 
process deadlocks permanently. The supervisor's heartbeat loop keeps running 
normally, so the scheduler's zombie detector never fires. The task stays stuck 
in `RUNNING` and holds worker capacity until manually killed.
   
   The fix catches the exception as `e` and replies with 
`ErrorResponse(error=ErrorType.GENERIC_ERROR)` before `continue`, matching the 
existing pattern used for `ServerResponseError` and unhandled exceptions later 
in the same method. The send is wrapped in `suppress(Exception)` so a secondary 
socket error during the reply cannot crash the generator loop itself.
   
   closes: #76550
   
   ### Tests
   
   - Added `test_handle_requests_decoding_error_sends_error_response` in 
`task-sdk/tests/task_sdk/execution_time/test_supervisor.py`, parametrized over 
an unknown message type and a message missing required fields. Each case 
asserts the response frame carries a `GENERIC_ERROR`, the task runner side 
raises `AirflowRuntimeError`, and the generator loop stays alive for the next 
request.
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [ ] Yes (please specify the tool below)


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