[systemd-devel] Race condition on systemd-run --scope

Umut Tezduyar Lindskog umut at tezduyar.com
Mon Sep 29 06:34:59 PDT 2014


Hi,

I have stumbled on a race condition on systemd-run --scope command.
Due to race condition, unit might show up as active/running even
though there is no process in the cgroup.

My best guess is we are missing the cgroup notification but when?

- Could it be that before systemd processes StartTransientUnit
message, before systemd places PID to the .scope cgroup folder,
process exits?
- Could it be that systemd somehow, occasionally misses the
notification sent from cgroup.

Before I go deep, does anyone have any idea?

Once the race happens, following is the output of show and status
commands. Notice there is no process in the output of status.

'systemctl status aa_40.scope' gives:
● aa_40.scope - AA application 'aa_40'
   Loaded: loaded (/run/systemd/system/aa_40.scope; static)
  Drop-In: /run/systemd/system/aa_40.scope.d
           └─50-Description.conf
   Active: active (running) since Fri 2014-09-26 13:59:32 GMT; 40min ago

Sep 26 13:59:32 axis-00408cc5a884 systemd[1]: Started AA application 'aa_40'.

'systemctl show aa_40.scope' gives:
TimeoutStopUSec=1min 30s
Result=success
Slice=system.slice
ControlGroup=/system.slice/aa_40.scope
CPUAccounting=no
CPUShares=18446744073709551615
StartupCPUShares=18446744073709551615
CPUQuotaPerSecUSec=(null)
BlockIOAccounting=no
BlockIOWeight=18446744073709551615
StartupBlockIOWeight=18446744073709551615
MemoryAccounting=no
MemoryLimit=18446744073709551615
DevicePolicy=auto
KillMode=control-group
KillSignal=15
SendSIGKILL=yes
SendSIGHUP=no
Id=aa_40.scope
Names=aa_40.scope
Wants=system.slice
Conflicts=shutdown.target
Before=shutdown.target
After=system.slice
Description=AA application 'aa_40'
LoadState=loaded
ActiveState=active
SubState=running
FragmentPath=/run/systemd/system/aa_40.scope
DropInPaths=/run/systemd/system/aa_40.scope.d/50-Description.conf
UnitFileState=static
InactiveExitTimestamp=Fri 2014-09-26 13:59:32 GMT
InactiveExitTimestampMonotonic=73340355
ActiveEnterTimestamp=Fri 2014-09-26 13:59:32 GMT
ActiveEnterTimestampMonotonic=73340355
ActiveExitTimestampMonotonic=0
InactiveEnterTimestampMonotonic=0
CanStart=yes
CanStop=yes
CanReload=no
CanIsolate=no
StopWhenUnneeded=no
RefuseManualStart=no
RefuseManualStop=no
AllowIsolate=no
DefaultDependencies=yes
OnFailureJobMode=replace
IgnoreOnIsolate=yes
IgnoreOnSnapshot=yes
NeedDaemonReload=no
JobTimeoutUSec=0
ConditionResult=yes
ConditionTimestamp=Fri 2014-09-26 13:59:32 GMT
ConditionTimestampMonotonic=73303280
Transient=yes

Thanks,
Umut


More information about the systemd-devel mailing list