Project

General

Profile

Actions

Bug #657

closed

Thread.new { fork }

Added by quix (James M. Lawrence) about 16 years ago. Updated over 13 years ago.

Status:
Closed
Target version:
ruby -v:
ruby 1.9.2dev (2009-02-16 trunk 22334) [i386-darwin9.6.0]
Backport:
[ruby-core:19385]

Description

=begin
% uname -a
Darwin tiamat.local 9.5.0 Darwin Kernel Version 9.5.0: Wed Sep 3 11:29:43 PDT 2008; root:xnu-1228.7.58~1/RELEASE_I386 i386
% ./ruby --version
ruby 1.9.0 (2008-10-19 revision 19843) [i386-darwin9.5.0]

% ./ruby -e 'Thread.new { fork }'
% killall ruby
[BUG] pthread_mutex_lock: 22
ruby 1.9.0 (2008-10-19 revision 19843) [i386-darwin9.5.0]

-- control frame ----------

-- backtrace of native function call (Use addr2line) --
0x12c1e9
0x29ac6
0x29b05
0x12c352
0x12cf8c
0x12fc0c
0x12cddd
0x96bf16f5
0x96bf15b2

% atos -o ./ruby -f hex
rb_vm_bugreport (in ruby)
report_bug (in ruby)
rb_bug (in ruby)
native_mutex_lock (in ruby)
rb_thread_interrupt (in ruby)
timer_thread_function (in ruby)
thread_timer (in ruby)
0x96bf16f5
0x96bf15b2

% ./ruby -e 'Thread.new { fork { Thread.new { } } }'
-e:1: Fixnum

% ./ruby -e 'Thread.new { fork { Thread.new { } } }'
-e:1: Fixnum

% ./ruby -e 'Thread.new { fork { Thread.new { } } }'
[BUG] rb_thread_terminate_all: called by child thread (0x249fb0, 0x24a290)
ruby 1.9.0 (2008-10-19 revision 19843) [i386-darwin9.5.0]

-- control frame ----------

-- backtrace of native function call (Use addr2line) --
0x12c1e9
0x29ac6
0x29b05
0x12d078
0x2de7e
0x2e080
0x8e327
0x120c43
0x120a3f
0x1203f9
0x11cd91
0x12927b
0x127f24
0x1280b3
0x12d306
0x12c721
0x96bf16f5
0x96bf15b2

% atos -o ./ruby -f hex2
rb_vm_bugreport (in ruby)
report_bug (in ruby)
rb_bug (in ruby)
rb_thread_terminate_all (in ruby)
ruby_cleanup (in ruby)
ruby_stop (in ruby)
rb_f_fork (in ruby)
call_cfunc (in ruby)
vm_call_cfunc (in ruby)
vm_call_method (in ruby)
vm_exec_core (in ruby)
vm_exec (in ruby)
invoke_block_from_c (in ruby)
vm_invoke_proc (in ruby)
thread_start_func_2 (in ruby)
thread_start_func_1 (in ruby)
0x96bf16f5
0x96bf15b2

% ./ruby -e 'Thread.new { fork { Thread.new { } } }'
-e:1: [BUG] Segmentation fault
ruby 1.9.0 (2008-10-19 revision 19843) [i386-darwin9.5.0]

-- control frame ----------
c:0004 p:---- s:0007 b:0007 l:000006 d:000006 CFUNC :fork
c:0003 p:0009 s:0004 b:0004 l:000294 d:000574 BLOCK -e:1
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
c:0001 p:---- s:0002 b:0002 l:000001 d:000001 TOP

DBG> : "-e:1:in fork'" DBG> : "-e:1:in block in '"
-- backtrace of native function call (Use addr2line) --
0x12c1e9
0x29ac6
0x29b05
0xc689f
0x96c2d09b
0xffffffff

% atos -o ./ruby -f hex3
rb_vm_bugreport (in ruby)
report_bug (in ruby)
rb_bug (in ruby)
sigpipe (in ruby)
0x96c2d09b
0xffffffff

=======================================================
Linux

$ uname -a
Linux tiamat-linux 2.6.24-19-generic #1 SMP Wed Aug 20 22:56:21 UTC 2008 i686 GNU/Linux
$ ./ruby --version
ruby 1.9.0 (2008-10-19 revision 19843) [i686-linux]
$ ./ruby -e 'Thread.new { fork }'
$ killall ruby
[BUG] $
$ ./ruby -e 'Thread.new { fork { Thread.new { } } }'
-e:1: Fixnum

