Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Bad response from server: 500" on restart during Capistrano puma:restart #246

Closed
amencarini opened this issue May 1, 2013 · 29 comments
Closed

Comments

@amencarini
Copy link

I'm on puma 2.0.1 behind nginx, with Rails 3.2.12, Ruby 2.0.0, server is Ubuntu Precise

Each time I try to deploy my app via Capistrano, at the deploy:restart hook, or when I try a restart through cap puma:restart I constantly get this:

  * 2013-05-01 11:24:26 executing `puma:restart'
  * executing "cd /var/www/project/current && bundle exec pumactl -S /var/www/project/shared/sockets/puma.state restart"
    servers: ["staging.example.com"]
    [staging.example.com] executing command
 ** [out :: staging.example.com] Bad response from server: 500

The puma server gets restarted correctly but the Capistrano deployment process gets interrupted.

This also happens when I try to stop it:

 * executing "cd /var/www/project/current && bundle exec pumactl -S /var/www/project/shared/sockets/puma.state stop"
    servers: ["staging.example.com"]
    [staging.example.com] executing command
 ** [out :: staging.example.com] Bad response from server: 500
@lephyrius
Copy link

Im also seeing this!
Using Ruby 2.0 and Rails 3.2.13 on Debian 6.

@amencarini
Copy link
Author

@lephyrius thanks for the feedback, and for reminding me to add Ruby and server info :)

@olistik
Copy link

olistik commented May 1, 2013

Same error experienced with the same setup described by @amencarini

@netmute
Copy link

netmute commented May 3, 2013

Same error here. It doesn"t always happen, though. Maybe 50% of the time. The server does not correctly restart after throwing that error, I have to manually start puma again.

@evanphx
Copy link
Member

evanphx commented May 3, 2013

Are you always seeing it from pumactl?

@lephyrius
Copy link

For me it is only from restart and stop not stats that gives bad response.
The command: "puma" works.(to start the server)
stats doesn't print out anything and not "bad response" when running.

@amencarini
Copy link
Author

@evanphx Capistrano executes this:

bundle exec pumactl -S /var/www/project/shared/sockets/puma.state restart

From what I can see, when I use this to restart, pumactl.sock gets removed, then I get the error, the puma process keeps working and when the whole application becomes available again, pumactl.sock reappears. And yes, I consistently get this, it's not spot. The server is a micro AWS instance: not sure if performance can play a role in this.

@Arie
Copy link
Contributor

Arie commented May 6, 2013

I get the same thing. Capistrano 2.15, ruby 1.9.3-p392, puma 2.0.1, rails 3.2.13.

@jockee
Copy link

jockee commented May 6, 2013

Same here. Capistrano 2.15.4. Rub 2.0.0dev. Puma 2.0.1. Rails 3.2.13.

@macfanatic
Copy link

Same problem with the following setup:

capistrano 2.15.4
puma 2.0.1
rails 4.0.0.beta1
ruby 2.0.0p0

@Arie
Copy link
Contributor

Arie commented May 7, 2013

I found the backtrace the server shows when this 500 happens for me. Need to do some more investigating to wrap my head around what happens in that file.

Puma caught this error: stream closed
/usr/local/rvm/gems/ruby-1.9.3-p392@foo/gems/puma-2.0.1/lib/puma/server.rb:594:in `write'
/usr/local/rvm/gems/ruby-1.9.3-p392@foo/gems/puma-2.0.1/lib/puma/server.rb:594:in `<<'
/usr/local/rvm/gems/ruby-1.9.3-p392@foo/gems/puma-2.0.1/lib/puma/server.rb:594:in `begin_restart'
/usr/local/rvm/gems/ruby-1.9.3-p392@foo/gems/puma-2.0.1/lib/puma/app/status.rb:34:in `call'
/usr/local/rvm/gems/ruby-1.9.3-p392@foo/gems/puma-2.0.1/lib/puma/server.rb:364:in `handle_request'
/usr/local/rvm/gems/ruby-1.9.3-p392@foo/gems/puma-2.0.1/lib/puma/server.rb:243:in `process_client'
/usr/local/rvm/gems/ruby-1.9.3-p392@foo/gems/puma-2.0.1/lib/puma/server.rb:142:in `block in run'
/usr/local/rvm/gems/ruby-1.9.3-p392@foo/gems/puma-2.0.1/lib/puma/thread_pool.rb:92:in `call'
/usr/local/rvm/gems/ruby-1.9.3-p392@foo/gems/puma-2.0.1/lib/puma/thread_pool.rb:92:in `block in    spawn_thread'
undefined method `split' for nil:NilClass

@amencarini
Copy link
Author

I've noticed two different behaviours on two different servers: on the faster server we get the 500 error 50% of the times, on the slower server we get it every time.

@MJLang
Copy link

MJLang commented May 12, 2013

Im getting the same issue - Using Ubuntu 12.10, Ruby 2.0.0, Rails 4.0.0.rc1, Puma at master and Capistrano 2.15.4

@macfanatic
Copy link

Has anyone found an easy workaround to this problem yet? For now I have to remove the tmp files for puma & kill the process itself after doing a ps aux | grep puma. I'm not a linux guru, so I might be making that part hard on myself, but I'd still like to use puma with capistrano and this is making it almost impossible.

@rudijs
Copy link

rudijs commented May 14, 2013

I'm also seeing this on Ruby 1.9.3

ruby -v
ruby 1.9.3p392 (2013-02-22 revision 39386) [i686-linux]

rails -v
Rails 3.2.13

/srv/blog/current$ RAILS_ENV=production bundle exec puma -e production -d -b unix:///tmp/blog.sock -S /tmp/blog.state --control 'unix:///tmp/blog_pumactl.sock'

Puma 2.0.1 starting...

  • Min threads: 0, max threads: 16
  • Environment: production
  • Listening on unix:///tmp/blog.sock

/srv/blog/current$ bundle exec pumactl -S /tmp/blog.state restart
Bad response from server: 500

/srv/blog/current$ bundle exec pumactl -S /tmp/blog.state stop
undefined method `split' for nil:NilClass

