Does Phusion Passenger restart gracefully when I touch restart.txt
Asked Answered
A

3

6

Will it finish serving all current requests before it restarts?

Amp answered 4/2, 2010 at 17:23 Comment(0)
S
2

I'm under the impression that each passenger app instance dies AFTER processing a request instead of restarting BEFORE the next request when restart.txt is touched. So there's a latency of one request in each passenger worker. As the process quits and the app spawner just spawns a new instance, I would not call this "graceful".

This means that the next request to a single instance of your application will be answered by that version of the instance which then quits (after doing its work). Current running requests won't be killed.

Skellum answered 4/2, 2010 at 20:47 Comment(2)
By graceful i just mean every request in progress is completed without dropping any.Amp
Just amended my answer - it won't drop an app instance, neither during a request nor for the immediate next request.Skellum
P
4

Short answer : yes !

In fact, it will allow current request to finish, and serve new request with new version. I am trying to find reference to this, but can't find any for the moment.

Phatic answered 4/2, 2010 at 19:22 Comment(4)
"By creating or modifying the file tmp/restart.txt in the Rails application’s root folder. Phusion Passenger will automatically restart the application during the next request." modrails.com/documentation.htmlAnthroposophy
I read that quote while reading the docs to answer this question, do you interpret this as implying that it will restart gracefully? Ie finish all outstanding requests then do the next one with the new version?Amp
Yes, that's the way I interpreted it.Anthroposophy
@JonathanJulian actually your quote of documentation quite clearly says it will work a bit different than tal's answer.Skellum
S
2

I'm under the impression that each passenger app instance dies AFTER processing a request instead of restarting BEFORE the next request when restart.txt is touched. So there's a latency of one request in each passenger worker. As the process quits and the app spawner just spawns a new instance, I would not call this "graceful".

This means that the next request to a single instance of your application will be answered by that version of the instance which then quits (after doing its work). Current running requests won't be killed.

Skellum answered 4/2, 2010 at 20:47 Comment(2)
By graceful i just mean every request in progress is completed without dropping any.Amp
Just amended my answer - it won't drop an app instance, neither during a request nor for the immediate next request.Skellum
A
0

From the documentation:

"If you use passenger-config restart-app or restart.txt or restart an application, then Passenger never drops any requests during the restart."

also:

"Before shutting down or restarting an application process, Passenger performs two > operations:

  1. It waits until existing requests routed to that process are finished. This way, existing requests will be finished gracefully.
  2. It aborts WebSocket connections. This is because WebSocket connections can stay open for an arbitrary amount of time and will block the shutdown/restart."
Alper answered 17/3, 2019 at 9:23 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.