Red Hat Bugzilla – Bug 998366
Power service provider - Possible race condition in code
Last modified: 2016-11-30 19:31:58 EST
Description of problem:
Possible race condition - unclean shutdown.
Step to reproduce:
In file power.c in function state_change_thread (on line 126)
173: succeeded = system("reboot --force &") == 0;
Initializes system reboot.
From line 210:
powerStateChangeJob->power->transitioningToPowerState = LMI_AssociatedPowerManagementService_TransitioningToPowerState_No_Change;
to line 230
is code, which should not be reached if restart is faster (SSD disks?).
Version-Release number of selected component (if applicable):
Last git commit:
Small window for race condition.
Maybe.. no window for race condition? :)
Maybe you should use:
http://www.freedesktop.org/wiki/Software/systemd/inhibit/(In reply to Robin Hack from comment #0)
> Description of problem:
> Possible race condition - unclean shutdown.
> Step to reproduce:
> In file power.c in function state_change_thread (on line 126)
> 173: succeeded = system("reboot --force &") == 0;
> Initializes system reboot.
> From line 210:
> powerStateChangeJob->power->transitioningToPowerState =
> to line 230
> is code, which should not be reached if restart is faster (SSD disks?).
> Version-Release number of selected component (if applicable):
> Last git commit:
> commit 6532d453d6d25b816c3e0c08de3d3cea46dce543
> How reproducible:
> Actual results:
> Small window for race condition.
> Expected results:
> Maybe.. no window for race condition? :)
Maybe you should use for systemd:
Maybe I miss point here, if system reboots, I don't see any possibility that the provider reaches line 230 and the machine is already restarted. The machine must turn off itself first, i.e. clearing all memory and loading fresh kernel, CIMOM and the provider.
system("reboot --force &") == 0; is nonsense and need to find solution.
Developers should solve this in time.
This is theoretical possibility of race condition.
It's not urgent (maybe wont fix).
3) What about suspend? What if machine run to sleep before provider sends ACK to client?
2) reboot is graceful, i.e. systemd stops the CIMOM and the CIMOM stops the provider, finishing all operations which are in progress.
3) sleep is not graceful, i.e. the machine could really shut down itself before sending a response, I am not sure if there is a sane way out of this problem.
I'm not sure what would be the proper solution of this bug. The provider should first reply to the client (via CIMOM) and then execute the operation. But I don't see any possibility for the provider to know when CIMOM finish processing the response.
In general, there are couple of cases that should be OK:
* graceful reboot
* graceful poweroff
Problematic cases are these:
* force reboot
* force poweroff
We can add some sleep to the working thread before executing the action, but is just workaround that will minimize the issue.
I'll move this to next release since it's not that urgent.
I would say that not getting a reply when one want to execute 'reboot --force' is correct behaviour. If you want to know if the shutdown/reboot was successfully executed, don't use the '--force'.
Marking this as wontfix, it's not possible to fix this bug properly.