[Bug 2015126] Re: systemd doesn't successfully enforce RuntimeMaxSec for gnome session

Nick Rosbrook 2015126 at bugs.launchpad.net
Fri Apr 21 19:43:34 UTC 2023


Thanks, that is very helpful. I tested this for service units too, and
got the same result:

$ systemd-run -u test-1.service -p RuntimeMaxSec=1m /usr/bin/bash -c 'while true; do sleep 1; done'
$ systemctl suspend # Waited a bit...

After resume:

$ systemctl status test-1.service
● test-1.service - /usr/bin/bash -c while true; do sleep 1; done
     Loaded: loaded (/run/systemd/transient/test-1.service; transient)
  Transient: yes
     Active: active (running) since Fri 2023-04-21 15:35:17 EDT; 2min 15s ago
      Until: Fri 2023-04-21 15:36:17 EDT; 1min 15s ago
   Main PID: 61473 (bash)
      Tasks: 2 (limit: 18896)
     Memory: 572.0K
        CPU: 138ms
     CGroup: /system.slice/test-1.service
             ├─61473 /usr/bin/bash -c "while true; do sleep 1; done"
             └─62087 sleep 1

Apr 21 15:35:17 six systemd[1]: Started test-1.service - /usr/bin/bash -c while true; do sleep 1; done.
$ systemctl status test-1.service
× test-1.service - /usr/bin/bash -c while true; do sleep 1; done
     Loaded: loaded (/run/systemd/transient/test-1.service; transient)
  Transient: yes
     Active: failed (Result: timeout) since Fri 2023-04-21 15:37:35 EDT; 1s ago
   Duration: 2min 18.274s
    Process: 61473 ExecStart=/usr/bin/bash -c while true; do sleep 1; done (code=killed, signal=TERM)
   Main PID: 61473 (code=killed, signal=TERM)
        CPU: 145ms

Apr 21 15:35:17 six systemd[1]: Started test-1.service - /usr/bin/bash -c while true; do sleep 1; done.
Apr 21 15:37:35 six systemd[1]: test-1.service: Service reached runtime time limit. Stopping.
Apr 21 15:37:35 six systemd[1]: test-1.service: Failed with result 'timeout'.

I am not sure if this is the intended behavior, so I will look into it
further. The fact that the "Until: " line shows a time in the past makes
me think this is not the intended behavior, and that timers should be
restarted on suspend (which will immediately timeout if the time is in
the past).

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to systemd in Ubuntu.
https://bugs.launchpad.net/bugs/2015126

Title:
  systemd doesn't successfully enforce RuntimeMaxSec for gnome session

Status in systemd package in Ubuntu:
  Triaged
Status in systemd source package in Jammy:
  Triaged
Status in systemd source package in Kinetic:
  Triaged

Bug description:
  On Jammy, I have configured systemd to set RuntimeMaxSec on certain
  user sessions:

  # cat /run/systemd/transient/session-43.scope 
  # This is a transient unit file, created programmatically via the systemd API. Do not edit.
  [Scope]
  Slice=user-1000.slice

  [Unit]
  Description=Session 43 of User xavier
  Wants=user-runtime-dir at 1000.service
  Wants=user at 1000.service
  After=systemd-logind.service
  After=systemd-user-sessions.service
  After=user-runtime-dir at 1000.service
  After=user at 1000.service
  RequiresMountsFor=/home/xavier

  [Scope]
  SendSIGHUP=yes
  TasksMax=infinity
  RuntimeMaxSec=2h
  #

  I have verified that this does what's expected on an ssh session, and
  kills the session when the runtime max has been reached.

  But on a GNOME login session (using X), this apparently doesn't work:
  the session is still running 17 hours after it should have been
  terminated.

  My guess is that systemd is ending the session by sending a signal
  that is being ignored by the GNOME login session?

  RuntimeMaxSec is not very useful if it's advisory...

  ProblemType: Bug
  DistroRelease: Ubuntu 22.04
  Package: systemd 249.11-0ubuntu3.7
  ProcVersionSignature: Ubuntu 5.19.0-38.39~22.04.1-generic 5.19.17
  Uname: Linux 5.19.0-38-generic x86_64
  ApportVersion: 2.20.11-0ubuntu82.3
  Architecture: amd64
  CasperMD5CheckResult: pass
  CurrentDesktop: ubuntu:GNOME
  Date: Mon Apr  3 12:20:22 2023
  InstallationDate: Installed on 2023-01-22 (70 days ago)
  InstallationMedia: Ubuntu 22.04.1 LTS "Jammy Jellyfish" - Release amd64 (20220809.1)
  MachineType: LENOVO 2306CTO
  ProcEnviron:
   TERM=xterm-256color
   PATH=(custom, no user)
   XDG_RUNTIME_DIR=<set>
   LANG=en_US.UTF-8
   SHELL=/bin/bash
  ProcKernelCmdLine: BOOT_IMAGE=/boot/vmlinuz-5.19.0-38-generic root=UUID=c415e6a8-5cd2-4d08-913d-14c00b792374 ro quiet splash vt.handoff=7
  SourcePackage: systemd
  UpgradeStatus: No upgrade log present (probably fresh install)
  dmi.bios.date: 10/25/2013
  dmi.bios.release: 2.57
  dmi.bios.vendor: LENOVO
  dmi.bios.version: G2ET97WW (2.57 )
  dmi.board.asset.tag: Not Available
  dmi.board.name: 2306CTO
  dmi.board.vendor: LENOVO
  dmi.board.version: Not Defined
  dmi.chassis.asset.tag: No Asset Information
  dmi.chassis.type: 10
  dmi.chassis.vendor: LENOVO
  dmi.chassis.version: Not Available
  dmi.ec.firmware.release: 1.13
  dmi.modalias: dmi:bvnLENOVO:bvrG2ET97WW(2.57):bd10/25/2013:br2.57:efr1.13:svnLENOVO:pn2306CTO:pvrThinkPadX230:rvnLENOVO:rn2306CTO:rvrNotDefined:cvnLENOVO:ct10:cvrNotAvailable:skuLENOVO_MT_2306:
  dmi.product.family: ThinkPad X230
  dmi.product.name: 2306CTO
  dmi.product.sku: LENOVO_MT_2306
  dmi.product.version: ThinkPad X230
  dmi.sys.vendor: LENOVO

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/2015126/+subscriptions




More information about the foundations-bugs mailing list