SFTP in R11B
Serge Aleynikov
serge@REDACTED
Wed Jun 14 19:43:15 CEST 2006
I've been experimenting with the SSH application in R11B, and found that
in some occasions when an ssh_sftp client cannot establish connection
with an SFTP server, the ssh_sftp client crashes misarably producing a
nice chunk of CRASH REPORTs when SASL is started.
A dive into the ssh_sftp's source led to the following observations:
1. SFTP clients starts an connection manager ssh_cm. The later is
implemented as a gen_server process that doesn't carefully handle
exceptions in user_auth call leading to a leaky exception in the
gen_server's init/1. That is easy to fix:
--- lib/ssh/src/ssh_cm.erl 2006-06-07 18:24:43.767831191 -0400
+++ lib/ssh/src/ssh_cm.erl 2006-06-07 18:45:01.594608966 -0400
@@ -199,7 +199,7 @@
init([client, User, Host, Port, Opts]) ->
case ssh_transport:connect(Host, Port, Opts) of
{ok, SSH} ->
- case user_auth(SSH, Opts) of
+ case catch user_auth(SSH, Opts) of
ok ->
SSH ! {ssh_install, connect_messages()},
process_flag(trap_exit, true),
2. However, in this case gen_server's init/1 returns {stop, Reason}.
This is an expected callback's return value, but because the Reason is
not normal, this still produces a sasl CRASH REPORT. I am not sure this
is a good thing. I'd like to be able to do:
ssh_sftp:connect(Host, Opts) -> {ok, Pid} | {error, Reason}
without getting a crash report. Is there a way to avoid that?
Additionally, here's a reference to another ssh_sftp patch fixing sftp's
hanging issue:
http://www.erlang.org/ml-archive/erlang-questions/200605/msg00095.html
Regards,
Serge
--
Serge Aleynikov
R&D Telecom, IDT Corp.
Tel: (973) 438-3436
Fax: (973) 438-1464
serge@REDACTED
More information about the erlang-questions
mailing list