I installed Apache, Passenger and Sinatra and deployed an app. It gives error when trying to access:
An error occurred while starting up the preloader: it did not write a startup response in time.
Application root
/var/www/html/test
Environment (value of RAILS_ENV, RACK_ENV, WSGI_ENV and PASSENGER_ENV)
production
Ruby interpreter command
/usr/local/bin/ruby
User and groups
Unknown
Environment variables
Unknown
Ulimits
Unknown
How can I solve it?
Edit
In the application log, I found this line of error:
!> Ready
!> socket: unix:/tmp/passenger.1.0.14019/generation-0/backends/preloader.14049
!>
Gem list:
bigdecimal (1.2.0)
builder (3.2.0)
bundler (1.3.1)
daemon_controller (1.1.1)
fastthread (1.0.7)
io-console (0.4.2)
json (1.7.7)
minitest (4.3.2)
passenger (4.0.0.rc4)
psych (2.0.0)
rack (1.5.2)
rack-protection (1.4.0)
rake (0.9.6)
rdoc (4.0.0)
sequel (3.45.0)
sinatra (1.3.5)
test-unit (2.0.0.0)
tilt (1.3.4)
System version:
Ruby 2.0
Apache 2.2
Amazon EC2 Instance
The app was running fine with Ruby 1.9 and Passenger 3.0. I just upgraded to 2.0, and Passenger 3.0 does not even compile correctly. They suggested me to use Passenger Pre 4.0, and it compiled fine, but does not run the app...
This error means there is a problem on the server side. A server error can be caused by any number of things from uploading the incorrect file to as bug in a piece of code. This error response is a generic "catch-all" response.
The 500 Internal Server error could be caused by an error during the execution of any policy within Edge or by an error on the target/backend server. The HTTP status code 500 is a generic error response. It means that the server encountered an unexpected condition that prevented it from fulfilling the request.
I found the answer what is causing it in my case. In my config.ru
I was redirecting STDOUT
like this:
log = File.new("logs/std.log", "a+")
STDOUT.reopen(log)
Removing the redirect into the log and it starts up again.
Looks like passenger needs STDOUT
to detect a working "preloader".
Edit: I'm currently using the following solution to redirect the log into a file and keep passenger happy (basically just duplicating stdout into the log file and not redirecting):
log = File.new("logs/std.log", "a+")
def STDOUT.write string
log.write string
super
end
STDOUT.sync = true
In case the above doesn't solve it for you, I had the exact same error message with a different cause.
In my case, we were using an external database server and that had gone down.
Bringing the external db server back up fixed the issue.
But before we solved this, we spent a bunch of time thinking about recompiling passenger, etc.
Hope this note saves someone some time.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With