I have this piece of code:

  begin
    Net::SFTP.start(url.host, url.port, auth_user, auth_password) do
|sftp|
    @logger.info "Connection established"
      sftp.extend(Helpers)
      @remote_logger.info("Check for semaphore on FTP")
      if @_source_path =~ /\/$/

and I have this exception:

/var/data/rubyapp/base/gems/gems/net-ssh-1.0.10/lib/net/ssh/transport/version-negotiator.rb:51:in
`readline'
/var/data/rubyapp/base/gems/gems/net-ssh-1.0.10/lib/net/ssh/transport/version-negotiator.rb:51:in
`negotiate'
/var/data/rubyapp/base/gems/gems/net-ssh-1.0.10/lib/net/ssh/transport/version-negotiator.rb:50:in
`loop'
/var/data/rubyapp/base/gems/gems/net-ssh-1.0.10/lib/net/ssh/transport/version-negotiator.rb:50:in
`negotiate'
/var/data/rubyapp/base/gems/gems/net-ssh-1.0.10/lib/net/ssh/transport/session.rb:97:in
`initialize'
/var/data/rubyapp/base/gems/gems/net-ssh-1.0.10/lib/net/ssh/transport/services.rb:121:in
`new'
/var/data/rubyapp/base/gems/gems/net-ssh-1.0.10/lib/net/ssh/transport/services.rb:121:in
`register_services'
/var/data/rubyapp/base/gems/gems/needle-1.3.0/lib/needle/lifecycle/singleton.rb:42:in
`call'
/var/data/rubyapp/base/gems/gems/needle-1.3.0/lib/needle/lifecycle/singleton.rb:42:in
`call'
/var/data/rubyapp/base/gems/gems/needle-1.3.0/lib/needle/lifecycle/singleton.rb:40:in
`synchronize'
/var/data/rubyapp/base/gems/gems/needle-1.3.0/lib/needle/lifecycle/singleton.rb:40:in
`call'
/var/data/rubyapp/base/gems/gems/needle-1.3.0/lib/needle/service-point.rb:122:in
`instance'
/var/data/rubyapp/base/gems/gems/needle-1.3.0/lib/needle/container.rb:308:in
`[]'
/var/data/rubyapp/base/gems/gems/net-ssh-1.0.10/lib/net/ssh/connection/services.rb:60:in
`register_services'
/var/data/rubyapp/base/gems/gems/needle-1.3.0/lib/needle/lifecycle/singleton.rb:42:in
`call'
/var/data/rubyapp/base/gems/gems/needle-1.3.0/lib/needle/lifecycle/singleton.rb:42:in
`call'
/var/data/rubyapp/base/gems/gems/needle-1.3.0/lib/needle/lifecycle/singleton.rb:40:in
`synchronize'
/var/data/rubyapp/base/gems/gems/needle-1.3.0/lib/needle/lifecycle/singleton.rb:40:in
`call'
/var/data/rubyapp/base/gems/gems/needle-1.3.0/lib/needle/service-point.rb:122:in
`instance'
/var/data/rubyapp/base/gems/gems/needle-1.3.0/lib/needle/container.rb:308:in
`[]'
/var/data/rubyapp/base/gems/gems/net-ssh-1.0.10/lib/net/ssh/service/process/services.rb:53:in
`register_services'
/var/data/rubyapp/base/gems/gems/needle-1.3.0/lib/needle/lifecycle/singleton.rb:42:in
`call'
/var/data/rubyapp/base/gems/gems/needle-1.3.0/lib/needle/lifecycle/singleton.rb:42:in
`call'
/var/data/rubyapp/base/gems/gems/needle-1.3.0/lib/needle/lifecycle/singleton.rb:40:in
`synchronize'
/var/data/rubyapp/base/gems/gems/needle-1.3.0/lib/needle/lifecycle/singleton.rb:40:in
`call'
/var/data/rubyapp/base/gems/gems/needle-1.3.0/lib/needle/service-point.rb:122:in
`instance'
/var/data/rubyapp/base/gems/gems/needle-1.3.0/lib/needle/container.rb:308:in
`get'
/var/data/rubyapp/base/gems/gems/needle-1.3.0/lib/needle/container.rb:380:in
`method_missing'
/var/data/rubyapp/base/gems/gems/net-ssh-1.0.10/lib/net/ssh/service/services.rb:41:in
`register_services'
/var/data/rubyapp/base/gems/gems/needle-1.3.0/lib/needle/container.rb:365:in
`__send__'
/var/data/rubyapp/base/gems/gems/needle-1.3.0/lib/needle/container.rb:365:in
`require'
/var/data/rubyapp/base/gems/gems/needle-1.3.0/lib/needle/definition-context.rb:77:in
`__send__'
/var/data/rubyapp/base/gems/gems/needle-1.3.0/lib/needle/definition-context.rb:77:in
`require'
/var/data/rubyapp/base/gems/gems/net-ssh-1.0.10/lib/net/ssh/session.rb:119:in
`initialize'
/var/data/rubyapp/base/gems/gems/needle-1.3.0/lib/needle/container.rb:107:in
`define'
/var/data/rubyapp/base/gems/gems/net-ssh-1.0.10/lib/net/ssh/session.rb:97:in
`initialize'
/var/data/rubyapp/base/gems/gems/net-ssh-1.0.10/lib/net/ssh.rb:47:in
`new'
/var/data/rubyapp/base/gems/gems/net-ssh-1.0.10/lib/net/ssh.rb:47:in
`start'
/var/data/rubyapp/base/gems/gems/net-sftp-1.1.0/lib/net/sftp.rb:28:in
`start'
/var/data/rubyapp/apps/sviluppo-stack/lib/xml_driver/access_methods/sftp_with_semaphore.rb:34:in
`fetch_sources'
/var/data/rubyapp/apps/sviluppo-stack/lib/xml_driver/base.rb:57:in
`execute'
/var/data/rubyapp/apps/sviluppo-stack/script/xml2rpc:25

So the problem is in the start method. I can't replicate the problem. It
happens randomly with SFTP servers. The error is Exiting on this error:
end of file reached

ruby version is 1.8.6

-- 
Posted via http://www.ruby-forum.com/.