Should be simple: Get all levels of stack trace from failed server startup

Hi,

I am trying to debug another problem that occurs when starting the web
server (either Mongrel or Webrick). The error message it gives me is
useless, because it hides "...22 levels...". Unfortunatly, the first
few lines are inside of active scaffold, and the last few are inside
of the server, leaving me with nothing to debug. How do I view all
lines of this stack trace? I checked the logs, nothing. I tried
starting the server in debug mode and this fails because I am using
Windows.

Thanks,

Steve

Hi Steve,

Hi,

I am trying to debug another problem that occurs when starting the web
server (either Mongrel or Webrick). The error message it gives me is
useless, because it hides "...22 levels...".

You might want to go ahead and post the trace you are getting. Someone
here might have had a similar problem and recognize it.

I tried starting the server in debug mode and this fails because I
am using Windows.

Not sure what you mean by 'fails' here. I just double checked and had
no problem with 'ruby script\server -u'. Say more.

Best regards,
Bill

Quoting Steve <smueller1245@gmail.com>:

Hi,

I am trying to debug another problem that occurs when starting the web
server (either Mongrel or Webrick). The error message it gives me is
useless, because it hides "...22 levels...". Unfortunatly, the first
few lines are inside of active scaffold, and the last few are inside
of the server, leaving me with nothing to debug. How do I view all
lines of this stack trace? I checked the logs, nothing. I tried
starting the server in debug mode and this fails because I am using
Windows.

Google is your friend, search "full stack backtrace in Ruby", 1st result,
follow forum link to first reply:

References: 115962
In-reply-to: 115962

Below is a typical Rails exception thrown from within functional tests.
The interesting part of this exception (test and application code) is
precisely within "... 18 levels..." that are hidden by the interpreter.

Is there any good way to convince Ruby to print full stack trace?

I had the same issue a couple of years ago, and I ended up grepping through
the interpreter C source for the string "levels..." to find it.

Doing so again... it looks like these are hard-coded constants in eval.c

#define TRACE_HEAD 8
#define TRACE_TAIL 5

So you can change these (and recompile ruby). But I think what I did in the
end was just wrap the code with my own exception catcher, since the full
backtrace array is available to you:

def foo(y)
  raise "hell" if y <= 0
  foo(y-1)
end

begin
  foo(75)
rescue Exception => e
  puts "Exception: #{e.class}: #{e.message}\n\t#{e.backtrace.join("\n\t")}"
  exit 1
end

Regards,

Brian.