You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have been experiencing intermittent timeouts in my AWS lambda function using python 3.7 and paramiko 2.7.1. It happens on the very first line of my code where I'm setting up the transport:
Most of the time it works fine, but when it hangs then the transport initializer never returns. Eventually my lambda times out.
Through some debugging I found that it was hanging on line 409 of transport.py (of Paramiko 2.7.1): retry_on_signal(lambda: sock.connect((hostname, port)))
It seems that the call to sock.settimeout() doesn't come until after this line, so my fix was to add the following immediately before line 409: sock.settimeout(self._active_check_timeout)
I'm not sure this is the preferred solution since it puts sock.settimeout() call in 2 places, but it fixes the problem (I couldn't find any easy way to move the other call up since there are multiple paths to create the sock object).
This looks similar to issue #462 but seems to be different, so I'm opening a new issue.
I'm going to create a pull request with my fix. (Please be gentle, it's my first time contributing to any project on github :-). Feel free to reject it if there's a better solution.
Thanks
Ken
The text was updated successfully, but these errors were encountered:
I have been experiencing intermittent timeouts in my AWS lambda function using python 3.7 and paramiko 2.7.1. It happens on the very first line of my code where I'm setting up the transport:
logging.info("Creating transport...")
self.transport = paramiko.Transport(self.sftpServer, self.sftpPort)
logging.info("Transport created, attempting to connect...")
...
Most of the time it works fine, but when it hangs then the transport initializer never returns. Eventually my lambda times out.
Through some debugging I found that it was hanging on line 409 of transport.py (of Paramiko 2.7.1):
retry_on_signal(lambda: sock.connect((hostname, port)))
It seems that the call to sock.settimeout() doesn't come until after this line, so my fix was to add the following immediately before line 409:
sock.settimeout(self._active_check_timeout)
I'm not sure this is the preferred solution since it puts sock.settimeout() call in 2 places, but it fixes the problem (I couldn't find any easy way to move the other call up since there are multiple paths to create the sock object).
This looks similar to issue #462 but seems to be different, so I'm opening a new issue.
I'm going to create a pull request with my fix. (Please be gentle, it's my first time contributing to any project on github :-). Feel free to reject it if there's a better solution.
Thanks
Ken
The text was updated successfully, but these errors were encountered: