Passenger 4 + Nginx Won't Start Rails App - ruby-on-rails

I've just installed passenger + nginx on a brand new Ubuntu 13.04 box, and trying to run an app that runs great on several other servers.
Every time I try to run the app in production, I get:
An error occurred while starting up the preloader: it did not write a startup response in time.
Application root
/home/avishai/apps/XXX/current
Environment (value of RAILS_ENV, RACK_ENV, WSGI_ENV and PASSENGER_ENV)
production
Ruby interpreter command
/home/avishai/.rvm/wrappers/ruby-1.9.3-p448/ruby
User and groups
Unknown
Environment variables
Unknown
Ulimits
Unknown
Passenger is able to load the app in development mode, but not production. The nginx error log shows the following:
[ 2013-08-14 17:09:14.8321 17810/7f99daebd700 Pool2/Spawner.h:738 ]: [App 17843 stdout]
[ 2013-08-14 17:10:44.8406 17810/7f99daebd700 Pool2/Implementation.cpp:774 ]: Could not spawn process for group /home/avishai/apps/XXX/current#default: An error occurred while starting up the preloader: it did not write a startup response in time.
in 'void Passenger::ApplicationPool2::SmartSpawner::throwPreloaderSpawnException(const string&, Passenger::SpawnException::ErrorKind, Passenger::ApplicationPool2::Spawner::BackgroundIOCapturerPtr&, const DebugDirPtr&)' (SmartSpawner.h:150)
in 'std::string Passenger::ApplicationPool2::SmartSpawner::negotiatePreloaderStartup(Passenger::ApplicationPool2::SmartSpawner::StartupDetails&)' (SmartSpawner.h:558)
in 'void Passenger::ApplicationPool2::SmartSpawner::startPreloader()' (SmartSpawner.h:206)
in 'virtual Passenger::ApplicationPool2::ProcessPtr Passenger::ApplicationPool2::SmartSpawner::spawn(const Passenger::ApplicationPool2::Options&)' (SmartSpawner.h:744)
in 'void Passenger::ApplicationPool2::Group::spawnThreadRealMain(const SpawnerPtr&, const Passenger::ApplicationPool2::Options&, unsigned int)' (Implementation.cpp:707)
[ 2013-08-14 17:10:44.8409 17810/7f99d8f9e700 agents/HelperAgent/RequestHandler.h:1888 ]: [Client 20] Cannot checkout session. An error occurred while starting up the preloader: it did not write a startup response in time.
[ 2013-08-14 17:10:44.8412 17810/7f99d8f9e700 agents/HelperAgent/RequestHandler.h:1888 ]: [Client 21] Cannot checkout session. An error occurred while starting up the preloader: it did not write a startup response in time.
I'm at a dead-end. How can I get the app to load?

Related

Could not spawn process for application NGINX+ PASSENGER ERROR

Hi I'm using Nginx + Passenger
I'm stuck in the issue.
[ E 2020-09-20 09:32:51.5408 14555/To age/Cor/App/Implementation.cpp:221 ]: Could not spawn process for application /home/xxxxxxx: A timeout occurred while starting a preloader process.
Error ID: 55f4b7bd
Error details saved to: /tmp/passenger-error-6SSEIC.html
[ E 2020-09-20 09:32:51.5478 14555/T8 age/Cor/Con/CheckoutSession.cpp:276 ]: [Client 1-2] Cannot checkout session because a spawning error occurred. The identifier of the error is 55f4b7bd. Please see earlier logs for details about the error.
sudo nano /etc/nginx/passenger.conf
passenger_root /usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini;
passenger_ruby /home/deploy/.rbenv/shims/ruby;

Passenger v5.2.0 inside Alpine v3.7 Docker container - SIGSEGV(11)

