stack level too deep on ia64

Discussion in 'Ruby' started by Eric Schwartz, Nov 10, 2003.

  1. I'm working on an ia64 box to develop a MySQL/Ruby app, and I'm
    getting not very helpful SystemStackError traces:

    /usr/lib/ruby/1.8/thread.rb:325: stack level too deep (SystemStackError)
    from /usr/lib/ruby/1.8/DBD/Mysql/Mysql.rb:34:in `require'
    from /usr/lib/ruby/1.8/DBD/Mysql/Mysql.rb:34
    from /usr/lib/ruby/1.8/dbi/dbi.rb:465:in `require'
    from /usr/lib/ruby/1.8/dbi/dbi.rb:465:in `load_driver'
    from /usr/lib/ruby/1.8/dbi/dbi.rb:459:in `each'
    from /usr/lib/ruby/1.8/dbi/dbi.rb:459:in `load_driver'
    from /usr/lib/ruby/1.8/dbi/dbi.rb:393:in `_get_full_driver'
    from /usr/lib/ruby/1.8/dbi/dbi.rb:373:in `connect'
    ... 19 levels...
    from /usr/lib/lts/cgi-bin/newplan:169:in `displayNewPlan'
    from /usr/lib/lts/cgi-bin/newplan:168:in `out'
    from /usr/lib/lts/cgi-bin/newplan:168:in `displayNewPlan'
    from /usr/lib/lts/cgi-bin/newplan:275

    so far, my efforts to reproduce this in a simple testcase have failed,
    possibly due to my ignorance of what those missing 19 levels are. How
    can I force ruby to display them?

    -=Eric
     
    Eric Schwartz, Nov 10, 2003
    #1
    1. Advertisements

  2. Okay, to follow up on my own post, I did this in irb:

    irb(main):001:0> begin
    irb(main):002:1* raise SystemStackError
    irb(main):003:1> rescue SystemStackError => sse
    irb(main):004:1> $sse = sse
    irb(main):005:1> end

    and played with $sse and found it has a backtrace() method. So on a
    wild guess, I tried:

    begin
    code_that_raises_sse()
    rescue SystemStackError => sse
    puts "Caught SystemStackError. Backtrace:"
    sse.backtrace.each { |line|
    puts line.to_s
    }
    puts "end of backtrace"
    end

    Unfortunately, all that shows is that the missing 19 lines are a
    perfectly ordinary backtrace that has a bunch of nested calls to a CGI
    object for output. This exact same code works fine on i386, leading
    me to believe this might be somehow related to the thread in:

    http://lists.debian.org/debian-powerpc/2003/debian-powerpc-200310/msg00057.html

    Specifically, this looks suspicious:

    "It's fine as long as the limit on the stacksize is <= 4194303 KiB,
    but dies instantly if the stack size is 4194304 KiB or higher. This
    is the point where more than 32 bits are needed to store an address."

    (in http://lists.debian.org/debian-powerpc/2003/debian-powerpc-200310/msg00070.html)

    I've tried setting the ulimit at 4194303 as suggested, but it still
    fails. Suggestions of how to approach this are welcome.

    $ ruby -v
    ruby 1.8.0 (2003-10-05) [ia64-linux]

    -=Eric
     
    Eric Schwartz, Nov 10, 2003
    #2
    1. Advertisements

  3. Eric Schwartz

    ts Guest

    E> I've tried setting the ulimit at 4194303 as suggested, but it still
    E> fails. Suggestions of how to approach this are welcome.

    What is the value of STACK_LEVEL_MAX ?

    See the macro CHECK_STACK in gc.c
     
    ts, Nov 11, 2003
    #3
  4. 49152 (see below)
    I suspect the interesting bit is actually in Init_stack(), where there
    is this section:

    #ifdef __ia64__
    /* ruby crashes on IA64 if compiled with optimizer on */
    /* when if STACK_LEVEL_MAX is greater than this magic number */
    /* I know this is a kludge. I suspect optimizer bug */
    #define IA64_MAGIC_STACK_LIMIT 49152
    if (STACK_LEVEL_MAX > IA64_MAGIC_STACK_LIMIT)
    STACK_LEVEL_MAX = IA64_MAGIC_STACK_LIMIT;
    #endif

    -=Eric
     
    Eric Schwartz, Nov 11, 2003
    #4
    1. Advertisements

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.