Bug 1111747
| Summary: | Pacemaker doesn't wait for systemd resource start | |||
|---|---|---|---|---|
| Product: | Red Hat Enterprise Linux 7 | Reporter: | Chris Feist <cfeist> | |
| Component: | pacemaker | Assignee: | Andrew Beekhof <abeekhof> | |
| Status: | CLOSED ERRATA | QA Contact: | Cluster QE <mspqa-list> | |
| Severity: | urgent | Docs Contact: | ||
| Priority: | urgent | |||
| Version: | 7.0 | CC: | cluster-maint, djansa, dvossel, fdinitto, jeckersb, jherrman, mnovacek, rohara, tlavigne | |
| Target Milestone: | rc | Keywords: | ZStream | |
| Target Release: | --- | |||
| Hardware: | Unspecified | |||
| OS: | Unspecified | |||
| Whiteboard: | ||||
| Fixed In Version: | pacemaker-1.1.12-4.el6 | Doc Type: | Bug Fix | |
| Doc Text: |
Prior to this update, the systemd API was triggered immediately after a "start" action was initiated by the pacemaker utility, rather than when the action was completed. As a consequence, processes that depend on the completion of the "start" action were initiated but failed. With this update, the systemd API is only triggered when the service enters the "active" state or when a pre-configured timeout is reached. As a result, processes dependent on the completion of "start" now execute as expected.
|
Story Points: | --- | |
| Clone Of: | ||||
| : | 1115024 1165423 (view as bug list) | Environment: | ||
| Last Closed: | 2015-03-05 10:00:07 UTC | Type: | Bug | |
| Regression: | --- | Mount Type: | --- | |
| Documentation: | --- | CRM: | ||
| Verified Versions: | Category: | --- | ||
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | ||
| Cloudforms Team: | --- | Target Upstream Version: | ||
| Embargoed: | ||||
| Bug Depends On: | ||||
| Bug Blocks: | 1115024 | |||
|
Description
Chris Feist
2014-06-20 22:26:07 UTC
I've experienced weird behavior like this as well. We are fighting two things systemd related in pacemaker. 1. Most of the time people aren't taking into account these systemd unit files are being used in a HA environment. With HA, we execute start and then usually immediately execute the first monitor operation "systemctl status" right afterwards. If the unit file allows any gap of time between starting and being able to detect the status, that unit file is going to look like it is failing to pacemaker. 2. Something about how we are using the systemd dbus API isn't waiting for the 'ExecStartPost' command in a unit file to complete before considering the start operation completed. Apparently (according to what Chris is reporting) there may be some other issues going on here as well were we don't wait completely even for the 'ExecStart' to complete. Moving forward we need to fix whatever is causing us to return too early during the start operation (item 2), and as part of this fix we should figure out a way to make everyone else's broken systemd scripts work (item 1.). Perhaps we should internally execute start on the service, and not consider the service started until we can execute status successfully on the service. That way we are guaranteed that we can monitor the service successfully before we say the start operation has completed. -- Vossel This is also happening with services of type=notify. Here's a minimal service that sleeps for 5 seconds then notifies startup to demonstrate:
# cat /etc/systemd/system/notify-test.service
[Unit]
Description=notify test
[Service]
Type=notify
ExecStart=/usr/bin/python -c 'import time; import systemd.daemon; time.sleep(5); systemd.daemon.notify("READY=1"); time.sleep(3600)'
As expected, it takes 5 seconds to start:
# time systemctl start notify-test.service
real 0m5.404s
user 0m0.059s
sys 0m0.010s
But is considered started immediately by pacemaker as described in the original report:
# time crm_resource -r notify-test --force-start -V
Operation start for notify-test (systemd::notify-test) returned 0
real 0m0.336s
user 0m0.006s
sys 0m0.005s
The result is pacemaker repeatedly and rapidly trying to restart the service when it is a managed resource. Note the frequency of restarts when I follow the journal and then enable the service in pacemaker:
# journalctl -f -u notify-test &
[2] 3166
# pcs resource enable notify-test
Jun 23 09:38:24 control1.example.org systemd[1]: Starting notify test...
Jun 23 09:38:25 control1.example.org systemd[1]: Stopping notify test...
Jun 23 09:38:25 control1.example.org systemd[1]: Stopped notify test.
Jun 23 09:38:25 control1.example.org systemd[1]: Starting notify test...
Jun 23 09:38:26 control1.example.org systemd[1]: Stopping notify test...
Jun 23 09:38:26 control1.example.org systemd[1]: Stopped notify test.
Jun 23 09:38:26 control1.example.org systemd[1]: Starting notify test...
Jun 23 09:38:26 control1.example.org systemd[1]: Stopping notify test...
Jun 23 09:38:26 control1.example.org systemd[1]: Stopped notify test.
Jun 23 09:38:26 control1.example.org systemd[1]: Starting notify test...
Jun 23 09:38:27 control1.example.org systemd[1]: Stopping notify test...
Jun 23 09:38:27 control1.example.org systemd[1]: Stopped notify test.
Jun 23 09:38:27 control1.example.org systemd[1]: Starting notify test...
Jun 23 09:38:27 control1.example.org systemd[1]: Stopping notify test...
Jun 23 09:38:27 control1.example.org systemd[1]: Stopped notify test.
Jun 23 09:38:28 control1.example.org systemd[1]: Starting notify test...
Jun 23 09:38:28 control1.example.org systemd[1]: Stopping notify test...
Jun 23 09:38:28 control1.example.org systemd[1]: Stopped notify test.
Jun 23 09:38:28 control1.example.org systemd[1]: Starting notify test...
Jun 23 09:38:29 control1.example.org systemd[1]: Stopping notify test...
Jun 23 09:38:29 control1.example.org systemd[1]: Stopped notify test.
Jun 23 09:38:29 control1.example.org systemd[1]: Starting notify test...
Jun 23 09:38:30 control1.example.org systemd[1]: Stopping notify test...
Jun 23 09:38:30 control1.example.org systemd[1]: Stopped notify test.
Jun 23 09:38:30 control1.example.org systemd[1]: Starting notify test...
Jun 23 09:38:30 control1.example.org systemd[1]: Stopping notify test...
Jun 23 09:38:30 control1.example.org systemd[1]: Stopped notify test.
Jun 23 09:38:31 control1.example.org systemd[1]: Starting notify test...
Jun 23 09:38:31 control1.example.org systemd[1]: Stopping notify test...
Jun 23 09:38:31 control1.example.org systemd[1]: Stopped notify test.
Jun 23 09:38:32 control1.example.org systemd[1]: Starting notify test...
Jun 23 09:38:32 control1.example.org systemd[1]: Stopping notify test...
Jun 23 09:38:32 control1.example.org systemd[1]: Stopped notify test.
...etc...
We're returning early because the systemd API call returns early. The rules for every other kind of resource are "don't return until you're done". I guess systemd is special, so we're going to have to hack our way this. IMHO, we can just use start-delay for this in 7.0 and fix properly for 7.1 Fixed upstream: https://github.com/beekhof/pacemaker/commit/3bd6c30 `crm_resource --force-start` will still return immediately though, as it bypasses the cluster completely and goes direct to the underlying resource. (In reply to Andrew Beekhof from comment #5) > IMHO, we can just use start-delay for this in 7.0 and fix properly for 7.1 There are limited scenarios where start-delay is safe. Typically start-delay is used on the recurring monitor operations to keep them from attempting to monitor a resource which may not completely be up yet. It is less understood that you'd also have to use start-delay on the 'start' operation of any resources ordered to start after the resource that has issues starting correctly. Example: A resource takes 40 seconds to start, but the actual start op returns immediately. If there is an ordering constraint, start delayed_rsc then start whatever_rsc, the 'whatever_rsc' resource would need the start-delay option set on its 'start' operation to account for issues that the 'delayed_rsc' has. Outside of a few simple use-cases, start-delay can produce a complex and fragile config that may prove to be unreliable. -- Vossel (In reply to Andrew Beekhof from comment #6) > Fixed upstream: > > https://github.com/beekhof/pacemaker/commit/3bd6c30 patch looks good. We could follow up with adding a 'sleep' to the lrmd regression test's sample systemd unit file so we can be certain this new logic is exercised. (In reply to David Vossel from comment #8) > (In reply to Andrew Beekhof from comment #6) > > Fixed upstream: > > > > https://github.com/beekhof/pacemaker/commit/3bd6c30 > > patch looks good. We could follow up with adding a 'sleep' to the lrmd > regression test's sample systemd unit file so we can be certain this new > logic is exercised. I tested with the service chris supplied in the description and saw the expected retries in the logs. So I'm certain it works :) Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://rhn.redhat.com/errata/RHBA-2015-0440.html |