Forum: JRuby Closing SSH connections

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Josh M. (Guest)
on 2009-03-31 11:08
(Received via mailing list)
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
Charles Oliver N. (Guest)
on 2009-03-31 21:16
(Received via mailing list)
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
Josh M. (Guest)
on 2009-04-01 06:32
(Received via mailing list)
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. <
Charles Oliver N. (Guest)
on 2009-04-01 07:31
(Received via mailing list)
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
This topic is locked and can not be replied to.