uranusjr commented on a change in pull request #17528:
URL: https://github.com/apache/airflow/pull/17528#discussion_r685779664
##########
File path: airflow/providers/ssh/operators/ssh.py
##########
@@ -149,7 +149,13 @@ def execute(self, context) -> Union[bytes, str, bool]:
and not stdout.channel.recv_ready()
):
stdout.channel.shutdown_read()
- stdout.channel.close()
+ try:
+ stdout.channel.close()
+ except Exception as e:
+ # there is a race that when shutdown_read has been
called and when
+ # you try to close the connection, the socket is
already closed
+ # We should ignore such errors (but we should log
them with warning)
+ self.log.warning("Ignoring exception on close: ",
e)
Review comment:
```suggestion
except Exception:
# there is a race that when shutdown_read has
been called and when
# you try to close the connection, the socket is
already closed
# We should ignore such errors (but we should
log them with warning)
self.log.warning("Ignoring exception on close",
exc_info=True)
```
I think this can catch more context
--
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]