I have been working on creating a minimal Rails GraphQL docker container based on Alpine 3.7 running Passenger 5.2.0. Unfortunately, Passenger keeps crashing and I am unsure what the cause is.
This is the head of the Passenger log file
[ N 2018-02-06 16:40:25.3740 14/T1 age/Wat/WatchdogMain.cpp:1252 ]: Starting Passenger watchdog...
[ N 2018-02-06 16:40:25.4056 17/T1 age/Cor/CoreMain.cpp:1242 ]: Starting Passenger core...
[ N 2018-02-06 16:40:25.4059 17/T1 age/Cor/CoreMain.cpp:252 ]: Passenger core running in multi-application mode.
[ N 2018-02-06 16:40:25.4244 17/T1 age/Cor/CoreMain.cpp:977 ]: Passenger core online, PID 17
App 55 stdout:
[ pid=17, timestamp=1517935227 ] Process aborted! signo=SIGSEGV(11), reason=SI_KERNEL, si_addr=0x0, randomSeed=1517935225
And this is the end of the Passenger log file
[ W 2018-02-06 16:27:28.8642 14/T4 age/Wat/AgentWatcher.cpp:97 ]: Passenger core (pid=17) crashed with signal SIGSEGV, restarting it...
2018/02/06 16:27:28 [error] 38#0: *4 upstream prematurely closed connection while reading response header from upstream, client: 127.0.0.1, server: _, request: "HEAD / HTTP/1.1", upstream: "passenger:unix:/app/current/tmp/passenger.pnTbJGQ/agents.s/core:", host: "0.0.0.0"
[ N 2018-02-06 16:27:28.8808 86/T1 age/Cor/CoreMain.cpp:1242 ]: Starting Passenger core...
[ N 2018-02-06 16:27:28.8812 86/T1 age/Cor/CoreMain.cpp:252 ]: Passenger core running in multi-application mode.
[ N 2018-02-06 16:27:28.9032 86/T1 age/Cor/CoreMain.cpp:977 ]: Passenger core online, PID 86
Lastly, here are the relevant files (including the Passenger log with backtrace, Dockerfile, etc)
https://gist.github.com/nater540/c22414d21bf22a990a474c93936b7c06
If anyone has any suggestions or insight that would be absolutely fantastic!

My ROR+Nginx+Passenger+AWS is sending 502 bad gateway

I am developing android service with ROR+Nginx+passenger and Amazon Web service.
The server goes well, but yesterday the server suddenly got downed.
I've tried to solve the problem, but I couldn't.
Here's my problem.
First, the EC2 instance's log/production.log doesn't write any log.
I can get 502 bad gateway error message in my android app log.
Second, all requests including http, https are responded by 502 badgateway.
Third, my AWS load balancer is logging 50X error.
I guess this problem is about ELB, but I don't know how to solve.
I have ssl certificate, and I have only one EC2 instance.
Any help will be appreciated.
Edited
2017-02-22 00:22:30.9139 25313/7f222067b700 age/Cor/Con/CheckoutSession.cpp:269 ]: [Client 1-356202] Returning HTTP 503 due to: Request queue full (configured max. size: 100)
[ 2017-02-22 00:24:00.3704 25313/7f221ee09700 age/Cor/App/Implementation.cpp:304 ]: Could not spawn process for application /home/ec2-user/popcake: An error occurred while starting up the preloader: it did not write a startup response in time.
Error ID: 10045ede
Error details saved to: /tmp/passenger-error-JS1Bnt.html
Message from application: An error occurred while starting up the
preloader: it did not write a startup response in time. Please read this article for more information about this problem.<br>
<h2>Raw process output:</h2>
(empty)
[ 2017-02-22 00:24:00.4527 25313/7f222067b700 age/Cor/Con/CheckoutSession.cpp:285 ]: [Client 1-353433] Cannot checkout session because a spawning error occurred. The identifier of the error is 10045ede. Please see earlier logs for details about the error.
[ 2017-02-22 00:30:29.0872 25313/7f222067b700 age/Cor/CoreMain.cpp:532 ]: Signal received. Gracefully shutting down... (send signal 2 more time(s) to force shutdown)
[ 2017-02-22 00:30:29.1173 25313/7f2227bfc840 age/Cor/CoreMain.cpp:901 ]: Received command to shutdown gracefully. Waiting until all clients have disconnected...
[ 2017-02-22 00:30:29.1174 25313/7f221fe7a700 Ser/Server.h:817 ]: [ApiServer] Freed 0 spare client objects
[ 2017-02-22 00:30:29.1174 25313/7f221fe7a700 Ser/Server.h:464 ]: [ApiServer] Shutdown finished
[ 2017-02-22 00:30:29.2400 25318/7f77237e2700 age/Ust/UstRouterMain.cpp:422 ]: Signal received. Gracefully shutting down... (send signal 2 more time(s) to force shutdown)
[ 2017-02-22 00:30:29.2741 25318/7f772a775840 age/Ust/UstRouterMain.cpp:492 ]: Received command to shutdown gracefully. Waiting until all clients have disconnected...
[ 2017-02-22 00:30:29.3043 25318/7f77237e2700 Ser/Server.h:464 ]: [UstRouter] Shutdown finished
[ 2017-02-22 00:30:29.3042 25318/7f7722fe1700 Ser/Server.h:817 ]: [UstRouterApiServer] Freed 0 spare client objects
[ 2017-02-22 00:30:29.3048 25318/7f7722fe1700 Ser/Server.h:464 ]: [UstRouterApiServer] Shutdown finished
[ 2017-02-22 00:30:29.3720 25318/7f772a775840 age/Ust/UstRouterMain.cpp:523 ]: Passenger UstRouter shutdown finished
[ 2017-02-22 00:30:29.4023 25313/7f222067b700 age/Cor/CoreMain.cpp:532 ]: Signal received. Gracefully shutting down... (send signal 1 more time(s) to force shutdown)
If you see the log that you have added it says "Request queue full", basically you have some api's which are long running, because of which 50x is being thrown after the queue was full.
Restarting nginx might fix the issue for now but you need to look at the response times of your apis and see which are slow performing and fix them otherwise it will be a recurring issue and you will have to restart nginx everyday.