I'm using rvm so when I try without "bundle exec" I also get same response.

I haven't used it with Capistrano yet so it's likely nothing to do with Capistrano.

Really hoping this bug gets squashed soon I'm turning into a real puma fan.

@zires
Copy link

zires commented May 16, 2013

I got same error message!

@tomasmuller
Copy link

Same error message and machine setup as @oolyme .

@thetron
Copy link

thetron commented May 23, 2013

I too am getting this issue, also with the same setup as @tomasmuller and @oolyme. However, I am using capistrano.

@tomasmuller
Copy link

Oh, forgot to mention that. I'm also using Capistrano.

@iamroody
Copy link

ruby 2.0 rails Rails 3.2.13 , same messages

@doabit
Copy link

doabit commented May 29, 2013

ruby 2.0.0-p195, padrino and Ubuntu 12.04 , same error,

@davidcelis
Copy link

Ruby 2.0.0-p195, Rails 4.0.0.rc1 with Rails-API, and Ubuntu 13.04. Same issue.

@bobbrez
Copy link

bobbrez commented May 31, 2013

Same issue on Ruby 2.0.0-p0, Rails 4.0.0.rc1 Ubuntu 13.04 on EC3 Small.

@rebelwarrior
Copy link

Trying to deploy a Sinatra app, I believe I'm getting a similar error. Ruby 1.9.3p429 Sinatra 1.4.2 Puma 2.0.1

@evanphx evanphx closed this as completed in 3d1eefb Jun 1, 2013
@amencarini
Copy link
Author

@evanphx I'm pretty sure it's unrelated to this, but I've used the master to see if how it went and a new problem arose, that was tackled in pull request #271. I'm using that patch and Capistrano deployment is now alright, at last :) Thanks!

@ryanbooker
Copy link

I still get this error with the latest version of puma (2.5.0), which contains both of the patches mentioned here.

puma:restart still can't find the .sock.

I'm using bog standard with no config file by requiring 'puma/capistrano' in my deploy.rb.

puma 2.5.0, capistrano 2.15.5, rails 3.2.14

@waynehoover
Copy link

I'm also getting this error with puma 2.5.1, capistrano 2.15.5, rails 4.0.0

I'm not using a config file, just requiring 'puma/capistrano' in deploy.rb

Sometimes it works sometimes it doesn't.

@sydneyitguy
Copy link

+1 still getting the same issue with puma 2.5.1, capistrano 2.15.5, rails 4.0.0, ruby 2.0

It works about 20% on linode 1GB plan, 80% 500 error. I can't even stop the server after freezing, so I should use "kill -9" to force kill everything and start puma again.

@tobidelius
Copy link

I'm having the same problem as well!

MSP-Greg added a commit to MSP-Greg/puma that referenced this issue Jul 30, 2020
MSP-Greg added a commit to MSP-Greg/puma that referenced this issue Jul 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests