Bug 69800 - Reload of systemd makes it restart service that was stopping
Summary: Reload of systemd makes it restart service that was stopping
Status: RESOLVED FIXED
Alias: None
Product: systemd
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Hardware: x86 (IA32) Linux (All)
: medium normal
Assignee: systemd-bugs
QA Contact: systemd-bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-09-25 09:16 UTC by Sylvia Else
Modified: 2013-10-08 03:47 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
Test case (10.00 KB, application/octet-stream)
2013-09-25 09:28 UTC, Sylvia Else
Details
Patch to correct bug (1.09 KB, patch)
2013-09-26 13:43 UTC, Sylvia Else
Details | Splinter Review

Description Sylvia Else 2013-09-25 09:16:33 UTC

    
Comment 1 Sylvia Else 2013-09-25 09:28:09 UTC
Created attachment 86539 [details]
Test case

See README file in tar archive
Comment 2 Sylvia Else 2013-09-25 09:33:25 UTC
If a systemctl stop foo command has been given, but the foo service has not yet stopped, and then the systemctl --system daemon-reload is given, then when the foo service eventually stops, systemd will restart it, when clearly it should not.

I speculate that the particular bit of state consisting of the fact that the service is being stopped gets lost in the process of serialization and deserialization.

Since it appears that a reload also occurs for systemctl disable foo, this makes it a particular gotcha for a service that is seeking to stop and disable itself.
Comment 3 Sylvia Else 2013-09-26 00:39:07 UTC
Further tests using systemctl is-active before and after the systemctl --system daemon-reload show that the service remains in the state "deactivating" until it stops, so the cause of its being restarted is presumably something rather more subtle than just losing the fact that it's being stopped :(
Comment 4 Sylvia Else 2013-09-26 09:56:46 UTC
Then again, I wasn't far off after all.

The Service type's forbid_restart field is not preserved by serialization/deserialization, so the fact that the service should not be restarted after stopping is lost.

I'll submit a proposed patch once I've tested it.
Comment 5 Sylvia Else 2013-09-26 13:43:39 UTC
Created attachment 86639 [details] [review]
Patch to correct bug
Comment 6 Zbigniew Jedrzejewski-Szmek 2013-10-08 03:47:03 UTC
Patch applied in http://cgit.freedesktop.org/systemd/systemd/commit/?id=6aca9a5.


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.