[erlang-bugs] ssh_connection_manager.erl bad catch expression

Daniel Goertzen daniel.goertzen@REDACTED
Wed Jun 20 16:54:45 CEST 2012


I just upgraded to R15B01 and ssh started behaving poorly.  The problem is
a bad catch expression in ssh_connection_manager.erl line 269:

The code is..

catch  %line 269
    _:Reason ->
{disconnect, Reason, {{replies, Replies}, Connection}} =
    ssh_connection:handle_msg(
      #ssh_msg_disconnect{code = ?SSH_DISCONNECT_BY_APPLICATION,
  description = "Internal error",
  language = "en"}, Connection0, undefined,
      Role),


The Reason in the catch clause binds to 'function_clause'
The Reason returned by handle_msg() in my case was {11,"Internal error"}
Changing the catch clause to below seems to fix thing for me.

    _:_Reason ->



My use case is that I open an ssh connection and then sequentially create
and close a number of channels.  A new process is created for each channel,
and the process exits as soon as the eof message is received, leaving a few
additional messages like exit_status dangling.  This evidently exercises
the above catch clause and makes the whole connection crash.

Note that I am talking to a very slow SSH server.  My program also retries
the connection and channel commands forever; after a few minutes it gets
lucky and finishes without crashing.

A work-around is to have the channel process wait for the close message
before exiting.  This is probably the polite thing to do anyway.

I did not have these issues in R14B03.

Regards,
Dan.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-bugs/attachments/20120620/097024fe/attachment.htm>


More information about the erlang-bugs mailing list