SSHException: SSH session not active

2,091 views
Skip to first unread message

NAGENDRA KUMAR

unread,
Dec 7, 2021, 6:13:43 AM12/7/21
to robotframework-users
Hi Team,

I am running some script on remote server using ssh library for longer duration , i have set timeout as 10 min but ssh session is getting inactive after 5 mins as some command is  taking 10 mins to complete the execution process  so testcase is getting terminated in middle with FAIL status.

example

Open Connection    ${Infoserver_IP}    port=22    timeout=10 min

even i tired other method also 

Library SSHLibrary 10 min

Set Client Configuration timeout=10 min

but session not active after 5 min

SSH library version
robotframework-sshlibrary==3.7.0

can you please help me on same 

Regards,
Nagendra

NAGENDRA KUMAR

unread,
Dec 8, 2021, 1:52:19 AM12/8/21
to robotframework-users
can anyone help me on this...why timeout option is not working as expected even after providing timeout value.

007 Diaz

unread,
Dec 9, 2021, 5:26:44 AM12/9/21
to nagend...@gmail.com, robotframework-users
Hi Nagendra,
I think you need to add autoaddpolicy from paramiko. Please try this piece of code in your script. I think it will help you. 

#!/usr/bin/python
import sys
import paramiko
from scp import SCPClient, SCPException
{
pass arguments (Here you need to pass your inputs
}


ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(hostname=ssh_ip, username=ssh_user, password=ssh_pwd, timeout=150)
scp = SCPClient(ssh.get_transport(), socket_timeout=150)


stdin, stdout, stderr = ssh.exec_command(ssh_cmd)
for line in stdout.read().splitlines():
    print(line)

scp.close()
ssh.close()

--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/robotframework-users/56175e3c-78fe-42cb-8bad-80fa4906fe6cn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages