Bug 58216 - if "systemctl daemon-reload" is executed right before timer expires, timer doesn't fire nor rearm
Summary: if "systemctl daemon-reload" is executed right before timer expires, timer do...
Status: RESOLVED FIXED
Alias: None
Product: systemd
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Hardware: All Linux (All)
: medium normal
Assignee: systemd-bugs
QA Contact: systemd-bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-12-12 23:04 UTC by Alex Jones
Modified: 2017-01-26 19:09 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
gzipped tar file containing files needed to reproduce the bug (647 bytes, text/plain)
2012-12-12 23:04 UTC, Alex Jones
Details

Description Alex Jones 2012-12-12 23:04:24 UTC
Created attachment 71415 [details]
gzipped tar file containing files needed to reproduce the bug

If "systemctl daemon-reload" is executed within a second of a timer expiring, the timer will not fire and will never be rearmed.  It stays in "elapsed" state forever.

I originally see this problem in OpenSUSE-12.1 which uses systemd-37, but I have tested this against the stock systemd-196, and the problem still exists there.

I've included a gzipped tarfile which contains a service file (elapsed-bug.service), a timer file (elapsed-service.timer), and a bash script which reproduces the bug.

How to reproduce the bug:

1) install the service and timer file in /etc/systemd/system
2) modify ExecStart in the service file to log something to a file or something of that nature (so you know the timer is running properly)
3) systemctl daemon-reload
4) systemctl enable elapsed-bug.timer
5) systemctl start elapsed-bug.timer
6) make sure the timer is running properly
7) run test1.sh (you may need to modify the awk field depending on the output of "systemctl status elapsed-bug.service")
8) it will print out a message that it has found the bug, and then exit (may take a minute or two)
9) verify that your printout (or whatever your ExecStart was doing) is no longer doing it
Comment 1 Sylvia Else 2013-09-27 01:01:01 UTC
I took a look at this, but was unable to reproduce the effect. Does the submitter believe that the problem still exists with systemd-204?
Comment 2 Eric Ewanco 2017-01-26 19:09:34 UTC
I retested this both in systemd-37 and systemd-228 and it now works.

I modified, for -228, the timer file to add AccuracySec=1s.

Because systemd has changed so much the original script was invalid, instead of running test1.sh I did the following to verify:

  while true; do systemctl daemon-reload; usleep 250000; done & (sleep 35; echo done)
  systemctl show --property SubState elapsed-bug.timer
  kill %%

This tested properly on both systems.  It failed ("elapsed") on -37 and succeeded ("waiting") on -228.  I also verified that the actual timer did or did not fire as the case may be.

(I sit next to Alex, who filed the bug, and have taken over responsibility for the project he found this on.)


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.