Project

General

Profile

Feature #12101

Add verbose failure messages and avoid infamous DRb::DRbConnError

Added by yagudaev (Michael Yagudaev) about 2 years ago. Updated about 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
[ruby-core:73930]

Description

Avoid the generic "DRb::DRbConnError" which gives very little information and make errors hard to debug.

When I stared using DRuby, I kept getting a strange and cryptic error message DRb::DRbConnError 'connection closed'. Turns out it was due to some silly mistake on the server side of the relationship. It took hours to figure out. The only way I was able to do it was to patch ruby drb after closely studying the source.

Others have had the same issues:

http://stackoverflow.com/questions/27293817/ruby-connection-closed-drbdrbconnerror
https://www.ruby-forum.com/topic/193984
https://github.com/Mon-Ouie/pry-remote/issues/8

Here is an example where this makes a difference:

# drb_server.rb
require 'drb'

class FrontObject
  def foo
    # generates Runtime Exception of Insecure Operation
    result = `ls -l`
  end
end

DRb.start_service("druby://localhost:8787", FrontObject.new, safe_level: 3)
DRb.thread.join
# drb_client.rb
require 'drb'

object = DRbObject.new_with_uri("druby://localhost:8787")
puts object.foo

Output before patch is applied:

$ ruby drb_server.rb
$ ruby drb_client.rb
/Users/mike/.rbenv/versions/2.2.3/lib/ruby/2.2.0/drb/drb.rb:578:in `load': connection closed (DRb::DRbConnError)

Output after patch is applied:

$ ruby drb_server.rb
Insecure operation ``' at level 3
$ ruby drb_client.rb
/Users/mike/.rbenv/versions/2.2.3/lib/ruby/2.2.0/drb/drb.rb:578:in `load': connection closed (DRb::DRbConnError)

Original issue and proposed solution started on github: https://github.com/ruby/ruby/pull/1260

Associated revisions

Revision 018f0812
Added by seki (Masatoshi Seki) about 2 years ago

  • lib/drb/drb.rb (error_print): Add verbose failure messages and avoid infamous DRb::DRbConnError. [Feature #12101]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53962 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 53962
Added by seki (Masatoshi Seki) about 2 years ago

  • lib/drb/drb.rb (error_print): Add verbose failure messages and avoid infamous DRb::DRbConnError. [Feature #12101]

Revision 53962
Added by seki (Masatoshi Seki) about 2 years ago

  • lib/drb/drb.rb (error_print): Add verbose failure messages and avoid infamous DRb::DRbConnError. [Feature #12101]

Revision 53962
Added by seki (Masatoshi Seki) about 2 years ago

  • lib/drb/drb.rb (error_print): Add verbose failure messages and avoid infamous DRb::DRbConnError. [Feature #12101]

History

#1 [ruby-core:73931] Updated by yagudaev (Michael Yagudaev) about 2 years ago

  • Tracker changed from Bug to Feature

#2 [ruby-core:73932] Updated by drbrain (Eric Hodel) about 2 years ago

I think printing out messages to $stdout is not the best way. If I'm running DRb as a server I may have no way of seeing these and knowing if it is a problem.

Better, I think, would be to allow a user to configure a callback or logger that is invoked when an error on the client side is discovered.

See also https://rubygems.org/gems/drbdump which gives you tcpdump-like views of communications amongst drb peers.

#3 Updated by seki (Masatoshi Seki) about 2 years ago

  • Status changed from Open to Closed

Applied in changeset r53962.


  • lib/drb/drb.rb (error_print): Add verbose failure messages and avoid infamous DRb::DRbConnError. [Feature #12101]

Also available in: Atom PDF