phusion / passenger

A fast and robust web server and application server for Ruby, Python and Node.js
https://www.phusionpassenger.com/
MIT License
5.01k stars 548 forks source link

Passenger not shutting down gracefully. #2339

Open NavindrenBaskaran opened 3 years ago

NavindrenBaskaran commented 3 years ago

Issue report

Question 1: What is the problem?

We expect Passenger to shut down gracefully.

Passenger is not shutting down gracefully. When we issue the bundle exec passenger stop command Passenger fails with

Stopping web server...bundler: failed to load command: passenger (/opt/app/vendor/bundle/ruby/2.5.0/bin/passenger)
PhusionPassenger::DaemonController::StopTimeout: Daemon 'PassengerAgent watchdog' did not exit in time
  1. Start passenger with bundle exec passenger start
  2. Issue bundle exec passenger stop from a different terminal.

passenger-log.txt

Question 2: Passenger version and integration mode:

Open Source 6.0.4 standalone

Question 3: OS or Linux distro, platform (including version):

Ubuntu 18.04.5 LTS

Question 4: Passenger installation method:

RubyGems + Gemfile

Question 5: Your app's programming language (including any version managers) and framework (including versions):

Ruby, Rails 4.2.11.1

Question 6: Are you using a PaaS and/or containerization? If so which one?

AWS EKS 1.17, Docker version 19.03.6, build 369ce74a3c

Question 7: Anything else about your setup that we should know?

Environment Variables

PASSENGER_PORT=80
PASSENGER_MAX_POOL_SIZE=10
PASSENGER_POOL_IDLE_TIME=180
PASSENGER_MAX_REQUESTS=10000
PASSENGER_LOG_FILE=/dev/stdout
PASSENGER_ENGINE=builtin
PASSENGER_DISABLE_SECURITY_UPDATE_CHECK=true
DISABLE_ANONYMOUS_TELEMETRY=true
PASSENGER_LOG_LEVEL=7
NavindrenBaskaran commented 3 years ago

Hey there is no update for this issue yet, is the information provided not sufficient? Kindly let me know please. Thank you!

CamJN commented 3 years ago

Sorry I just haven't had time to look into this yet. I'll get to it.

NavindrenBaskaran commented 3 years ago

Okay noted @CamJN. Thank you so much for replying.

NavindrenBaskaran commented 3 years ago

hey @CamJN apologies, would like to ask if you had time to look at this issue?

CamJN commented 3 years ago

Hi I just setup a test environment of Docker running an Ubuntu 18.04.5 container with ruby 2.5.1p57, passenger 6.0.4, rails 4.2.11.1, and the environment variables you listed in your issue report.

Unfortunately running bundle exec passenger start in one terminal and then docker exec'ing into the same container to run bundle exec passenger stop from another terminal did not reproduce the issue for me. Would it be possible to provide a Dockerfile that reproduces the issue? That would be a big help.

CamJN commented 3 years ago

Not sure if Github ate your comment, but if you want to share a Dockerfile via email that's fine. You can reach me at camden@phusion.nl.

NavindrenBaskaran commented 3 years ago

Hey @CamJN have shared it via email, thank you.

NavindrenBaskaran commented 3 years ago

hey @CamJN may I ask, if we were able to reproduce the issue using the shared dockerfile ? Thank you.

NavindrenBaskaran commented 3 years ago

Hey @CamJN would like to follow up on this.

NavindrenBaskaran commented 3 years ago

It would be helpful if you could help us understand if this is an issue at passenger's end.

CamJN commented 3 years ago

I'm currently trying to build the image, the dockerfile installs ruby 2.3 as a dependency of some apt package which i believe is interfering with the later steps.

CamJN commented 3 years ago

The ruby-dev package you install in your Dockerfile is for the system ruby (2.3). You want the ruby headers for 2.5 which are already installed at /usr/local/include/ruby-2.5.0/ruby/ruby.h.

NavindrenBaskaran commented 3 years ago

hey @CamJN would like to follow up on this.

NavindrenBaskaran commented 3 years ago

I believe this is because of the 15 seconds default stop timeout, if the graceful shutdown takes more than 15 seconds then we will have this error raised.

Is there a way for us to increase this @CamJN ?

CamJN commented 3 years ago

Not at the moment, we can change this issue into a feature request though if you like.

NavindrenBaskaran commented 3 years ago

Yea, I think it will be great if we could do this. I would be able to contribute on this and will need your help to point me in the right direction here.

CamJN commented 3 years ago

I think step one would be to just pass a higher stop timeout directly in the code, and see if that helps. If it does then we can talk about how to plumb in a new option.

stephanelacote commented 3 months ago

Any update on this ? We are also experiencing the same issue when stopping passenger ( always timeout at 15s ) What would be a suggested workaround for this ?