puma icon indicating copy to clipboard operation
puma copied to clipboard

`fork_worker` changes systemd status to `reloading` when reforking

Open MrSerth opened this issue 1 year ago • 1 comments

Describe the bug There might be a bug that is caused by the combination of fork_worker together with the systemd notification integration (also known as SdNotify). When both are active, reforking will change the Active status in systemd to reloading (reload), but never changes it back.

Puma config:

# frozen_string_literal: true

workers 5
fork_worker
preload_app! false
/usr/local/bin/bundle exec puma -C puma.rb -b tcp://0.0.0.0:9292 hello.ru

To Reproduce I've created a minimal repository with reproduction steps: MrSerth/puma-refork-systemd.

Current behavior A refork signals to systemd that a reload is being performed. This signal never gets changed to ready again.

Expected behavior Either, a refork is signalled as reload and, once finished, signalled as finished OR the refork is not changing the systemd status at all. I would prefer the second option (no signalling to systemd at all, since we are not completely reloading the application).

Desktop:

  • OS: Linux
  • Puma Version: 6.4.0

MrSerth avatar Nov 02 '23 16:11 MrSerth

Thanks for workingon the repo example. I've got a test verifying this behavior.

A quick look at possible fixes showed that 'no signalling to systemd at all' might be messy, but 'reloading' followed by 'ready' is what I'm thinking.

MSP-Greg avatar Nov 19 '23 01:11 MSP-Greg