(Passenger Agent) Signal received. Gracefully shutting down

I have a rails application that I am deploying on an aws ec2 instance, this is my first time using the Rubber Gem, for which I have followed this tutorial.
After removing the default nginx configurations and after intial deployment (step 5 of the tutorial I have mentioned) when ever I try and access my app using the public IP or DNS I get a 403 Forbidden nginx screen.
On inspecting the error log of nginx on the server this is what I found. I have been stuck on this issue for quite sometime now, any help would be greatly appreciated. Thanks.
tail -f /var/log/nginx/error.log
[ 2015-07-10 05:49:13.7236 13522/7fc24be3a780 age/Wat/Main.cpp:1264 ]: Starting PassengerAgent watchdog...
[ 2015-07-10 05:49:13.7526 13525/7f2f7f588780 age/Hel/Main.cpp:944 ]: Starting PassengerAgent server...
[ 2015-07-10 05:49:13.7529 13525/7f2f7f588780 age/Hel/Main.cpp:237 ]: PassengerAgent server running in multi-application mode.
[ 2015-07-10 05:49:13.7550 13525/7f2f7f588780 age/Hel/Main.cpp:698 ]: PassengerAgent server online, PID 13525
[ 2015-07-10 05:49:13.7851 13530/7f39b592e780 age/Log/Main.cpp:442 ]: Starting PassengerAgent logger...
[ 2015-07-10 05:49:13.7863 13530/7f39b592e780 age/Log/Main.cpp:323 ]: PassengerAgent logger online, PID 13530
[ 2015-07-10 05:49:13.7876 13525/7f2f7f588780 age/Hel/Main.cpp:857 ]: Watchdog seems to be killed; forcing shutdown of all subprocesses
[ 2015-07-10 05:49:13.7877 13525/7f2f79042700 age/Hel/Main.cpp:508 ]: Signal received. Gracefully shutting down... (send signal 2 more time(s) to force shutdown)
2015/07/10 05:49:13 [alert] 9729#0: Required key 'core_address' is missing (-1: Unknown error)
Passenger author here. This error occurs when the Passenger module compiled inside Nginx, does not match the actual Passenger version that is installed. In other words, your installation is broken.
I recommend that you start over completely, on a new and empty server, using the Passenger official walkthrough documentation.

Could not spawn process for application with Rails 4, Passenger and Nginx

[ 2014-09-04 07:22:07.0615 14334/7f66e7b44700 Pool2/Implementation.cpp:287 ]: Could not spawn process for application /home/myapp: An error occured while starting up the preloader.
Error ID: 96892690
[ 2014-09-04 07:22:07.0708 14334/7f66e5a2e700 agents/HelperAgent/RequestHandler.h:2306 ]: [Client 20] Cannot checkout session because a spawning error occurred. The identifier of the error is 96892690. Please see earlier logs for details about the error.

Resources