Steve
2009-Aug-26 15:20 UTC
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
bill walton
2009-Aug-26 16:38 UTC
Re: Should be simple: Get all levels of stack trace from failed server startup
Hi Steve, On Wed, 2009-08-26 at 08:20 -0700, Steve wrote:> 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
Jeffrey L. Taylor
2009-Aug-27 00:54 UTC
Re: Should be simple: Get all levels of stack trace from failed server startup
Quoting Steve <smueller1245-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>:> > 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: From: Brian Candler <B.Candler pobox.com> Date: Sun, 10 Oct 2004 20:12:29 +0900 References: 115962 In-reply-to: 115962 On Sun, Oct 10, 2004 at 08:02:20PM +0900, Alexey Verkhovsky wrote:> 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.