Project

General

Profile

Actions

Bug #4047

closed

Embedded Ruby issues

Added by garthy (Garthy X) over 13 years ago. Updated almost 13 years ago.

Status:
Third Party's Issue
Assignee:
-
Target version:
ruby -v:
ruby 1.9.3dev (2010-11-10 trunk 29738) [i686-linux]
Backport:
[ruby-core:33147]

Description

=begin
These bug(s) have been around since at least early 2007. I've updated the test code I'd developed to demonstrate them to work with the latest Ruby code. I'm passing it on in case it is useful to someone. To try it for yourself, edit the Makefile to contain the right paths, run make, then "./foo".

The included program ("foo") simulates making Ruby calls at various stack depths. If you build this against the nightly and stable snapshots as of 20101112 (Australia), you'll get a very fast crash (see [1] for output). Some notes:

  • You can disable the use of Ruby with the "-b" flag. This causes the program to begin working, and can be used to confirm the rest of the program is fine, it's just the Ruby calls causing problems.

  • You can disable the call to the Ruby garbage collector with the "-c" flag. This causes the program to last longer, but if I recall correctly, it'll crash eventually.

  • You can disable the stack depth changing with the "-s" flag. This used to stop the problem from occurring (ie. showing the bug manifested only in changing stack depths), but presently doesn't stop it from crashing.

If the cause of the fast crash is found, try rerunning "foo" again, and leaving it running for a while. With Ruby calls enabled (no flags), it used to crash eventually. With the calls disabled, it used to pretty-much run indefinitely. The problem used to only occur when you used "-pg". Based on the new behaviour I am guessing there are multiple bugs.

The code included simulates use in a real program, which may call the Ruby code from different stack depths. When trying to embed Ruby code in a reliable program, it became crash-prone immediately, and behaved again when I disabled it. I tried making a start diagnosing the problem some years ago, but was hopelessly out of my depth.

I hope this is of use to someone. Good luck.

[1]:

Messy enabled. Ruby enabled. Verbose disabled. GC enabled.
Rand vals enabled. Rand stack size enabled.
Empty test...
Initialising...
Thrashing...
0: 12: [BUG] Segmentation fault
ruby 1.9.3dev (2010-11-10 trunk 29738) [i686-linux]

-- Control frame information -----------------------------------------------
c:0001 p:0000 s:0002 b:0002 l:000dc4 d:000dc4 TOP

-- C level backtrace information -------------------------------------------
./foo [0x816afcd]
./foo [0x8066229]
./foo [0x80662d8]
./foo [0x80fd978]
[0x8fd410]
./foo [0x815985e]
./foo [0x8162ff0]
./foo [0x804c707]
./foo [0x804c725]
./foo [0x804c9e5]
./foo [0x804c98f]
./foo [0x804c98f]
./foo [0x804c98f]
./foo [0x804c98f]
./foo [0x804c98f]
./foo [0x804c98f]
./foo [0x804c98f]
./foo [0x804c98f]
./foo [0x804cb63]
./foo [0x804d2a7]
/lib/tls/i686/cmov/libc.so.6(__libc_start_main+0xe6) [0xe8db56]
./foo [0x804c361]

-- Other runtime information -----------------------------------------------

SEGV received in SEGV handler
=end


Files

crashtest-20101112.tgz (2.17 KB) crashtest-20101112.tgz garthy (Garthy X), 11/12/2010 02:14 PM
crashtest-20101115a.tgz (2.49 KB) crashtest-20101115a.tgz garthy (Garthy X), 11/15/2010 11:36 AM
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0