Copilot commented on code in PR #74010:
URL: https://github.com/apache/airflow/pull/74010#discussion_r4744214640


##########
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:
   The new mismatch tests only send `GetVariable`, so they never exercise this 
separate `ResendLoggingFD` validation path. Removing `request_id=request.id` 
here would leave all the new tests passing and silently accept another 
request's logging response. Add a regression test that supplies a mismatched 
response for `ResendLoggingFD` and asserts `AirflowSupervisorCommsOutOfSync`; 
also verify that received descriptors are closed on rejection.



##########
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:
   If a mismatched `ResendLoggingFD` response carries file descriptors, 
`_read_frame(maxfds=1)` has already opened them in this process. Raising here 
loses those descriptors without closing them, leaving the associated resources 
open. Close the received descriptors when validation raises, while preserving 
ownership transfer on success.



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