Closing SSH connections

Hi,

I am using net-ssh 2.0.4 (newer versions are incompatible with JRuby) to
SSH
into a server. The problem I am experiencing is that the connection
only
closes when the JVM is shutdown. So even though I close the connection
when
I am finished with it, it is still open and I have to stop the JRuby
process
to get the connection to close. This usually would not be a problem
except
the process that does the SSH connections is a background service so the
connections never close and eats up system recources. I ran the same
source
code on the Ruby MRI but the connections closed fine there. Is there
anyway
to force the connections to close in JRuby?

Thanks,

Josh

Josh M. wrote:

connections closed fine there. Is there anyway to force the connections
to close in JRuby?

This sounds like a bug. Can you file an issue for it? It should be a
quick fix once we have a script to reproduce it.

  • Charlie

To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Hi,

I figured out the problem. The problem is when I start a connection
like
this Net::SSH.start(host, username, :password => password) {|ssh| return
ssh.exec!(command)} it will return the results of the command but the
connection will not close. If I simply remove the return from the block
it
close the connection with no problem. This seams to be the same
behavior in
Ruby MRI. Is this the expected behavior?

Thanks,

Josh

On Wed, Apr 1, 2009 at 1:14 AM, Charles Oliver N. <

Josh M. wrote:

Hi,

I figured out the problem. The problem is when I start a connection
like this Net::SSH.start(host, username, :password => password) {|ssh|
return ssh.exec!(command)} it will return the results of the command but
the connection will not close. If I simply remove the return from the
block it close the connection with no problem. This seams to be the
same behavior in Ruby MRI. Is this the expected behavior?

Hmm, you may want to ask that of ruby-core; we are doing what they do,
so I think we’re ok. Is there an “open” method that might do the close
for you?

  • Charlie

To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email