Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Phased restart stops Puma when the plugin is on and workers take a moment to boot

オープン 初心者向け
#89 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
75/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
ruby
領域
backend

調査の方向性

まず、plugin の stop_litestream メソッドと、"Detected Litestream has gone away" をログに記録する monitor のチェックを読みます。issue には、それらのファイルやテストは記載されていません。before_restart と after_booted の間に @litestream_pid がどのように変化するかを追い、2 つの worker と遅延する config.ru を使って再現します。1 秒および 4 秒の worker 起動でも段階的な再起動が完了し、Litestream が強制終了されたときに Puma が停止すれば完了です。

索引モデルが issue の本文から書いたものです。

説明

With plugin :litestream in cluster mode, a phased restart (pumactl phased-restart / USR1) stops Puma if the workers take a second or more to boot, which a Rails app always does.

before_restart stops Litestream at the start of the phased restart, but after_booted, which starts it again, fires only once every worker has rebooted (Cluster#run, in_phased_restart && workers_not_booted.zero?). Until then the monitor, which checks every 2 seconds, finds the old pid gone, logs "Detected Litestream has gone away, stopping Puma..." and sends INT to Puma.

- Worker 1 (PID: 3706119) booted in 1.0s, phase: 0
Stopping Litestream...
- Starting phased worker restart, phase: 1
- Worker 0 (PID: 3706319) booted in 1.0s, phase: 1
- Stopping 3706119 for phased upgrade...
Detected Litestream has gone away, stopping Puma...
- Goodbye!

To reproduce on 0.16.1 with 2 workers, preload_app! false and a config.ru that sleeps before run:

Worker boot time Puma 8.0.2 Puma 6.6.1
0 s survives, Litestream restarts survives
1 s stops stops
4 s stops stops

Hot restarts aren't affected: exec replaces the process before the monitor runs again. Single mode has no phased restart.

A small fix that works on both Puma versions: have stop_litestream clear @litestream_pid before stopping it, so the monitor skips its check until after_booted starts the next one. With that, Puma survives a phased restart at 1 s and 4 s boot times, and still stops when Litestream is killed. Happy to send it as a PR.

主要言語
Ruby
スター
280
フォーク
32
平均マージ
9時間 13分
マージ済み PR(30日)
7

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

fractaledmind/litestream-ruby のほかの issue

fractaledmind/litestream-ruby の issue をすべて見る

似ている issue

Ruby の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。