python - Time out on lost connection in Paramiko -


i need handle connectivity problems correctly while executing long-running commands on ssh paramiko.

the exec_command has timeout argument throws exception if there no response. raises when connection lost when command execute works longer timeout seconds.

so tried use set_keepalive not work either. paramiko not guarantee keepalive packet sent , seems not check keepalive response server. put:

iptables -a input -s ... -j drop 

on target server in middle of command executes , watched paramiko's debug logs - keeps sending keepalive packet , not pay attention @ absence of server response. seems there nothing similar openssh serveralivecountmax param kill ssh if there no response client ssh server.

as see there no way distinguish long running command , network failure. can put timeout on exec_command call , believe if exception raised it's not slow command connection loss.

is there solid way solve problem?

both cases network failures, 1 didn't work start, other 1 because failed later. in end there no difference between them.

it decide how code behaves in case. usual approach retry inserting growing timeout.

the famous algorithm called exponential backoff.


Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -

java - Digest auth with Spring Security using javaconfig -