=======================================================
I deleted a related bug on rubyforge (#22209) which unnecessarily involved DRb.
=end

Actions #1

Updated by ko1 (Koichi Sasada) almost 16 years ago

  • Assignee set to nobu (Nobuyoshi Nakada)

=begin

=end

Actions #2

Updated by yugui (Yuki Sonoda) almost 16 years ago

  • Status changed from Open to Assigned
  • Target version set to 1.9.1 Release Candidate

=begin

=end

Actions #3

Updated by yugui (Yuki Sonoda) almost 16 years ago

  • Status changed from Assigned to Closed

=begin
Perhaps it does not reproduce now.
=end

Actions #4

Updated by quix (James M. Lawrence) almost 16 years ago

=begin
% ./ruby -e '30.times { Thread.new { fork } }'
% killall ruby
[BUG] pthread_mutex_lock: 22
ruby 1.9.1 (2008-12-14 revision 20727) [i386-darwin9.5.0]

-- control frame ----------

-- backtrace of native function call (Use addr2line) --
0x130151
0x2a638
0x2a677
0x1302ba
0x131128
0x133df2
0x130de3
0x904106f5
0x904105b2

% atos -o ./ruby -f hex
rb_vm_bugreport (in ruby) (vm_dump.c:594)
report_bug (in ruby)
rb_bug (in ruby)
native_mutex_lock (in ruby) (thread_pthread.c:39)
rb_thread_interrupt (in ruby) (thread.c:254)
timer_thread_function (in ruby) (thread.c:2378)
thread_timer (in ruby) (thread_pthread.c:753)
0x904106f5
0x904105b2

=end

Actions #5

Updated by yugui (Yuki Sonoda) almost 16 years ago

  • Status changed from Closed to Open
  • Priority changed from Normal to 5

=begin

=end

Actions #6

Updated by yugui (Yuki Sonoda) almost 16 years ago

  • Due date set to 12/24/2008

=begin

=end

Actions #7

Updated by nobu (Nobuyoshi Nakada) almost 16 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

=begin
Applied in changeset r21097.
=end

Actions #8

Updated by quix (James M. Lawrence) almost 16 years ago

=begin
% ./ruby -e 'Thread.new { fork }'
% killall ruby
[BUG] pthread_mutex_lock: 22
ruby 1.9.2dev (2009-02-16 trunk 22334) [i386-darwin9.6.0]

-- control frame ----------

-- C level backtrace information -------------------------------------------
0x133e2a 0 ruby 0x00133e2a rb_vm_bugreport + 138
0x2b41e 1 ruby 0x0002b41e rb_warning + 479
0x2b482 2 ruby 0x0002b482 rb_bug + 54
0x133f46 3 ruby 0x00133f46 rb_vm_bugreport + 422
0x134dc6 4 ruby 0x00134dc6 ruby_stack_overflowed_p + 416
0x137c3a 5 ruby 0x00137c3a rb_gc_save_machine_context + 177
0x134abf 6 ruby 0x00134abf ruby_init_stack + 2259
0x960c3095 7 libSystem.B.dylib 0x960c3095 _pthread_start + 321
0x960c2f52 8 libSystem.B.dylib 0x960c2f52 thread_start + 34

[NOTE]
You may encounter a bug of Ruby interpreter. Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html

% atos -o ./ruby -f hex
rb_vm_bugreport (in ruby)
report_bug (in ruby)
rb_bug (in ruby)
native_mutex_lock (in ruby)
rb_thread_interrupt (in ruby)
timer_thread_function (in ruby)
thread_timer (in ruby)
0x960c3095
0x960c2f52

Same error and trace for branches/ruby_1_9_1.

=end

Actions #9

Updated by shyouhei (Shyouhei Urabe) almost 16 years ago

  • Status changed from Closed to Assigned
  • Target version changed from 1.9.1 Release Candidate to 1.9.1
  • ruby -v set to ruby 1.9.2dev (2009-02-16 trunk 22334) [i386-darwin9.6.0]

=begin

=end

Actions #10

Updated by matz (Yukihiro Matsumoto) almost 16 years ago

=begin
Hi,

In message "Re: [ruby-core:22158] [Bug #657] Thread.new { fork }"
on Mon, 16 Feb 2009 05:05:46 +0900, "James M. Lawrence" writes:

|% ./ruby -e 'Thread.new { fork }'
|% killall ruby
|[BUG] pthread_mutex_lock: 22
|ruby 1.9.2dev (2009-02-16 trunk 22334) [i386-darwin9.6.0]

It doesn't happen on my

ruby 1.9.2dev (2009-02-16 trunk 22339) [i386-darwin9.6.0]

from CVS trunk.

						matz.

=end

Actions #11

Updated by quix (James M. Lawrence) almost 16 years ago

=begin
On Mon, Feb 16, 2009 at 6:19 AM, Yukihiro Matsumoto wrote:

It doesn't happen on my
ruby 1.9.2dev (2009-02-16 trunk 22339) [i386-darwin9.6.0]

I tried your revision with -O0 and again with -O3 and obtained
the same error each time. Did you miss the killall?

% ./ruby -e 'Thread.new { fork }'
% killall ruby
[BUG] pthread_mutex_lock: 22
ruby 1.9.2dev (2009-02-16 trunk 22339) [i386-darwin9.6.0]

=end

Actions #12

Updated by nobu (Nobuyoshi Nakada) almost 16 years ago

=begin
Hi,

At Tue, 17 Feb 2009 02:09:05 +0900,
James M. Lawrence wrote in [ruby-core:22187]:

It doesn't happen on my
ruby 1.9.2dev (2009-02-16 trunk 22339) [i386-darwin9.6.0]

I tried your revision with -O0 and again with -O3 and obtained
the same error each time. Did you miss the killall?

% ./ruby -e 'Thread.new { fork }'
% killall ruby
[BUG] pthread_mutex_lock: 22
ruby 1.9.2dev (2009-02-16 trunk 22339) [i386-darwin9.6.0]

I could reproduce it, forked process never die. I'll
investigate.

--
Nobu Nakada

=end

Actions #13

Updated by nobu (Nobuyoshi Nakada) almost 16 years ago

  • Status changed from Assigned to Closed

=begin
Applied in changeset r22389.
=end

Actions #14

Updated by nobu (Nobuyoshi Nakada) almost 16 years ago

=begin
Hi,

At Tue, 17 Feb 2009 08:55:06 +0900,
Nobuyoshi Nakada wrote in [ruby-core:22191]:

% ./ruby -e 'Thread.new { fork }'
% killall ruby
[BUG] pthread_mutex_lock: 22
ruby 1.9.2dev (2009-02-16 trunk 22339) [i386-darwin9.6.0]

I could reproduce it, forked process never die. I'll
investigate.

Sorry, forgotten to commit an old fix.

--
Nobu Nakada

=end

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0