[erlang-bugs] Erlang SSH client hangs after some thousand requests

Mario Santoro mario.santoro@REDACTED
Mon Dec 12 18:01:03 CET 2016


Hi all,
I wrote an Erlang ssh client module for running commands on a remote host over an ssh connection.
The main calls to Erlang ssh library functions to setup the connection are the following:
ssh:connect/4
ssh_connection:session_channel/2
ssh_connection:ptty_alloc/3
ssh_connection:shell/2

afterwards I'm issuing a command to remote host via:
ssh_connection:send/3

and receiving related reply in a msg loop, with the following format:
{ssh_cm, ConnectionRef, {data, ChannelId, Type, Data}}

Everything works fine and I'm able to issue commands and receive responses correctly.

What I'm experiencing is a strange behavior on long lasting ssh sessions: when I start a long loop of
ssh send-receive requests, it seems like the client connection hangs after a certain number or positive command requests (several thousands),
waiting indefinitely for a reply, wherefrom it exits with timeout.
The only way to recover from this status is to disconnect and reconnect to the server.

I tried with both Erlang OTP/17.x and OTP/18.x and towards remote hosts running Linux and/or  Solaris OS, but the result is the same.

This behavior seems to be deterministic: given a command, it happens after the same number of issued requests (e.g. for a trivial "pwd" command,
the client always hangs after 2510 tries!!).
This make me think as there's a limited receive buffer size somewhere into the client ssh library or something similar (maybe something that I should set at connection setup?);
since I'm quite newbie to Erlang, I'd very much appreciate if anyone could help me to find out the reason for this behaviour.

Thanks in advance for your help!

Regards,
/Mario



[Ericsson]<http://www.ericsson.com/>

MARIO SANTORO
Service Project Manager
Region Mediterranean
RMED ITC CU SCM SL AIB DMO

Ericsson
Via Anagnina, 203
00118, ROME, ITALY
Mobile +39 335 699 5215
Office +39 06 7258 8404
mario.santoro@REDACTED
www.ericsson.com


[http://www.ericsson.com/current_campaign]<http://www.ericsson.com/current_campaign>

----------

Legal entity: Ericsson Telecomunicazioni SpA, registered office in Rome. This Communication is Confidential. We only send and receive email on the basis of the terms set out at www.ericsson.com/email_disclaimer<http://www.ericsson.com/email_disclaimer>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-bugs/attachments/20161212/f1e5a71c/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image003.gif
Type: image/gif
Size: 2367 bytes
Desc: image003.gif
URL: <http://erlang.org/pipermail/erlang-bugs/attachments/20161212/f1e5a71c/attachment.gif>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image004.gif
Type: image/gif
Size: 32254 bytes
Desc: image004.gif
URL: <http://erlang.org/pipermail/erlang-bugs/attachments/20161212/f1e5a71c/attachment-0001.gif>


More information about the erlang-bugs mailing list