Project

General

Profile

Bug #7833

DRb has problems with BasicObject

Added by prijutme4ty (Ilya Vorontsov) over 6 years ago. Updated 9 days ago.

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

Description

I realized some problems with DRb and BasicObject
1) I cannot create front object of BasicObject class because DRb tries to call private_methods class

2) Call to DRb can't return instance of BasicObject class, instead it hangs.

serv.rb:

require 'drb'
$drb_uri = 'druby://localhost:1111'
class Front
def func
BasicObject.new
end
end
DRb.start_service($drb_uri, Front.new)
DRb.thread.join

conn.rb:

require 'drb'
$drb_uri = 'druby://localhost:1111'
DRb.start_service
conn = DRbObject.new_with_uri($drb_uri)
p conn.func

When after a while (tens of seconds) I break the server, client shows me trace:

conn.rb
C:/Ruby193/lib/ruby/1.9.1/drb/drb.rb:570:in load': connection closed (DRb::DRbConnError)
from C:/Ruby193/lib/ruby/1.9.1/drb/drb.rb:632:in
recv_reply'
from C:/Ruby193/lib/ruby/1.9.1/drb/drb.rb:918:in recv_reply'
from C:/Ruby193/lib/ruby/1.9.1/drb/drb.rb:1197:in
send_message'
from C:/Ruby193/lib/ruby/1.9.1/drb/drb.rb:1088:in block (2 levels) in method_missing'
from C:/Ruby193/lib/ruby/1.9.1/drb/drb.rb:1172:in
open'
from C:/Ruby193/lib/ruby/1.9.1/drb/drb.rb:1087:in block in method_missing'
from C:/Ruby193/lib/ruby/1.9.1/drb/drb.rb:1105:in
with_friend'
from C:/Ruby193/lib/ruby/1.9.1/drb/drb.rb:1086:in method_missing'
from D:/programming/iogen_tools/website/server/tmp/conn.rb:5:in
'


Files

drb-basicobject-7833.patch (4.95 KB) drb-basicobject-7833.patch jeremyevans0 (Jeremy Evans), 08/07/2019 06:06 PM

Associated revisions

Revision d0ed935d
Added by jeremyevans (Jeremy Evans) 9 days ago

Fix some DRb issues (#2552)

  • Handle BasicObject in drb

Also fix a bug in rescue clause of any_to_s because sprintf
does not handle the %l modifier.

Fixes [Bug #7833]

  • Do not send a reply to the client if there is a connection error

This allows for normal TCP shutdown (fin-ack-fin-ack instead of
fin-ack-push-rst).

Patch from pierre@mouraf.org (Pierre-Alexandre Meyer).

Fixes [Bug #2339]

  • Detect fork and do not reuse forked connections in drb

This associates each DRbConn with a pid, and if the pid changes,
it closes any DRbConns in the pool with a pid that no longer
matches. This fixes DRb servers from sending messages intended
for one client to another client after forking.

Fixes [Bug #2718]
Fixes [Bug #14471]

History

Updated by usa (Usaku NAKAMURA) over 6 years ago

  • Status changed from Open to Assigned
  • Assignee set to seki (Masatoshi Seki)
#2

Updated by naruse (Yui NARUSE) over 6 years ago

  • Target version changed from 1.9.3 to 2.6
#3

Updated by naruse (Yui NARUSE) almost 2 years ago

  • Target version deleted (2.6)

Updated by jeremyevans0 (Jeremy Evans) 3 months ago

This is still a bug in the master branch. Attached is a patch that fixes the issue. It's a decent size patch as there are many parts of drb that need to be modified to handle BasicObject instances. This patch also fixes a bug in the rescue clause of any_to_s, as sprintf does not support a %l modifier (maybe it did at some point in the past, before 1.8.7?).

#5

Updated by jeremyevans (Jeremy Evans) 9 days ago

  • Status changed from Assigned to Closed

Applied in changeset git|d0ed935d5bf8c3fce9800742a36e44fb7f63dda4.


Fix some DRb issues (#2552)

  • Handle BasicObject in drb

Also fix a bug in rescue clause of any_to_s because sprintf
does not handle the %l modifier.

Fixes [Bug #7833]

  • Do not send a reply to the client if there is a connection error

This allows for normal TCP shutdown (fin-ack-fin-ack instead of
fin-ack-push-rst).

Patch from pierre@mouraf.org (Pierre-Alexandre Meyer).

Fixes [Bug #2339]

  • Detect fork and do not reuse forked connections in drb

This associates each DRbConn with a pid, and if the pid changes,
it closes any DRbConns in the pool with a pid that no longer
matches. This fixes DRb servers from sending messages intended
for one client to another client after forking.

Fixes [Bug #2718]
Fixes [Bug #14471]

Also available in: Atom PDF