Bug #34824
Installer does not restart foreman.service when changing Puma configuration
Description
Copied from #33973 -- the fix there was not sufficient
Initial Setup: puma configured and running with 4 workers and 4 workers per thread
- grep -n puma /etc/foreman-installer/scenarios.d/satellite-answers.yaml
122: foreman_service_puma_threads_min:
123: foreman_service_puma_threads_max: 4
124: foreman_service_puma_workers: 4
- ps aux | grep -v grep | grep -e USER -e puma
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
foreman 3472 0.6 2.2 951716 462672 ? Ssl 18:08 0:47 puma 5.3.2 (unix:///run/foreman.sock) [foreman]
foreman 4060 0.0 3.1 1141940 648704 ? Sl 18:09 0:05 puma: cluster worker 0: 3472 [foreman]
foreman 4061 0.0 3.1 1139888 648544 ? Sl 18:09 0:06 puma: cluster worker 1: 3472 [foreman]
foreman 4064 0.1 3.0 1119804 618152 ? Sl 18:09 0:12 puma: cluster worker 2: 3472 [foreman]
foreman 4065 0.0 3.0 1143428 631664 ? Sl 18:09 0:05 puma: cluster worker 3: 3472 [foreman]
Reproduction steps:
1. change puma configuration foreman_service_threads_max and/or foreman_service_puma_workers.
- satellite-installer --foreman-foreman-service-puma-workers 5 --foreman-foreman-service-puma-threads-max 5 --verbose-log-level=info
2. check # of puma worker processes running is still 4 after installer has completed:
- ps aux | grep -v grep | grep -e USER -e puma
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
foreman 8148 11.9 2.2 951776 462376 ? Ssl 20:21 0:43 puma 5.3.2 (unix:///run/foreman.sock) [foreman]
foreman 8219 1.2 3.1 1150208 649108 ? Sl 20:22 0:03 puma: cluster worker 0: 8148 [foreman]
foreman 8223 0.0 2.2 978532 456372 ? Sl 20:22 0:00 puma: cluster worker 1: 8148 [foreman]
foreman 8227 0.0 2.2 978532 456260 ? Sl 20:22 0:00 puma: cluster worker 2: 8148 [foreman]
foreman 8236 0.0 2.2 978532 456492 ? Sl 20:22 0:00 puma: cluster worker 3: 8148 [foreman]
3. restart foreman.service: # systemctl restart foreman.service
4. Observe there are now 5 puma worker processes running:
- ps aux | grep -v grep | grep -e USER -e puma
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
foreman 8857 76.2 2.2 947880 457108 ? Ssl 20:28 0:44 puma 5.3.2 (unix:///run/foreman.sock) [foreman]
foreman 8883 1.2 2.1 976688 450764 ? Sl 20:28 0:00 puma: cluster worker 0: 8857 [foreman]
foreman 8886 1.1 2.1 976688 450628 ? Sl 20:28 0:00 puma: cluster worker 1: 8857 [foreman]
foreman 8894 1.1 2.1 976688 450616 ? Sl 20:28 0:00 puma: cluster worker 2: 8857 [foreman]
foreman 8900 1.1 2.1 976688 450956 ? Sl 20:28 0:00 puma: cluster worker 3: 8857 [foreman]
foreman 8902 1.2 2.1 976688 450748 ? Sl 20:28 0:00 puma: cluster worker 4: 8857 [foreman]
Further information:
You can observe that foreman.socket was restarted while foreman.service was not restarted:
2021-11-22 20:21:22 [DEBUG ] [configure] Executing: '/bin/systemctl restart -- foreman.socket'
2021-11-22 20:21:23 [INFO ] [configure] /Service[foreman.socket]: Triggered 'refresh' from 1 event
2021-11-22 20:21:23 [DEBUG ] [configure] /Service[foreman.socket]: The container Class[Foreman::Service] will propagate my refresh event
2021-11-22 20:21:23 [DEBUG ] [configure] /Service[foreman.socket]: Evaluated in 1.36 seconds
2021-11-22 20:21:23 [DEBUG ] [configure] /Service[foreman]: Starting to evaluate the resource (1592 of 2025)
2021-11-22 20:21:23 [DEBUG ] [configure] Executing: '/bin/systemctl is-active -- foreman'
2021-11-22 20:21:23 [DEBUG ] [configure] Executing: '/bin/systemctl is-enabled -- foreman'
2021-11-22 20:21:23 [DEBUG ] [configure] Executing: '/bin/systemctl show --property=NeedDaemonReload -- foreman'
2021-11-22 20:21:23 [DEBUG ] [configure] Executing: '/bin/systemctl daemon-reload'
2021-11-22 20:21:23 [DEBUG ] [configure] Executing: '/bin/systemctl unmask -- foreman'
2021-11-22 20:21:23 [DEBUG ] [configure] Executing: '/bin/systemctl start -- foreman'
2021-11-22 20:22:08 [DEBUG ] [configure] Executing: '/bin/systemctl is-enabled -- foreman'
2021-11-22 20:22:08 [INFO ] [configure] /Stage[main]/Foreman::Service/Service[foreman]/ensure: ensure changed 'stopped' to 'running'
2021-11-22 20:22:08 [DEBUG ] [configure] /Service[foreman]: The container Class[Foreman::Service] will propagate my refresh event
2021-11-22 20:22:08 [DEBUG ] [configure] /Service[foreman]: Unscheduling refresh on Service[foreman]
2021-11-22 20:22:08 [DEBUG ] [configure] /Service[foreman]: Evaluated in 44.66 seconds
Related issues
Associated revisions
History
#1
Updated by Evgeni Golov 11 months ago
- Copied from Bug #33973: The Installer does not restart foreman.service when changing puma configuration added
#2
Updated by Evgeni Golov 11 months ago
- Description updated (diff)
#3
Updated by The Foreman Bot 11 months ago
- Status changed from New to Ready For Testing
- Pull request https://github.com/theforeman/puppet-foreman/pull/1045 added
#4
Updated by The Foreman Bot 11 months ago
- Fixed in Releases 3.3.0 added
#5
Updated by Evgeni Golov 11 months ago
- Status changed from Ready For Testing to Closed
Applied in changeset puppet-foreman|6b7b05e0dbfdc26623422a9b38979524ac9d29d9.
#6
Updated by The Foreman Bot 11 months ago
- Pull request https://github.com/theforeman/puppet-foreman/pull/1049 added
#7
Updated by Evgeni Golov 11 months ago
- Fixed in Releases 3.1.3 added
#8
Updated by Evgeni Golov 11 months ago
- Fixed in Releases 3.2.1 added
#9
Updated by Amit Upadhye 10 months ago
- Subject changed from installer does not restart foreman.service when changing puma configuration to Installer does not restart foreman.service when changing Puma configuration
Fixes #34824 - properly restart foreman when puma config changed
we need to restart foreman.service before a (possible) restart of
foreman.socket, as the later also does restart foreman.service which
leads to foreman.socket being started instead of restarted
But in this case the now running foreman.service didn't see the changes
to the service file that daemon-reload would have loaded.