Regression: systemd does not send all queued DBus Signals when a unit gets inactive

Bug #1632964 reported by seahawk1986
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
systemd (Ubuntu)
Fix Released
Undecided
Unassigned
Xenial
Fix Released
Undecided
Unassigned
Yakkety
Fix Released
Undecided
Unassigned
Zesty
Fix Released
Undecided
Martin Pitt

Bug Description

Since the penultimate systemd package update in september (229-4ubuntu8) systemd does not send the remaining queued DBus signals (e.g. PropertiesChanged) when a unit's state changes to inactive.

Sending those signals has been working since the release of Ubuntu 16.04 and it is quite unfortunate for my use case this got broken while fixing another bug.

Adding this upstream change to the package restores the old functionality (a patch for the current systemd package (systemd 229-4ubuntu10) for xenial is attached): https://github.com/systemd/systemd/commit/0dd99f86addd1f81e24e89807b6bc4aab57d5793

SRU TEST CASE: See comment #8
Regression potential: Low; the patch only widens the condition when a change signal is sent, thus at most clients would now get more D-Bus signals than before (in particular, the missing one at becoming inactive).

----
$ lsb_release -rd
Description: Ubuntu 16.04.1 LTS
Release: 16.04
----
package version: systemd 229-4ubuntu10

Revision history for this message
seahawk1986 (seahawk1986-hotmail) wrote :
Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "Patch for systemd-229-4ubuntu10" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]

tags: added: patch
Revision history for this message
Martin Pitt (pitti) wrote :

So I suppose this got broken as a subtle side effect from https://anonscm.debian.org/cgit/pkg-systemd/systemd.git/commit/?h=ubuntu-xenial&id=5c429176 (bug 1529079). Do you have a reproducer for this that we can use to verify the fix?

Revision history for this message
Martin Pitt (pitti) wrote :

I cherry-picked the patch into Debian master, which will sync into z-series: https://anonscm.debian.org/cgit/pkg-systemd/systemd.git/commit/?id=d261af7f0

Revision history for this message
Martin Pitt (pitti) wrote :
Changed in systemd (Ubuntu Yakkety):
status: New → In Progress
Revision history for this message
Martin Pitt (pitti) wrote :
Changed in systemd (Ubuntu Xenial):
status: New → In Progress
Revision history for this message
Martin Pitt (pitti) wrote :

Setting to "incomplete" as this still needs a reproducer for SRU verification.

Changed in systemd (Ubuntu Xenial):
status: In Progress → Incomplete
Revision history for this message
seahawk1986 (seahawk1986-hotmail) wrote :

I have been able to reproduce those missing signals most reliably within a systemd user session (for the system session it works most of the time):

Steps to reproduce missing dbus signals with Ubuntu 16.10 Desktop:

Create a ~/.config/systemd/user/terminal.service with this content:

[Unit]
Description=example unit to open a terminal

[Service]
Environment=DISPLAY=:0
ExecStart=/usr/bin/xterm
SuccessExitStatus=0 15

[Install]
WantedBy=default.target

Open two terminals. In the first one execute the attached test_systemd_signals.py (which looks for PropertiesChanged Signals):

$ python test_systemd_signals.py

To see all dbus messages during the test you can run "dbus-monitor --session" in another terminal.

In a second terminal start/stop the systemd unit:
$ systemctl --user daemon-reload
$ systemctl --user start terminal.service
$ systemctl --user stop terminal.service

With the current systemd package 231-9git1 the test script only shows two status changes (PropertiesChanged signals) sent by systemd:
ActiveState: active SubState: running
ActiveState: deactivating SubState: stop-sigterm

With the patched systemd package the test script should show the last change of the unit status (being set to inactive), too:
ActiveState: active SubState: running
ActiveState: deactivating SubState: stop-sigterm
ActiveState: inactive SubState: dead

