RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1719364 - OnCalendar timers with RandomizedDelaySec != 0 may never run
Summary: OnCalendar timers with RandomizedDelaySec != 0 may never run
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: systemd
Version: ---
Hardware: All
OS: Linux
medium
medium
Target Milestone: rc
: 8.0
Assignee: David Tardon
QA Contact: Frantisek Sumsal
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-06-11 15:23 UTC by Renaud Métrich
Modified: 2023-11-14 18:00 UTC (History)
9 users (show)

Fixed In Version: systemd-239-77.el8
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1719366 (view as bug list)
Environment:
Last Closed: 2023-11-14 15:48:25 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github redhat-plumbers systemd-rhel8 pull 392 0 None open Always use inactive_exit_timestamp if it is set 2023-05-30 12:39:43 UTC
Github systemd systemd issues 18678 0 None closed daily timer with randomizeddelaysec may never run if daemon-reload is called. 2023-05-30 12:21:52 UTC
Red Hat Knowledge Base (Solution) 4276781 0 Customize or extend None Units defining OnCalendar timers with RandomizedDelaySec != 0 may never run 2019-07-10 09:46:39 UTC
Red Hat Product Errata RHBA-2023:7097 0 None None None 2023-11-14 15:48:57 UTC

Description Renaud Métrich 2019-06-11 15:23:14 UTC
Description of problem:

When a OnCalendar timer is used and RandomizedDelaySec is not zero (case of insights-client.timer for example), the timer may never run, typically when systemd regularly reloads its configuration.


Version-Release number of selected component (if applicable):

systemd-239-13.el8_0.3


How reproducible:

Always


Steps to Reproduce:
1. Create a dummy service

# cat << EOF > /etc/systemd/system/my.service
[Unit]
Description=My one-shot service triggered by a timer
[Service]
Type=oneshot
ExecStart=/bin/echo "I'm running"
EOF

2. Create a timer triggered on calendar with random delay (here, every 10 minutes + 5 minutes delay)

# cat << EOF > /etc/systemd/system/my.timer
[Timer]
OnCalendar=*-*-* *:5,15,25,35,45,55:00
RandomizedDelaySec=300
EOF

3. Set debug level and reload systemd

# systemd-analyze set-log-level debug
# systemctl daemon-reload

4. Follow the journal and start the timer

# journalctl --follow -u my.service -u my.timer &
# systemctl start my.timer

5. Just before timer elapses (but after expected time, issue systemctl daemon-reload)

Journal:

Jun 11 17:08:24 vm-rhel8 systemd[1]: my.timer: Adding 3min 35.811652s random time.
Jun 11 17:08:24 vm-rhel8 systemd[1]: my.timer: Realtime timer elapses at Tue 2019-06-11 17:18:35 CEST.

--> issue "systemctl daemon-reload" between 17:15 and 17:18
In the example below, it was done at 17:16:

Jun 11 17:16:01 vm-rhel8 systemd[1]: my.timer: Adding 4min 19.759514s random time.
Jun 11 17:16:01 vm-rhel8 systemd[1]: my.timer: Realtime timer elapses at Tue 2019-06-11 17:29:19 CEST.

--> service will not run before 17:29

...

Additional info:

This is a huge issue for timer elapsing only once a day, such as insights-client.timer which runs Daily + 4 hours:
as soon as a daemon-reload occurs between midnight and 4 o'clock, the timer won't elapse until next day.

Comment 5 David Tardon 2020-11-19 11:19:06 UTC
*** Bug 1899402 has been marked as a duplicate of this bug. ***

Comment 6 Sandeep MJ 2021-02-04 05:20:08 UTC
Hello,

Any progress on this?

Regards,
Sandeep

Comment 7 David Tardon 2021-02-04 14:30:51 UTC
(In reply to Sandeep MJ from comment #6)
> Any progress on this?

No.

Comment 8 Aaron Howell 2021-03-02 21:52:07 UTC
Any reason this has been fixed in RHEL7 but no progress on RHEL8? (re: https://bugzilla.redhat.com/show_bug.cgi?id=1764908)

Comment 9 David Tardon 2021-03-11 09:07:44 UTC
(In reply to Aaron Howell from comment #8)
> Any reason this has been fixed in RHEL7 but no progress on RHEL8? (re:
> https://bugzilla.redhat.com/show_bug.cgi?id=1764908)

Are you sure it's the same problem? AFAICS your reproducer still doesn't work with current systemd upstream....

Comment 10 Aaron Howell 2021-03-11 21:17:38 UTC
When the same issue was raised against RHEL8 it got closed as a duplicate of this bug: https://bugzilla.redhat.com/show_bug.cgi?id=1899402

Comment 11 David Tardon 2021-03-22 08:07:14 UTC
(In reply to Aaron Howell from comment #10)
> When the same issue was raised against RHEL8 it got closed as a duplicate of
> this bug: https://bugzilla.redhat.com/show_bug.cgi?id=1899402

Well, mistakes happen...

Comment 12 David Tardon 2023-05-15 11:51:59 UTC
*** Bug 2193262 has been marked as a duplicate of this bug. ***

Comment 14 Plumber Bot 2023-07-13 11:46:52 UTC
fix merged to github main branch -> https://github.com/redhat-plumbers/systemd-rhel8/pull/392

Comment 20 errata-xmlrpc 2023-11-14 15:48:25 UTC
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 (systemd bug fix and enhancement update), 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://access.redhat.com/errata/RHBA-2023:7097


Note You need to log in before you can comment on or make changes to this bug.