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


##########
task-sdk/src/airflow/sdk/execution_time/timeout.py:
##########
@@ -56,7 +65,12 @@ def __exit__(self, type_, value, traceback):
             return
         import signal
 
-        signal.setitimer(signal.ITIMER_REAL, 0)
+        try:
+            signal.setitimer(signal.ITIMER_REAL, 0)
+        finally:
+            # The alarm can still land on the line above, after the block 
ended.
+            if self._timed_out:
+                self.log.error("Process timed out", pid=os.getpid())

Review Comment:
   `_timed_out` is never cleared. If the same `TimeoutPosix` instance is used 
again after a timeout, even a block that finishes immediately logs "Process 
timed out", and so does every subsequent use. Clear the flag when consuming it 
so each block reports only its own timeout.



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