Ubuntu 16.04 Desktop does not start a systemd user session by default - I created a package (based on https://github.com/joukewitteveen/xlogin) to simplify the process:
$ sudo add-apt-repository ppa:seahawk1986-hotmail/xlogin
$ sudo apt-get update
$ sudo apt-get install xlogin openbox

Create a ~/.xinitrc with this content (and make it executable):

#!/bin/bash
exec openbox-session

Then change to a tty console (or use a remote login via ssh):
$ sudo systemctl stop lightdm
$ sudo systemctl start xlogin@user # replace "user" with an existing user name

Now you can open two terminals (a right click on the desktop opens the openbox menu) and follow the steps for Ubuntu 16.10 above.

Martin Pitt (pitti)
description: updated
Changed in systemd (Ubuntu Xenial):
status: Incomplete → In Progress
Revision history for this message
Chris J Arges (arges) wrote : Please test proposed package

Hello seahawk1986, or anyone else affected,

Accepted systemd into xenial-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/systemd/229-4ubuntu12 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in systemd (Ubuntu Xenial):
status: In Progress → Fix Committed
tags: added: verification-needed
Revision history for this message
Andy Whitcroft (apw) wrote :

Hello seahawk1986, or anyone else affected,

Accepted systemd into yakkety-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/systemd/231-9ubuntu1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in systemd (Ubuntu Yakkety):
status: In Progress → Fix Committed
Revision history for this message
seahawk1986 (seahawk1986-hotmail) wrote :

Hello,
both systemd packages in the -proposed repository for xenial (229-4ubuntu12) and yakkety (231-9ubuntu1) are sending all the DBus signals I need to track unit state changes, thank you very much for fixing this regression.

Martin Pitt (pitti)
tags: added: verification-done
removed: verification-needed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package systemd - 231-10

---------------
systemd (231-10) unstable; urgency=medium

  [ Martin Pitt ]
  * systemctl: Add --wait option to wait until started units terminate again.
  * nss-resolve: return NOTFOUND instead of UNAVAIL on resolution errors.
    This makes it possible to configure a fallback to "dns" without breaking
    DNSSEC, with "resolve [!UNAVAIL=return] dns".
  * libnss-resolve.postinst: Skip dns fallback if resolve is present.
    Only fall back to "dns" if nss-resolve is not installed (for the
    architecture of the calling program). Once it is, we never want to fall
    back to "dns" as that breaks enforcing DNSSEC verification and also
    pointlessly retries NXDOMAIN failures. (LP: #1624071)
  * unit: sent change signal before removing the unit if necessary
    (LP: #1632964)
  * networkd: Fix assertion crash on adding VTI with IPv6 addresses
    (LP: #1633274)
  * debian/tests/upstream: Stop specifying initrd, it is autodetected now.
  * debian/tests/upstream: Add gcc/libc-dev/make test dependencies,
    so that the tests can build helper binaries.

  [ Felipe Sateler ]
  * Explicitly disable installing the upstream-provided PAM configuration.
  * Register interest in the status of dracut and initramfs-tools in reportbug
    template

  [ Michael Biebl ]
  * Stop creating systemd-update-utmp-runlevel.service symlinks manually

 -- Martin Pitt <email address hidden> Wed, 26 Oct 2016 13:24:37 +0200

Changed in systemd (Ubuntu Zesty):
status: Fix Committed → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package systemd - 229-4ubuntu12

---------------
systemd (229-4ubuntu12) xenial; urgency=medium

  * unit: sent change signal before removing the unit if necessary
    (LP: #1632964)
  * networkd: Fix assertion crash on adding VTI with IPv6 addresses
    (LP: #1633274)
  * systemd-networkd-resolvconf-update.service: Propagate search domains
    (LP: #1635256)

 -- Martin Pitt <email address hidden> Wed, 26 Oct 2016 13:18:42 +0200

Changed in systemd (Ubuntu Xenial):
status: Fix Committed → Fix Released
Revision history for this message
Martin Pitt (pitti) wrote : Update Released

The verification of the Stable Release Update for systemd has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package systemd - 231-9ubuntu1

---------------
systemd (231-9ubuntu1) yakkety; urgency=medium

  * debian/gbp.conf: Switch to yakkety branch
  * unit: sent change signal before removing the unit if necessary
    (LP: #1632964)
  * networkd: Fix assertion crash on adding VTI with IPv6 addresses
    (LP: #1633274)

 -- Martin Pitt <email address hidden> Wed, 26 Oct 2016 13:11:33 +0200

Changed in systemd (Ubuntu Yakkety):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.