Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Yet another Systemd Timer activation issue (edge case) #627

Open
Annih opened this issue May 15, 2019 · 3 comments
Open

Yet another Systemd Timer activation issue (edge case) #627

Annih opened this issue May 15, 2019 · 3 comments

Comments

@Annih
Copy link
Contributor

Annih commented May 15, 2019

Cookbook version

11.2.0

Chef-client version

12.18.31 (old one sorry, but I'm sure it is reproducible with >= 14)

Platform Details

CentOS 7.4

Scenario:

Reboot a server after system upgrades and have Chef-client still running every X minutes - when configured as timer.

Steps to Reproduce:

  1. Setup Chef-client as timer
  2. Reboot

This is a rare edge case, I didn't manage to reproduce it on demand. I suspect a race condition blocking the activation of the chef-client.service at boot time.

Expected Result:

Chef runs every X minutes.

Actual Result:

Chef never runs.

Timer is in weird state:

UNIT              LOAD   ACTIVE SUB     DESCRIPTION
chef-client.timer loaded active elapsed chef-client periodic run

sudo systemctl list-timers chef-client.timer
NEXT LEFT LAST PASSED UNIT              ACTIVATES
n/a  n/a  n/a  n/a    chef-client.timer chef-client.service

sudo systemctl status chef-client.timer
● chef-client.timer - chef-client periodic run
   Loaded: loaded (/etc/systemd/system/chef-client.timer; enabled; vendor preset: disabled)
   Active: active (elapsed) since Tue 2019-05-14 08:06:35 UTC; 34min ago
@Annih
Copy link
Contributor Author

Annih commented May 15, 2019

From #613

we have had reliable activation for the most part. the one exception to that is that a few months back, possibly due to a systemd update (we're on CentOS 7), the service unit stopped activating after reboots, and the timer would not trigger until the service unit had been started. we overrode the systemd_unit[chef-client.service] resource to enable it, and thereafter once the initial chef-client.service run was triggered on boot-up, the timer would actually do its thing.

@nathwill don't you think we should enable the chef-client.service even in timer mode?

Another solution could be to translate the configured interval into a systemd.time compatible format and use OnCalendar. Would it be accepted @tas50 ?
actually it would be very hard to translate that properly

@dheerajd-msys
Copy link
Contributor

@tas50 We may need your input here ^.

@dheerajd-msys
Copy link
Contributor

dheerajd-msys commented Apr 15, 2020

@Annih We've recently made some changes in cookbook for Systemd Timer, Could you please check and confirm if issue is still there?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants