Question

I have a simple sinatra app that I am serving using puma on jruby behind nginx.

I've got my sample application up and running and working fine.

I am now trying to manually restart the puma server by sending the SIGUSR1 signal, as described in the puma docs. However, instead of causing the server to restart, I start getting 502 bad gateway error. The nginx logs show:

013/10/17 20:40:12 [error] 755#0: *25 connect() to unix:///var/run/mysockets/te 
st_app.sock failed (111: Connection refused) while connecting to upstream, clien 
t: <my ip>, server: jonahtest.example.com, request: "GET / HTTP/1.1", upstr 
eam: "http://unix:///var/run/mysockets/test_app.sock:/", host: "jonahtest.example 
.com"

So instead of restarting, it stops working. Here is how I issued the SIGUSR1 signal:

deploy@server:/var/www/webricktest$ jobs -p
863
deploy@server:/var/www/webricktest$ kill -s SIGUSR1 863
deploy@server:/var/www/webricktest$ jobs -p
863
[1]+  User defined signal 1   puma -e production -b unix:///var/run/mysockets/test_app.sock
deploy@server:/var/www/webricktest$

and shortly thereafter, on their own, both the original puma process and the and the user defined signal vanish, and if I run jobs -p again I get nothing. However, the socket remains at /var/run/mysockets/test_app.sock, and I have to manually rm it in order to restart puma again.

My question is: Why is kill -s SIGUSR1 <pid> not working to restart puma? How can I make it work?

Thanks!

Was it helpful?

Solution

This was a simple error on my part, caused by reading some out of date tutorials.

You simply need to send the SIGUSR2 signal and not the SIGUSR1

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top