Bug #5618

Exceptions cause DRb connection to be closed

Added by larsch (Lars Christensen) almost 8 years ago. Updated 2 months ago.

Target version:
ruby -v:
ruby 1.9.3p0 (2011-10-30) [i386-mingw32]


If an exception is thrown in a DRb server of a class that is not defined in the client process, the DRb connection is closed abrubtly. In Ruby 1.8, the exception was translated to an instance generic exception class (DRb::DRbRemoteError).

Steps to reproduce:

  1. Start DRb client+server
  2. Throw exception of custom class in server (class not defined in client script).

Observed behaviour:

  1. Client raises DRb::DRbConnError because connection is closed - used to be generic error.

Expected behaviour:

  1. Client raises DRb::DRbRemoteError, and preserves full stack trace from server.

Attached is server/client script showing the problem.

Here is the stack trace of the client:

C:/lang/Ruby193/lib/ruby/1.9.1/drb/drb.rb:570:in load': connection closed (DRb::DRbConnError)
from C:/lang/Ruby193/lib/ruby/1.9.1/drb/drb.rb:632:in
from C:/lang/Ruby193/lib/ruby/1.9.1/drb/drb.rb:918:in recv_reply'
from C:/lang/Ruby193/lib/ruby/1.9.1/drb/drb.rb:1197:in
from C:/lang/Ruby193/lib/ruby/1.9.1/drb/drb.rb:1088:in block (2 levels) in method_missing'
from C:/lang/Ruby193/lib/ruby/1.9.1/drb/drb.rb:1172:in
from C:/lang/Ruby193/lib/ruby/1.9.1/drb/drb.rb:1087:in block in method_missing'
from C:/lang/Ruby193/lib/ruby/1.9.1/drb/drb.rb:1105:in
from C:/lang/Ruby193/lib/ruby/1.9.1/drb/drb.rb:1086:in method_missing'
from drbclient.rb:3:in


drbserver.rb (194 Bytes) drbserver.rb DRb Server larsch (Lars Christensen), 11/11/2011 10:49 PM
drbclient.rb (75 Bytes) drbclient.rb DRb Client larsch (Lars Christensen), 11/11/2011 10:49 PM
drb-rescue-exception-5618.patch (1.03 KB) drb-rescue-exception-5618.patch jeremyevans0 (Jeremy Evans), 08/14/2019 11:52 PM


Updated by ko1 (Koichi Sasada) over 7 years ago

  • Category set to lib
  • Assignee set to seki (Masatoshi Seki)

Updated by shyouhei (Shyouhei Urabe) over 7 years ago

  • Status changed from Open to Assigned

Updated by felixbuenemann (Felix B√ľnemann) over 4 years ago

This issue still exists in Ruby 2.1.5.

Updated by jeremyevans0 (Jeremy Evans) 2 months ago

This issue is unrelated to whether the client defines the same exception class as the server, and the behavior in my testing appears to be the same on 1.8 as in the master branch.

The underlying issue is that the example code here uses a subclass of Exception, and DRb::DRbServer::InvokeMethod#perform does not rescue Exception. Attached is a patch that fixes this issue.

Also available in: Atom PDF