Bug 1340508 - systemd-run --user --scope creates scopes that survive even when empty
Summary: systemd-run --user --scope creates scopes that survive even when empty
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: systemd
Version: 23
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: systemd-maint
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-05-27 15:36 UTC by Andy Lutomirski
Modified: 2016-11-25 22:22 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-11-25 22:22:45 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Andy Lutomirski 2016-05-27 15:36:52 UTC
I'm using systemd-222-14.fc23.x86_64.  I'm filing this here instead of upstream because upstream discourages bugs against versions of systemd that are this old.


$ systemd-run --user --scope echo foo
Running scope as unit run-4980.scope.
foo

$ systemctl --user status run-4980.scope
● run-4980.scope - /usr/bin/echo foo
   Loaded: loaded (/run/user/1000/systemd/user/run-4980.scope; static;
vendor preset: enabled)
  Drop-In: /run/user/1000/systemd/user/run-4980.scope.d
           └─50-Description.conf
   Active: active (running) since Fri 2016-05-27 08:16:03 PDT; 14s ago

Shouldn't the default be to remove the scope when all its processes
are gone?  The manpage for systemd-run says:

       --remain-after-exit
           After the service or scope process has terminated, keep the service
           around until it is explicitly stopped. This is useful to collect
           runtime information about the service after it finished running.
           Also see RemainAfterExit= in systemd.service(5).

and I did *not* set that flag.

I'm not sure whether this is a code bug or a documentation bug.  If the former, please fix it :)  If the latter, at the very least, please improve the manpage
description of --scope should IMO be improved and reconsider the recommendation
to use it for long-running processes.

IMO the ideal behavior would be for the scope to automatically terminate when it becomes empty.

FWIW, the desired behavior seems to happen if I do:

$ systemd-run --user --service-type=forking /bin/bash -c "/bin/sleep 20 &"
Running as unit run-7737.service.

The service survives until everything is done.

Comment 1 Zbigniew Jędrzejewski-Szmek 2016-05-28 03:50:51 UTC
It's a bug, scopes should terminate on their own. It's probably another variant of the problem with missing notifications about cgroups becoming empty. I don't remember the bug number atm.

Comment 2 Fedora End Of Life 2016-11-25 09:08:53 UTC
This message is a reminder that Fedora 23 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 23. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '23'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 23 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 3 Andy Lutomirski 2016-11-25 22:22:45 UTC
This appears to be fixed in Fedora 25.


Note You need to log in before you can comment on or make changes to this bug.