views:

164

answers:

1

After I touch tmp/restart.txt and my app restarts, the first request throws an error, usually something about not finding Haml::Engine or some other gem. The second and subsequent requests all work fine. I was having this problem on Dreamhost which was running Rack 0.4.1 and Sinatra 0.3.3 but after moving to my own host and running a newer Rack (0.9.1) and Sinatra (0.9.0.4) I still see the problem.

If you don't know the exact answer but have tips on how I could track it down, please let me know.

Here's my config.ru:

require 'rubygems'
require 'sinatra'

disable :run
set :environment, :production
set :raise_errors, true

require 'app.rb'
run Sinatra::Application
+2  A: 

I'd look into making sure you're requiring all the necessary gems. Perhaps there's something about the order you're doing it that's causing it to fail the first time. Are you requiring rubygems?

It might also help if you posted your rack configuration for the app (config.ru).

thenduks
Yes, I'm requiring rubygems and it runs fine standalone or running rackup manually. I added my config.ru to the original question as you suggested. It's almost like Passenger doesn't restart the app until the first request comes in and that request hits a sync issue because it's still coming up.
Brian Deterling
Everything looks fine with your rack config. The only thing left to suggest is trying a basic hello world app and seeing if the same thing happens. Seems like since your app shows the same problem on multiple hosts that it's something to do with your app itself. Maybe also update all your gems?
thenduks
Hadn't looked at this in a while but now I don't seem to have the problem and the only thing I can think of is I'm running a newer version of Sinatra (0.9.1.1), and since you mentioned updating gems, you get the checkmark by default.
Brian Deterling
No complaints here :). Glad you got it working.
thenduks