ruby-1.8.2: test.rb: Seg Fault in test_check "exception"

Discussion in 'Ruby' started by me2faster@excite.com, Jul 8, 2005.

  1. Guest

    I reduced the sample/test.rb to just the test_check "exception"
    section, and discovered that rb_raise_jump() in eval.c is trying to
    assign from _frame.prev or _frame.prev->prev, which have not been
    memory allocated correctly. With the original source in place, the seg
    fault occurs at:

    *ruby_frame = *_frame.prev->prev;

    if I break it down into member-to-member assignments, the seg fault
    occurs at:

    ruby_frame->tmp = (*_frame.prev->prev).tmp;

    Here's the stack trace:

    ....
    :c
    Continuing.
    exception

    Breakpoint 2, rb_raise_jump (mesg=134598224)
    at /home/ruby-1.8.2/eval.c:4475
    4475 ruby_frame->tmp =
    (*_frame.prev->prev).tmp;
    :c
    Continuing.
    mytest.rb:30: [BUG] Segmentation fault
    ruby 1.8.2 (2004-12-25) [nsr-nsk]

    Process (3,994) received signal/trap type: 1 (number: 6)
    :bt
    #0 0xffffffffe101d900 in $n_EnterPriv ()
    #1 0xffffffffe5071ef0 in raise ()
    #2 0xffffffffe5072da0 in PK_ABORT_ ()
    #3 0xffffffffff7dc100 in abort ()
    #4 0x704018e0:0 in rb_bug (fmt=0x700313b0 "Segmentation fault")
    at /home/ruby-1.8.2/error.c:214
    #5 0x702f7690:0 in sigsegv (sig=11) at /home/ruby-1.8.2/signal.c:446
    #6 0xffffffffe4419710 in $UD_S__SigHandlerJacket ()
    #7 0x7006b050:1 in rb_raise_jump (mesg=134598224)
    at /home/ruby-1.8.2/eval.c:4475
    #8 0x7006a080:0 in rb_f_raise (argc=1, argv=0x80a7f00)
    at /home/ruby-1.8.2/eval.c:4408
    #9 0x70078440:0 in call_cfunc (func=0x8018590 <_initz+15808>,
    recv=134672144,
    len=-1, argc=1, argv=0x80a7f00) at /home/ruby-1.8.2/eval.c:5408
    #10 0x7007f3a0:0 in rb_call0 (klass=134677928, recv=134672144, id=3953,
    oid=3953, argc=1, argv=0x80a7f00, body=0x806e400, nosuper=0)
    at /home/ruby-1.8.2/eval.c:5543
    #11 0x700832e0:0 in rb_call (klass=134677928, recv=134672144, mid=3953,
    argc=1, argv=0x80a7f00, scope=1) at /home/ruby-1.8.2/eval.c:5764
    #12 0x7005a690:0 in rb_eval (self=134672144, n=0x805c538)
    at /home/ruby-1.8.2/eval.c:3249
    #13 0x70055bc0:0 in rb_eval (self=134672144, n=0x805d240)
    at /home/ruby-1.8.2/eval.c:3041


    me2faster at excite dot com
     
    , Jul 8, 2005
    #1
    1. Advertising

  2. Hi,

    In message "Re: ruby-1.8.2: test.rb: Seg Fault in test_check "exception""
    on Fri, 8 Jul 2005 08:40:47 +0900, writes:

    |I reduced the sample/test.rb to just the test_check "exception"
    |section, and discovered that rb_raise_jump() in eval.c is trying to
    |assign from _frame.prev or _frame.prev->prev, which have not been
    |memory allocated correctly. With the original source in place, the seg
    |fault occurs at:
    |
    |*ruby_frame = *_frame.prev->prev;

    We need more information, your platform, CPU, OS and others, with the
    command line argument to configure script. The more information the
    better. I'm afraid that some part of Ruby (especially GC) requires
    special platform treatment, and you hit the point.

    matz.
     
    Yukihiro Matsumoto, Jul 13, 2005
    #2
    1. Advertising

  3. Guest

    It's an HP Integrity NonStop server, using Intel Itanium 2 Processor,
    running a POSIX based OS. Here are the environment variables that I
    had set prior to calling ./configure:

    CFLAGS=-g -Wnowarn -D_TANDEM_SOURCE -D_XOPEN_SOURCE_EXTENDED=1
    -D_SIGMAX=44 -Woptimize=0
    DLDFLAGS=-ul -obey /usr/lib/libc.txt -L . -L ../.. -L /G/system/zdll049
    -lzrlddll
    LOCAL_LIBS=-l${LIBRUBY_A}
    LDSHARED = eld

    Do you want me to post a copy of the (very long) config.log file ?
     
    , Jul 13, 2005
    #3
  4. Hi,

    In message "Re: ruby-1.8.2: test.rb: Seg Fault in test_check "exception""
    on Wed, 13 Jul 2005 18:00:50 +0900, writes:

    |It's an HP Integrity NonStop server, using Intel Itanium 2 Processor,
    |running a POSIX based OS. Here are the environment variables that I
    |had set prior to calling ./configure:

    Hmm, Itanium. Is it possible for you to try out our latest snapshot
    from ftp://ftp.ruby-lang.org/pub/ruby/stable-snapshot.tar.gz ?

    |Do you want me to post a copy of the (very long) config.log file ?

    config.h is enough for us.

    matz.
     
    Yukihiro Matsumoto, Jul 13, 2005
    #4
  5. Guest

    Here's my config.h:

    #define PACKAGE_NAME ""
    #define PACKAGE_TARNAME ""
    #define PACKAGE_VERSION ""
    #define PACKAGE_STRING ""
    #define PACKAGE_BUGREPORT ""
    #define STDC_HEADERS 1
    #define HAVE_SYS_TYPES_H 1
    #define HAVE_SYS_STAT_H 1
    #define HAVE_STDLIB_H 1
    #define HAVE_STRING_H 1
    #define HAVE_MEMORY_H 1
    #define HAVE_STRINGS_H 1
    #define HAVE_STDINT_H 1
    #define HAVE_UNISTD_H 1
    #define HAVE_LONG_LONG 1
    #define HAVE_OFF_T 1
    #define SIZEOF_INT 4
    #define SIZEOF_SHORT 2
    #define SIZEOF_LONG 4
    #define SIZEOF_LONG_LONG 8
    #define SIZEOF___INT64 0
    #define SIZEOF_OFF_T 4
    #define SIZEOF_VOIDP 4
    #define SIZEOF_FLOAT 4
    #define SIZEOF_DOUBLE 8
    #define SIZEOF_TIME_T 4
    #define HAVE_PROTOTYPES 1
    #define TOKEN_PASTE(x,y) x##y
    #define HAVE_STDARG_PROTOTYPES 1
    #define NORETURN(x) x
    #define HAVE_DECL_SYS_NERR 0
    #define HAVE_DIRENT_H 1
    #define STDC_HEADERS 1
    #define HAVE_SYS_WAIT_H 1
    #define HAVE_STDLIB_H 1
    #define HAVE_STRING_H 1
    #define HAVE_UNISTD_H 1
    #define HAVE_LIMITS_H 1
    #define HAVE_SYS_IOCTL_H 1
    #define HAVE_FCNTL_H 1
    #define HAVE_SYS_TIME_H 1
    #define HAVE_SYS_TIMES_H 1
    #define HAVE_SYS_PARAM_H 1
    #define HAVE_PWD_H 1
    #define HAVE_GRP_H 1
    #define HAVE_UTIME_H 1
    #define HAVE_MEMORY_H 1
    #define HAVE_SYS_RESOURCE_H 1
    #define HAVE_NETINET_IN_SYSTM_H 1
    #define HAVE_FLOAT_H 1
    #define HAVE_IEEEFP_H 1
    #define HAVE_STRUCT_STAT_ST_RDEV 1
    #define HAVE_ST_RDEV 1
    #define GETGROUPS_T gid_t
    #define RETSIGTYPE void
    #define C_ALLOCA 1
    #define STACK_DIRECTION -1
    #define HAVE_DUP2 1
    #define HAVE_MEMMOVE 1
    #define HAVE_MKDIR 1
    #define HAVE_STRCASECMP 1
    #define HAVE_STRNCASECMP 1
    #define HAVE_STRERROR 1
    #define HAVE_STRFTIME 1
    #define HAVE_STRCHR 1
    #define HAVE_STRSTR 1
    #define HAVE_STRTOUL 1
    #define HAVE_CRYPT 1
    #define HAVE_VSNPRINTF 1
    #define HAVE_ISNAN 1
    #define HAVE_FINITE 1
    #define HAVE_HYPOT 1
    #define HAVE_ACOSH 1
    #define HAVE_ERF 1
    #define HAVE_FMOD 1
    #define HAVE_WAITPID 1
    #define HAVE_CHROOT 1
    #define HAVE_FSYNC 1
    #define HAVE_GETCWD 1
    #define HAVE_TIMES 1
    #define HAVE_FCNTL 1
    #define HAVE_LSTAT 1
    #define HAVE_SYMLINK 1
    #define HAVE_READLINK 1
    #define HAVE_PAUSE 1
    #define HAVE_GETPGRP 1
    #define HAVE_GETPGID 1
    #define HAVE_SETPGID 1
    #define HAVE_GETGROUPS 1
    #undef HAVE_GETPRIORITY
    #define HAVE_SIGPROCMASK 1
    #define HAVE_SIGACTION 1
    #define HAVE__SETJMP 1
    #define HAVE_SETSID 1
    #define HAVE_TELLDIR 1
    #define HAVE_SEEKDIR 1
    #define HAVE_MKTIME 1
    #define HAVE_COSH 1
    #define HAVE_SINH 1
    #define HAVE_TANH 1
    #define HAVE_SETUID 1
    #define HAVE_SETGID 1
    #define HAVE_TZNAME 1
    #define HAVE_DAYLIGHT 1
    #define NEGATIVE_TIME_T 1
    #define POSIX_SIGNAL 1
    #define GETPGRP_VOID 1
    #define SETPGRP_VOID 1
    #define WORDS_BIGENDIAN 1
    #define __CHAR_UNSIGNED__ 1
    #ifndef __cplusplus
    #define inline
    #endif
    #define RSHIFT(x,y) ((x)>>(int)y)
    #define FILE_COUNT _cnt
    #define FILE_READPTR _ptr
    #define NEED_IO_SEEK_BETWEEN_RW 1
    #define STACK_GROW_DIRECTION -1
    #define DEFAULT_KCODE KCODE_NONE
    #define USE_ELF 1
    #define DLEXT ".so"
    #define RUBY_LIB "/usr/local/lib/ruby/1.8"
    #define RUBY_SITE_LIB "/usr/local/lib/ruby/site_ruby"
    #define RUBY_SITE_LIB2 "/usr/local/lib/ruby/site_ruby/1.8"
    #define RUBY_PLATFORM "nsr-nsk"
    #define RUBY_ARCHLIB "/usr/local/lib/ruby/1.8/nsr-nsk"
    #define RUBY_SITE_ARCHLIB "/usr/local/lib/ruby/site_ruby/1.8/nsr-nsk"

    #ifdef _TANDEM_SOURCE
    typedef unsigned int u_word32;
    #endif


    me2faster at excite dot com
     
    , Jul 13, 2005
    #5
  6. Guest

    Hi,

    I tried building with the latest snapshot as mentioned above, but got
    the same results as mentioned in the root of this message thread, and
    is consistent with my earlier posting (Message ID:
    ):

    ....
    ok 8
    exception
    ../test.rb:593: [BUG] Segmentation fault
    ruby 1.8.3 (2005-07-14) []

    Process (5,342) received signal/trap type: 1 (number: 6)
    (eInspect 5,342):bt
    #0 0xffffffffe101dd60 in $n_EnterPriv ()
    #1 0xffffffffe5072e70 in raise ()
    #2 0xffffffffe5073d20 in PK_ABORT_ ()
    #3 0xffffffffff7dc100 in abort ()
    #4 0x7040ca00:0 in rb_bug (fmt=0x70031ae0 "Segmentation fault")
    at /home/ruby/error.c:214
    #5 0x703025b0:0 in sigsegv (sig=11) at /home/ruby/signal.c:447
    #6 0xffffffffe441a7d0 in $UD_S__SigHandlerJacket ()
    #7 0x7006ccd0:1 in rb_raise_jump (mesg=134956720)
    at /home/ruby/eval.c:4592
    #8 0x7006bd00:0 in rb_f_raise (argc=1, argv=0x812c3d0)
    at /home/ruby/eval.c:4535
    #9 0x7007a1a0:0 in call_cfunc (func=0x8018e20 <_initz+17888>,
    recv=134672048,
    len=-1, argc=1, argv=0x812c3d0) at /home/ruby/eval.c:5528
    #10 0x700814c0:0 in rb_call0 (klass=134677928, recv=134672048, id=3969,
    oid=3969, argc=1, argv=0x812c3d0, body=0x806e3a0, nosuper=0)
    at /home/ruby/eval.c:5665
    #11 0x70085700:0 in rb_call (klass=134677928, recv=134672048, mid=3969,
    argc=1, argv=0x812c3d0, scope=1) at /home/ruby/eval.c:5886
    #12 0x7005bd10:0 in rb_eval (self=134672048, n=0x8106ca0)
    at /home/ruby/eval.c:3377
    #13 0x70057610:0 in rb_eval (self=134672048, n=0x805d198)
    at /home/ruby/eval.c:3177
    ---Type <return> to continue, or q <return> to quit---
    #14 0x70041390:0 in eval_node (self=134672048, node=0x805d198)
    at /home/ruby/eval.c:1360
    #15 0x70043080:0 in ruby_exec_internal () at /home/ruby/eval.c:1535
    #16 0x700432f0:0 in ruby_exec () at /home/ruby/eval.c:1555
    #17 0x700433f0:0 in ruby_run () at /home/ruby/eval.c:1565
    #18 0x70035d50:0 in main (argc=3, argv=0x8031000, envp=0x803102a)
    at /home/ruby/main.c:46
    ....

    me2faster at excite dot com
     
    , Jul 14, 2005
    #6
  7. Hi,

    In message "Re: ruby-1.8.2: test.rb: Seg Fault in test_check "exception""
    on Thu, 14 Jul 2005 05:00:51 +0900, writes:

    |#define RUBY_PLATFORM "nsr-nsk"

    You've said the CPU was Itanium, but configure says it nsr, so that I'm
    afraid Itanium support code in gc.c is not working at all.

    matz.
     
    Yukihiro Matsumoto, Jul 14, 2005
    #7
  8. Guest

    So, what do I specify as the --build="" argument to ./configure in
    order for the Itanium support to be utilized?


    me2faster at excite dot com
     
    , Jul 14, 2005
    #8
  9. Hi,

    In message "Re: ruby-1.8.2: test.rb: Seg Fault in test_check "exception""
    on Thu, 14 Jul 2005 17:10:51 +0900, writes:

    |So, what do I specify as the --build="" argument to ./configure in
    |order for the Itanium support to be utilized?

    The current implementation requires the constant __ia64__ to be
    defined on the Itanium processor. Besides that we need proper
    <ucontext.h> and <unwind.h> or __libc_ia64_register_backing_store_base;

    If you have Boehm's GC or Guile Scheme interpreter run on your
    machine, let me know.
    matz.
     
    Yukihiro Matsumoto, Jul 14, 2005
    #9
  10. Guest

    Hi,

    I tried to re-build with the closest build-type I could find in
    config.guess "x86_64" and used "-D__ia64__" in CFLAGS, but ran into:

    /usr/bin/c89 -g -Wnowarn -D__ia64__ -D_TANDEM_SOURCE
    -D_XOPEN_SOURCE_EXTENDED=1
    -D_SIGMAX=44 -Woptimize=0 -I. -I. -c eval.c
    top = (VALUE*)ctx.uc_mcontext.sc_ar_bsp;
    ^
    "/home/ruby/eval.c", line 9998: error(1565): struct "mcontext" has no
    field "sc_ar_bsp"


    This is because my local version of ucontext.h contains:

    ....
    typedef int greg_t;
    typedef greg_t gregset_t[38];

    typedef struct mcontext
    {
    gregset_t gpregs;
    } mcontext_t;

    typedef struct ucontext
    {
    mcontext_t uc_mcontext;
    } ucontext_t;
    ....

    I don't have Boehm's GC or Guile Scheme interpreter on my machine, so
    now I'm stuck.
     
    , Jul 14, 2005
    #10
  11. Hi,

    In message "Re: ruby-1.8.2: test.rb: Seg Fault in test_check "exception""
    on Fri, 15 Jul 2005 05:30:52 +0900, writes:

    |I tried to re-build with the closest build-type I could find in
    |config.guess "x86_64" and used "-D__ia64__" in CFLAGS, but ran into:
    |
    |/usr/bin/c89 -g -Wnowarn -D__ia64__ -D_TANDEM_SOURCE
    |-D_XOPEN_SOURCE_EXTENDED=1
    |-D_SIGMAX=44 -Woptimize=0 -I. -I. -c eval.c
    | top = (VALUE*)ctx.uc_mcontext.sc_ar_bsp;
    | ^
    |"/home/ruby/eval.c", line 9998: error(1565): struct "mcontext" has no
    | field "sc_ar_bsp"
    |
    |This is because my local version of ucontext.h contains:

    Can you find any reference to ucontext.h, especially mcontext structure
    on your machine?

    matz.
     
    Yukihiro Matsumoto, Jul 15, 2005
    #11
  12. Guest

    Hi,

    This is all that I can find that's related to ucontext and mcontext:

    #define GREG_S0 3
    #define GREG_S1 4
    #define GREG_S2 5
    #define GREG_S3 6
    #define GREG_S4 7
    #define GREG_S5 8
    #define GREG_S6 9
    #define GREG_S7 10
    #define GREG_S8 11
    #define GREG_SP 12
    #define GREG_GP 13
    #define GREG_RA 14

    typedef int greg_t;
    typedef greg_t gregset_t[38];

    typedef struct mcontext
    {
    gregset_t gpregs;
    } mcontext_t;

    typedef struct ucontext
    {
    mcontext_t uc_mcontext;
    } ucontext_t;


    me2faster at excite dot com
     
    , Jul 15, 2005
    #12
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Vinod

    Suprising seg fault!!!

    Vinod, Sep 27, 2003, in forum: C++
    Replies:
    3
    Views:
    489
    Ron Natalie
    Sep 27, 2003
  2. Corrine
    Replies:
    1
    Views:
    442
    Gianni Mariani
    Nov 27, 2003
  3. Cynthia Jeness
    Replies:
    3
    Views:
    246
    Cynthia Jeness
    Dec 14, 2006
  4. Replies:
    4
    Views:
    176
  5. Sébastien Dabet

    Seg fault on Thread.new with ruby 1.8.6

    Sébastien Dabet, May 7, 2009, in forum: Ruby
    Replies:
    2
    Views:
    112
    Sébastien Dabet
    May 11, 2009
Loading...

Share This Page