DRb & OpenSSL... more info

  • Thread starter Nathaniel Talbott
  • Start date
N

Nathaniel Talbott

Found some more interesting info...

When I include the following file (based on why's patch) in the s.rb and
c.rb scripts I sent in [ruby-talk:78251]:

File: patch.rb

require 'openssl/buffering'

module Buffering
BLOCK_SIZE = 4096

private

def fill_rbuff
@rbuffer = "" unless defined? @rbuffer
begin
if self.respond_to?:)to_io)
IO.select([self.to_io], nil, nil, 1.5)
end
@rbuffer << self.sysread(BLOCK_SIZE)
rescue EOFError
@eof = true
end
end
end

I get the following output:

c.rb (this now works, although there's an obvious pause waiting for the
timeout):

ntalbott@proxytest:~$ ruby c.rb drbssl://localhost:5777
./patch.rb:4: warning: already initialized constant BLOCK_SIZE
Connected to drbssl://localhost:5777
3
500000

s.rb:

ntalbott@proxytest:~$ ruby s.rb drbssl://localhost:5777
./patch.rb:4: warning: already initialized constant BLOCK_SIZE
............................++++++++++++
....++++++++++++
Listening on drbssl://localhost:5777
Called #small
Called #large
#<DRb::DRbConnError: connection closed>
/usr/lib/ruby/site_ruby/1.8/drb/drb.rb:104:in `load'
/usr/lib/ruby/site_ruby/1.8/drb/drb.rb:131:in `recv_request'
/usr/lib/ruby/site_ruby/1.8/drb/drb.rb:283:in `recv_request'
/usr/lib/ruby/site_ruby/1.8/drb/drb.rb:663:in `init_with_client'
/usr/lib/ruby/site_ruby/1.8/drb/drb.rb:675:in `setup_message'
/usr/lib/ruby/site_ruby/1.8/drb/drb.rb:648:in `perform'
/usr/lib/ruby/site_ruby/1.8/drb/drb.rb:715:in `main_loop'
/usr/lib/ruby/site_ruby/1.8/drb/drb.rb:711:in `loop'
/usr/lib/ruby/site_ruby/1.8/drb/drb.rb:729:in `main_loop'
/usr/lib/ruby/site_ruby/1.8/drb/drb.rb:707:in `start'
/usr/lib/ruby/site_ruby/1.8/drb/drb.rb:707:in `main_loop'
/usr/lib/ruby/site_ruby/1.8/drb/drb.rb:599:in `run'
/usr/lib/ruby/site_ruby/1.8/drb/drb.rb:596:in `start'
/usr/lib/ruby/site_ruby/1.8/drb/drb.rb:596:in `run'
/usr/lib/ruby/site_ruby/1.8/drb/drb.rb:549:in `initialize'
/usr/lib/ruby/site_ruby/1.8/drb/drb.rb:737:in `new'
/usr/lib/ruby/site_ruby/1.8/drb/drb.rb:737:in `start_service'
s.rb:23
(The server keeps running, and will accept more requests from the client)

My guess? That the server finishes servicing the request, but the client
doesn't think it's done yet. The client then sends a bit more data (as part
of the SSL session that they're running over) to check if there's anything
else. The server, thinking it's done, interprets this as another request.
This has the result that both client and server hang, the server waiting for
the rest of the new request, and the client waiting for the server to say
the original request is done. Maybe. Does that make any sense?

Thanks,


Nathaniel

<:((><
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
474,262
Messages
2,571,045
Members
48,769
Latest member
Clifft

Latest Threads

Top