passenger icon indicating copy to clipboard operation
passenger copied to clipboard

After upgrading to 5.1.8, `passenger stop` does not work correctly

Open ginkcode opened this issue 6 years ago • 5 comments


Issue report

Passenger standalone instance doesn't stop correctly after upgrading to 5.1.8.

Are you sure this is a bug in Passenger?

Your answer: Yes. Everything works well with previous versions.

Please try with the newest version of Passenger to avoid issues that have already been fixed

Your answer: It happens with latest version.

Question 1: What is the problem?

Your answer: Looks like the socket file has been deleted before executing delete in passenger stop. It throws Exception Errno::ENOENT (unlink_internal)

Question 2: Passenger version and integration mode:

Your answer: 5.1.8 standalone

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

Your answer: Ubuntu server 16.04 LTS

Question 4: Passenger installation method:

Your answer: [ ] RubyGems + Gemfile [x] RubyGems, no Gemfile [ ] Phusion APT repo [ ] Phusion YUM repo [ ] OS X Homebrew [ ] source tarball [ ] Other, please specify:

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

Your answer: Ruby 2.4.1 via rbenv, Rails 5.1.4

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

Your answer: AWS EC2 instance, no container.

ginkcode avatar Sep 16 '17 11:09 ginkcode

I'm unable to reproduce, can you specify your startup command for Passenger (after redacting anything sensitive)?

CamJN avatar Sep 25 '17 17:09 CamJN

Really? I can reproduce this issue easily.

demo@ip-172-31-7-161:~/apps/anyweb$ cat Passengerfile.json 
{
  "environment": "development",
  "socket_file": "./tmp/sockets/passenger.sock",
  "daemonize": true,
  "user": "demo"
}

demo@ip-172-31-7-161:~/apps/anyweb$ passenger start
=============== Phusion Passenger Standalone web server started ===============
PID file: /home/demo/apps/anyweb/tmp/pids/passenger.pid
Log file: /home/demo/apps/anyweb/log/passenger.log
Environment: development
Accessible via: unix:/home/demo/apps/anyweb/tmp/sockets/passenger.sock

Serving in the background as a daemon.
Problems? Check https://www.phusionpassenger.com/library/admin/standalone/troubleshooting/
===============================================================================
demo@ip-172-31-7-161:~/apps/anyweb$ passenger stop
/home/demo/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/passenger-5.1.8/src/ruby_supportlib/phusion_passenger/standalone/stop_command.rb:51:in `delete': No such file or directory @ unlink_internal - /home/demo/apps/anyweb/tmp/sockets/passenger.sock (Errno::ENOENT)
	from /home/demo/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/passenger-5.1.8/src/ruby_supportlib/phusion_passenger/standalone/stop_command.rb:51:in `run'
	from /home/demo/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/passenger-5.1.8/src/ruby_supportlib/phusion_passenger/standalone/main.rb:51:in `run!'
	from /home/demo/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/passenger-5.1.8/bin/passenger:45:in `<top (required)>'
	from /home/demo/.rbenv/versions/2.4.2/bin/passenger:23:in `load'
	from /home/demo/.rbenv/versions/2.4.2/bin/passenger:23:in `<main>'
demo@ip-172-31-7-161:~/apps/anyweb$ 

ginkcode avatar Sep 25 '17 18:09 ginkcode

Afraid we're seeing the same, even if we roll back to 5.1.7 or 5.1.6:

# /opt/rbenv/shims/passenger start 
=============== Phusion Passenger Standalone web server started ===============
PID file: /srv/www/passenger.3000.pid
Log file: /srv/www/passenger.3000.log
Environment: development
Accessible via: http://0.0.0.0:3000/

You can stop Phusion Passenger Standalone by pressing Ctrl-C.
Problems? Check https://www.phusionpassenger.com/library/admin/standalone/troubleshooting/
===============================================================================
2017/09/25 21:15:31 [error] 3829#0: *4 "/srv/www/public/index.html" is not found (2: No such file or directory), client: 127.0.0.1, server: _, request: "HEAD / HTTP/1.1", host: "0.0.0.0"
[ 2017-09-25 21:15:31.8453 3806/7f8badf75700 age/Cor/SecurityUpdateChecker.h:356 ]: Security update check: no update found (next check in 24 hours)



# if we execute `/opt/rbenv/shims/passenger stop` now in another terminal, we see the below in the terminal in which we ran `/opt/rbenv/shims/passenger start`...



Stopping web server.../opt/rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/passenger-5.1.6/src/ruby_supportlib/phusion_passenger/vendor/daemon_controller.rb:436:in `rescue in kill_daemon': nginx: [error] open() "/srv/www/passenger.3000.pid" failed (2: No such file or directory) (PhusionPassenger::DaemonController::StopError)
	from /opt/rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/passenger-5.1.6/src/ruby_supportlib/phusion_passenger/vendor/daemon_controller.rb:433:in `kill_daemon'
	from /opt/rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/passenger-5.1.6/src/ruby_supportlib/phusion_passenger/vendor/daemon_controller.rb:295:in `block (2 levels) in stop'
	from /opt/rbenv/versions/2.4.0/lib/ruby/2.4.0/timeout.rb:93:in `block in timeout'
	from /opt/rbenv/versions/2.4.0/lib/ruby/2.4.0/timeout.rb:103:in `timeout'
	from /opt/rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/passenger-5.1.6/src/ruby_supportlib/phusion_passenger/vendor/daemon_controller.rb:294:in `block in stop'
	from /opt/rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/passenger-5.1.6/src/ruby_supportlib/phusion_passenger/vendor/daemon_controller/lock_file.rb:68:in `block in exclusive_lock'
	from /opt/rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/passenger-5.1.6/src/ruby_supportlib/phusion_passenger/vendor/daemon_controller/lock_file.rb:63:in `open'
	from /opt/rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/passenger-5.1.6/src/ruby_supportlib/phusion_passenger/vendor/daemon_controller/lock_file.rb:63:in `exclusive_lock'
	from /opt/rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/passenger-5.1.6/src/ruby_supportlib/phusion_passenger/vendor/daemon_controller.rb:292:in `stop'
	from /opt/rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/passenger-5.1.6/src/ruby_supportlib/phusion_passenger/standalone/start_command.rb:535:in `block in trapsafe_shutdown_and_cleanup'
	from /opt/rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/passenger-5.1.6/src/ruby_supportlib/phusion_passenger/standalone/start_command.rb:532:in `synchronize'
	from /opt/rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/passenger-5.1.6/src/ruby_supportlib/phusion_passenger/standalone/start_command.rb:532:in `trapsafe_shutdown_and_cleanup'
	from /opt/rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/passenger-5.1.6/src/ruby_supportlib/phusion_passenger/standalone/start_command.rb:86:in `run'
	from /opt/rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/passenger-5.1.6/src/ruby_supportlib/phusion_passenger/standalone/main.rb:51:in `run!'
	from /opt/rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/passenger-5.1.6/bin/passenger:45:in `<top (required)>'
	from /opt/rbenv/versions/2.4.0/bin/passenger:22:in `load'
	from /opt/rbenv/versions/2.4.0/bin/passenger:22:in `<main>'

dmalan avatar Sep 25 '17 21:09 dmalan

The last logs here show the nginx pid file is missing, not the socket. So that's more likely to be this issue: https://github.com/phusion/passenger/issues/1970

CamJN avatar Oct 03 '17 16:10 CamJN

Is this still an issue?

CamJN avatar May 09 '19 18:05 CamJN