anukratb commented on code in PR #75297:
URL: https://github.com/apache/airflow/pull/75297#discussion_r4337219154


##########
task-sdk/src/airflow/sdk/execution_time/supervisor.py:
##########
@@ -1485,6 +1485,34 @@ def _check_subprocess_exit(
                 self.process_log.warning("Process exited abnormally", 
exit_code=self._exit_code)
         return self._exit_code
 
+    def _terminate_subprocess_after_monitor_error(self) -> None:
+        if self._exit_code is not None:
+            return
+
+        try:
+            self.cleanup_sockets_after_kill()

Review Comment:
   @Andrushika agreed - fixed in the latest commits - just moving SIGTERM first 
would still race with on_kill()'s log call so the sockets are no longer closed 
before the task edits. The supervisor keeps reading stdout, stderr and the log 
socket while the task shuts down and only discards the data once forwarding 
fails since forwarding is what maybe failed (ENOSPC for eg). The on_kill() log 
lone goes through and killpg runs - sockets are closed after kill() returns



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