Hi,
2008/6/12, Paul Boekholt <p.boekholt gmail.com>:
> That's difficult. When the module is statically linked
I don't get the
> error. I suspect the problem only occurs when it's
dynamically loaded.
> So any code to reproduce it would have to be a DSO,
such as a SLang,
> Perl or Apache module.
I've compiled Perl's Inline::Ruby module with edpratomo's
patch to get
it working with 1.9 (see
h
ttp://rt.cpan.org/Public/Bug/Display.html?id=32536). I
get this when
running 'make test':
PERL_DL_NONLAZY=1 /usr/bin/perl
"-MExtUtils::Command::MM" "-e"
"test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/01basic.......ok
t/02iter........<dummy toplevel>:17: [BUG]
Segmentation fault
ruby 1.9.0 (2008-04-14 revision 17550) [i686-linux]
-- control frame ----------
c:0001 p:0000 s:0002 b:0002 l:0017c4 d:0017c4 TOP
<dummy toplevel>:17
---------------------------
-- backtrace of native function call (Use addr2line) --
0x4046410e
0x4039fbd7
0x4039fc0f
0x404276a9
0x40017440
0x403a74b7
0x403877b4
0x80bdaa1
0x80bc379
0x8063a1b
0x805ffd1
0x40072ea8
0x805fe31
-------------------------------------------------------
dubious
Test returned status 0 (wstat 6, 0x6)
DIED. FAILED tests 10-11
Failed 2/11 tests, 81.82% okay
t/03bindfunc....#<SystemStackError: stack level too
deep>
dubious
Test returned status 255 (wstat 65280, 0xff00)
DIED. FAILED tests 2-6
Failed 5/6 tests, 16.67% okay
t/04iterator....#<SystemStackError: stack level too
deep>
dubious
Test returned status 255 (wstat 65280, 0xff00)
DIED. FAILED tests 1-6
Failed 6/6 tests, 0.00% okay
t/05rb_exc......dubious
Test returned status 0 (wstat 11, 0xb)
DIED. FAILED tests 1-8
Failed 8/8 tests, 0.00% okay
t/06pl_exc......<dummy toplevel>:17: [BUG]
Segmentation fault
ruby 1.9.0 (2008-04-14 revision 17550) [i686-linux]
-- control frame ----------
c:0001 p:0000 s:0002 b:0002 l:000001 d:000001 TOP
<dummy toplevel>:17
---------------------------
-- backtrace of native function call (Use addr2line) --
0x4046310e
0x4039ebd7
0x4039ec0f
0x404266a9
0x40017440
(nil)
-------------------------------------------------------
dubious
Test returned status 0 (wstat 6, 0x6)
DIED. FAILED tests 1-8
Failed 8/8 tests, 0.00% okay
t/07proc........ok
t/08bind1.......ok
t/08bind2.......ok
t/09regex.......dubious
Test returned status 0 (wstat 11, 0xb)
DIED. FAILED test 3
Failed 1/3 tests, 66.67% okay
Failed Test Stat Wstat Total Fail Failed List of
Failed
------------------------------------------------------------
-------------------
t/02iter.t 0 6 11 4 36.36% 10-11
t/03bindfunc.t 255 65280 6 10 166.67% 2-6
t/04iterator.t 255 65280 6 12 200.00% 1-6
t/05rb_exc.t 0 11 8 16 200.00% 1-8
t/06pl_exc.t 0 6 8 16 200.00% 1-8
t/09regex.t 0 11 3 2 66.67% 3
Failed 6/10 test scripts, 40.00% okay. 30/66 subtests
failed, 54.55% okay.
make: *** [test_dynamic] Fout 255
>
> With Ruby 1.8.5 I had random segmentation faults, but
only when the
> module was dynamically loaded. Then I found the post
in
> http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ru
by/ruby-talk/67877 and
> added some calls to Init_stack. After that I didn't
have segfaults,
> but after r15996 came out I got the error
"exception reentered". I
> replaced Init_stack with ruby_init_stack, and then it
worked again
> until r17036 came out - even though it's not using
Init_stack.
I can no longer get it to work with 15996 by replacing
Init_stack with
ruby_init_stack. Maybe I made some error rebuilding Ruby.
Anyway,
apparently the problem is caused by Init_stack and
ruby_init_stack not
doing quite the same thing. This patch to ruby_init_stack
seems to fix
my problem:
--- gc.c (revision 15996)
+++ gc.c (working copy)
 -1641,12
+1641,18 
#endif
)
{
+#if defined(STACK_END_ADDRESS)
+ extern void *STACK_END_ADDRESS;
+ rb_gc_stack_start = STACK_END_ADDRESS;
+#else
+
if (!rb_gc_stack_start ||
STACK_UPPER(&addr,
rb_gc_stack_start > addr,
rb_gc_stack_start < addr)) {
rb_gc_stack_start = addr;
}
+#endif
#ifdef __ia64
if (!rb_gc_register_stack_start ||
(VALUE*)bsp < rb_gc_register_stack_start) {
Perl's Inline::Ruby also works better. At least 'make test'
no longer
gives segmentation faults or SystemStackErrors:
PERL_DL_NONLAZY=1 /usr/bin/perl
"-MExtUtils::Command::MM" "-e"
"test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/01basic.......ok
t/02iter........# Test 11 got: "no block given
(yield)" (t/02iter.t at line 41)
# Expected: "no block given"
# t/02iter.t line 41 is: ok($ ->message, 'no block
given');
FAILED test 11
Failed 1/11 tests, 90.91% okay
t/03bindfunc....ok
t/04iterator....ok
t/05rb_exc......# Test 5 got: "divided by 0n(eval):1:
syntax error,
unexpected $end" (t/05rb_exc.t at line 25 fail #2)
# Expected: "compile errorn(eval): parse
error"
# t/05rb_exc.t line 25 is: ok($x->message,
$exc[$n][0]);
FAILED test 5
Failed 1/8 tests, 87.50% okay
t/06pl_exc......ok
t/07proc........ok
t/08bind1.......ok
t/08bind2.......ok
t/09regex.......ok
Failed Test Stat Wstat Total Fail Failed List of Failed
------------------------------------------------------------
-------------------
t/02iter.t 11 1 9.09% 11
t/05rb_exc.t 8 1 12.50% 5
Failed 2/10 test scripts, 80.00% okay. 2/66 subtests failed,
96.97% okay.
make: *** [test_dynamic] Fout 255
|