Project

General

Profile

Actions

Bug #2718

closed

DRb mixing up function return values between PIDs after fork()

Added by rhythmx (Sean Bradly) almost 15 years ago. Updated about 5 years ago.

Status:
Closed
Target version:
-
ruby -v:
1.9.1,1.8.7
[ruby-core:28089]

Description

=begin
The precise details are in the attached test case, but the basic version goes as such: Child pid 1 calls method_a() but gets the return value of method_b() that was called from child pid 2. This only happens if the parent process makes any remote DRb calls before the fork.

This issue showed up for me in 1.9.1 as well as 1.8.7 on x86, but not in x86_64.
=end


Files

drb_test_case.rb (1.48 KB) drb_test_case.rb rhythmx (Sean Bradly), 02/07/2010 03:52 AM
drb-handle-fork-2718.patch (1.73 KB) drb-handle-fork-2718.patch jeremyevans0 (Jeremy Evans), 08/27/2019 06:40 PM

Related issues 1 (0 open1 closed)

Has duplicate Ruby master - Bug #14471: DRb mixing up function return values between PIDs after fork()ClosedActions
Actions #1

Updated by mame (Yusuke Endoh) over 14 years ago

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

=begin
Hi,

Sorry for late response, but I cannot reproduce on both 1.8.7-p249
and 1.9.1-p378.

I assign this issue to Masatoshi Seki, the maintainer for drb.
Seki-san, could you check this issue?

--
Yusuke Endoh
=end

Actions #2

Updated by rhythmx (Sean Bradly) over 14 years ago

=begin
I just verified that this shows up for me in Ruby 1.8.7-p249 as well as 1.9.1-p378. It does seem to reproduce a lot more readily in 1.8, however.

Note that you must run the test script with at least one argument (the arg can be anything) to trigger the problem. With 0 arguments it skips the bug to show the known good case.

--

(o.0) xi:~/code $ rvm list

rvm rubies

ruby-1.8.6-p383 [ i386 ]
ruby-1.8.7-p174 [ i386 ]
ruby-1.8.7-p249 [ i386 ]

=> ruby-1.9.1-p378 [ i386 ]

(o.0) xi:~/code $ ruby ~/Downloads/drb_test_case.rb FAIL
a exiting
a exiting
a exiting
a ok
b ok
b ok
A BAD RESULT ("BBBB")
a exitinga exiting

b exiting
b exiting

--Sean
=end

Actions #3

Updated by jeremyevans0 (Jeremy Evans) over 5 years ago

  • Project changed from Backport191 to Ruby master
  • Description updated (diff)
  • Backport set to 2.5: UNKNOWN, 2.6: UNKNOWN
Actions #4

Updated by jeremyevans0 (Jeremy Evans) over 5 years ago

  • Has duplicate Bug #14471: DRb mixing up function return values between PIDs after fork() added

Updated by jeremyevans0 (Jeremy Evans) over 5 years ago

This issue still occurs in the master branch. Attached is a patch that fixes it by detecting changes in pid.

Actions #6

Updated by jeremyevans (Jeremy Evans) about 5 years 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-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]

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0