In certain scenarios, when there is an error in code (usually a misnamed variable in a partial, but it could be something else as well), I get 504 Timeout from nginx instead of expected stack trace (on development environment).

It also seems that specs stall on the same errors (instead of instantly reporting "failed").

Any ideas about what I should look into or what could possibly be wrong with my setup would be helpful.

I'm using Ruby on Rails 3.1.

有帮助吗?

解决方案

Are you using any kind of exception catching or exception notification? It could be in your code, in a library that you reference, or in a gem that you reference.

If you are, disable it (comment it out, etc.) and see what you get.

If you are running in production, switch to development if you can.


Many people frown on this method of troubleshooting but one of the other things I sometimes do is pepper my code with lines that append to a status file (in the format <DATE> <TIME> - <MESSAGE>. By seeing what is written to the file after each request, I can find where the issue is.

You could do something this:

def debug(filename, message)
  File.open(filename, 'a') {|f| f.write("#{Time.now} - #{message}") }
end

Calling debug('/tmp/log.txt','Test Message') would show something like this:

2011-12-29 23:31:51 -0500 - Test Message
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top