stack level too deep on ia64

E

Eric Schwartz

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
 
E

Eric Schwartz

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

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
 
T

ts

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
 
E

Eric Schwartz

ts said:
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 ?

49152 (see below)
See the macro CHECK_STACK in gc.c

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
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top