Application works fairly fast in development mode. Rendering takes around 1 second or less. Something weird is happening if I make some error in the view file. Suddenly, when trying to reload the page, everything freezes for over a minute. As you can see below it took 70sec to render the view - before the error page was displayed. I have no idea, this came out of nowhere. I cannot relate this to including any new gem, though it can be the case.
I开发者_JAVA技巧 have no idea how to debug this issue. There is no error indication in logs, or anywhere for that matter. Ruby is burrning CPU for 100% during that minute, when finally the normal error page is rendered.
Started GET "/settings/galleries/107/photo/new?locale=pl" for 127.0.0.1 at Mon Jan 10 21:01:05 +0100 2011
Processing by PhotosController#new as HTML
Parameters: {"locale"=>"pl", "gallery_id"=>"107"}
User Load (1.1ms) SELECT "users".* FROM "users" WHERE ("users"."id" = 1) LIMIT 1
Gallery Load (0.5ms) SELECT "galleries".* FROM "galleries" WHERE ("galleries".user_id = 1) AND ("galleries"."id" = 107) LIMIT 1
Gallery Load (0.5ms) SELECT "galleries".* FROM "galleries" WHERE ("galleries"."id" = 107) LIMIT 1
Rendered photos/_photo_location.html.haml (2.2ms)
Rendered photos/new.html.haml within layouts/settings (81704.3ms)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Completed in 81714ms
ActionView::Template::Error (undefined method `text_are' for #<ActionView::Helpers::FormBuilder:0x11495988>):
64: = form_for @photo, :url => settings_create_photo_path(@photo.gallery) do |f|
65: = f.file_field :image
66: = f.submit _('Start upload')
67: = f.text_are :desc
68: .clearboth= nbsp
69:
Update:
Problem comes either from a bad gem, or a wierd codding error. Either way, I am not looking for a suggestion where the problem is.
What I need is a suggestion how to debug this issue. So far there is no indication what is happning during that minute. No single message and ruby burns CPU. Only thing I can do is to strace the ruby process, which I will try anyway, but I know from experience that this leads to nothing in most cases.
Can you advice some gem or any other debug method to see what is going on during that invalid template rendering?
Module translate_routes was responsible. Removing the line:
ActionDispatch::Routing::Translator.translate_from_file('config','i18n-routes.yml')
solves the problem.
精彩评论