hkc-8010 commented on code in PR #74010:
URL: https://github.com/apache/airflow/pull/74010#discussion_r4749494321


##########
task-sdk/src/airflow/sdk/execution_time/comms.py:
##########
@@ -326,7 +331,7 @@ def _exchange(self, msg: SendMsgType, frame_bytes: bytes | 
bytearray) -> Receive
                 # We need special handling here! The server can't send us the 
fd number, as the number on the
                 # supervisor will be different to in this process, so we have 
to mutate the message ourselves here.
                 frame, fds = self._read_frame(maxfds=1)
-                resp = self._from_frame(frame)
+                resp = self._from_frame(frame, request_id=request.id)

Review Comment:
   Fixed in 0262e84755. If `_from_frame` raises (id mismatch or an error 
frame), the fds from `_read_frame(maxfds=1)` are closed before re-raising. A 
matching response still hands them to the caller. Removing the `os.close` makes 
the new rejection test fail with `DID NOT RAISE OSError` when it checks the 
received fd.



##########
task-sdk/src/airflow/sdk/execution_time/comms.py:
##########
@@ -326,7 +331,7 @@ def _exchange(self, msg: SendMsgType, frame_bytes: bytes | 
bytearray) -> Receive
                 # We need special handling here! The server can't send us the 
fd number, as the number on the
                 # supervisor will be different to in this process, so we have 
to mutate the message ourselves here.
                 frame, fds = self._read_frame(maxfds=1)
-                resp = self._from_frame(frame)
+                resp = self._from_frame(frame, request_id=request.id)

Review Comment:
   Added two tests in 0262e84755. One sends a real fd over the socket with a 
mismatched id and checks `AirflowSupervisorCommsOutOfSync` is raised and the 
received fd is closed. The other checks a matching response keeps its fds open. 
Dropping `request_id=request.id` on this path fails the first one.



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