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

Umut Tezduyar Lindskog umut at tezduyar.com
Fri Oct 24 06:19:58 PDT 2014


Hi,

Since you said you have covered my theories when you implemented, I
have stopped looking in to this.

Following:

[root at axis-00408cc563e5 /mnt/flash/root]27929# cat stress
#!/bin/sh

systemd-run --scope /bin/true &
systemd-run --scope /bin/true &
systemd-run --scope /bin/true &
systemd-run --scope /bin/true &
systemd-run --scope /bin/true &
systemd-run --scope /bin/true &
systemd-run --scope /bin/true &
systemd-run --scope /bin/true &
[root at axis-00408cc563e5 /mnt/flash/root]27929# ./stress
[root at axis-00408cc563e5 /mnt/flash/root]27929# Running as unit run-27947.scope.
Running as unit run-27946.scope.
Running as unit run-27945.scope.
Running as unit run-27948.scope.
Running as unit run-27952.scope.
Running as unit run-27950.scope.
Running as unit run-27951.scope.
Running as unit run-27949.scope.

[root at axis-00408cc563e5 /mnt/flash/root]27929# systemctl -t scope
UNIT            LOAD   ACTIVE SUB     DESCRIPTION
run-27945.scope loaded active running /bin/true
run-27946.scope loaded active running /bin/true
run-27947.scope loaded active running /bin/true
run-27948.scope loaded active running /bin/true
run-27949.scope loaded active running /bin/true
run-27950.scope loaded active running /bin/true
run-27951.scope loaded active running /bin/true
run-27952.scope loaded active running /bin/true

LOAD   = Reflects whether the unit definition was properly loaded.
ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
SUB    = The low-level unit activation state, values depend on unit type.

8 loaded units listed. Pass --all to see loaded but inactive units, too.
To show all installed unit files use 'systemctl list-unit-files'.
[root at axis-00408cc563e5 /mnt/flash/root]27929# systemctl status run-27945.scope
● run-27945.scope - /bin/true
   Loaded: loaded (/run/systemd/system/run-27945.scope; static)
  Drop-In: /run/systemd/system/run-27945.scope.d
           └─50-Description.conf
   Active: active (running) since Fri 2014-10-24 13:13:26 GMT; 15s ago

On Fri, Oct 24, 2014 at 1:40 AM, Lennart Poettering
<lennart at poettering.net> wrote:
> On Mon, 29.09.14 15:34, Umut Tezduyar Lindskog (umut at tezduyar.com) wrote:
>
>> 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.
>
> Umut!
>
> At the hackfest in Düsseldorf you showed me an easy way how to
> reproduce this issue, what was that again?
>
> Lennart
>
> --
> Lennart Poettering, Red Hat


More information about the systemd-devel mailing list