0

I'm having a problem that I'm having trouble diagnosing or reproducing. I'm running a Rails 4.0 app on Puma 2.13 with Rack Timeout 0.2.4 deployed to Heroku on a paid hobby dev plan that should never sleep. I'm finding that when I access the site after a period of inactivity, I'm getting hit with ActionView::Template::Error errors. I haven't had much success diagnosing the root cause of the problem. Additionally, the problem seems to go away after the first hit on the site. So if I let it idle for a few hours and then ping the site, I get this error, but then if I ping it a second time, all is normal.

Here is a sample of one of the errors:

app[web.1]: ActionView::Template::Error (Request waited 15ms, then ran for longer than 29985ms
app[web.1]:   (in /app/app/assets/stylesheets/employers.css.scss)):
app[web.1]:     4:     
app[web.1]:     5:     <%= csrf_meta_tags %>
app[web.1]:     6:
app[web.1]:     7:     <%= stylesheet_link_tag "employers", media: "all" %>
app[web.1]:     8:
app[web.1]:     9:     <!-- Favicon -->
app[web.1]:    10:     <link rel="apple-touch-icon" sizes="57x57" href="/assets/favicons/apple-touch-icon-57x57.png?v=699PWxAblN">
Daniel Bonnell
  • 4,817
  • 9
  • 48
  • 88
  • Do you have rails_12factor gem added? – Troy SK Nov 30 '15 at 16:00
  • Yes, I have that installed already. – Daniel Bonnell Nov 30 '15 at 18:46
  • Did you find a solution to this problem? – Marklar Jul 20 '16 at 00:48
  • Yes. If I recall it was because my static assets weren't all being properly precompiled. Therefore when the server would receive a hit, it would precompile the assets on the fly. If the server was already warmed up it would finish the task just before the timeout window closed. If it was precompiling after a cold start it would timeout before finishing the task. Turns out that even though Heroku paid hobby dynos don't sleep, they do enter into a sort of inactive state after awhile. The solution was to add the missing files to the manifest. – Daniel Bonnell Jul 20 '16 at 17:05

0 Answers0