Your message dated Sun, 14 Sep 2025 11:44:36 +0000
with message-id <[email protected]>
and subject line Bug#1109272: fixed in python-dbusmock 0.37.0-1
has caused the Debian Bug report #1109272,
regarding python3-dbusmock: Possible race condition when setting up a private 
mock system bus
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
1109272: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1109272
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: python3-dbusmock
Version: 0.34.3-1
Severity: important
Tags: unreproducible
Control: affects -1 + src:mutter
User: [email protected]
Usertags: flaky

After my recent upload of mutter 48.4-2 to unstable, its autopkgtest 
failed on ppc64el. At least one of the failures (monitor-unit.test) had 
this logged, and the test subsequently timed out:

https://ci.debian.net/packages/m/mutter/testing/ppc64el/62167381/
https://ci.debian.net/data/autopkgtest/testing/ppc64el/m/mutter/62167381/artifacts.tar.gz
> Starting mocked services...
> Traceback (most recent call last):
>   File 
> "/usr/libexec/installed-tests/mutter-16/mutter-installed-dbus-session.py", 
> line 22, in <module>
>     result = meta_run(MutterDBusRunner,
>                       extra_env=extra_env,
>                       setup_argparse=add_extra_args,
>                       handle_argparse=handle_extra_args)
>   File "/usr/share/mutter-16/tests/mutter_dbusrunner.py", line 325, in 
> meta_run
>     return run_test_mocked(klass, rest,
>                            launch=args.launch,
>                            bind_sockets=True,
>                            extra_env=extra_env)
>   File "/usr/share/mutter-16/tests/mutter_dbusrunner.py", line 271, in 
> run_test_mocked
>     klass.setUpClass(launch=launch,
>     ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
>                      bind_sockets=bind_sockets)
>                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
>   File "/usr/share/mutter-16/tests/mutter_dbusrunner.py", line 67, in 
> setUpClass
>     (klass.mocks_manager, klass.mock_obj) = klass.start_from_local_template(
>                                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
>         'meta-mocks-manager', {'templates-dir': klass.__get_templates_dir()})
>         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>   File "/usr/share/mutter-16/tests/mutter_dbusrunner.py", line 119, in 
> start_from_local_template
>     return klass.start_from_template(template, params, system_bus=system_bus)
>            ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>   File "/usr/share/mutter-16/tests/mutter_dbusrunner.py", line 108, in 
> start_from_template
>     klass.spawn_server_template(template,
>     ~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^
>                                 params,
>                                 ^^^^^^^
>                                 get_subprocess_stdout(),
>                                 ^^^^^^^^^^^^^^^^^^^^^^^^
>                                 system_bus=system_bus)
>                                 ^^^^^^^^^^^^^^^^^^^^^^
>   File "/usr/lib/python3/dist-packages/dbusmock/testcase.py", line 438, in 
> spawn_server_template
>     server = SpawnedMock.spawn_with_template(template, parameters, bustype, 
> stdout, stderr=None)
>   File "/usr/lib/python3/dist-packages/dbusmock/testcase.py", line 614, in 
> spawn_with_template
>     server = SpawnedMock.spawn_for_name(module.BUS_NAME, module.MAIN_OBJ, 
> interface_name, bustype, stdout, stderr)
>   File "/usr/lib/python3/dist-packages/dbusmock/testcase.py", line 557, in 
> spawn_for_name
>     bus = bustype.get_connection()
>   File "/usr/lib/python3/dist-packages/dbusmock/testcase.py", line 58, in 
> get_connection
>     return dbus.bus.BusConnection(val)
>            ~~~~~~~~~~~~~~~~~~~~~~^^^^^
>   File "/usr/lib/python3/dist-packages/dbus/bus.py", line 120, in __new__
>     bus = cls._new_for_bus(address_or_type, mainloop=mainloop)
> dbus.exceptions.DBusException: org.freedesktop.DBus.Error.NoServer: Failed to 
> connect to socket /tmp/dbusmock_data_nh20oy7q/system_bus.socket: Connection 
> refused

I think this indicates that dbusmock started a dbus-daemon to be the 
mock system bus, but then attempted to connect to the socket before the 
dbus-daemon was listening on that socket. There is a (very) short window 
of time between bind() and listen() during which connection attempts 
will fail.

If my theory is correct, this will be difficult to reproduce on-demand: 
you would have to be very unlucky with how processes get scheduled.

dbus-daemon provides two mechanisms to avoid this race condition window:

1. If you run it with --print-address=FD and/or --print-pid=FD, and then 
read until EOF on the given file descriptor(s) (often 1 for stdout, but 
may be any writeable fd), then the read will block until after the 
dbus-daemon has called listen(), closing the race condition. This is how 
dbus-run-session(1) is implemented.

2. Or, if you run it with --fork, it will "daemonize" and the foreground 
process will not exit until the background process has called listen(). 
This is how dbus-launch(1) is implemented.

I would recommend (1.), blocking on a read() until --print-address or 
--print-pid has produced its result (you can ignore the printed address 
or pid if you don't need it). For example test/gvfs-test in 
gvfs_1.57.2-2 and tests/test-dconf.py in dconf_0.40.0-5 both do this, in 
a way that should be compatible with dbusmock's use of subprocess.Popen.

Thanks,
    smcv

--- End Message ---
--- Begin Message ---
Source: python-dbusmock
Source-Version: 0.37.0-1
Done: Martin Pitt <[email protected]>

We believe that the bug you reported is fixed in the latest version of
python-dbusmock, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to [email protected],
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Martin Pitt <[email protected]> (supplier of updated python-dbusmock package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing [email protected])


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Format: 1.8
Date: Sun, 14 Sep 2025 11:27:52 +0200
Source: python-dbusmock
Architecture: source
Version: 0.37.0-1
Distribution: unstable
Urgency: medium
Maintainer: Debian Python Team <[email protected]>
Changed-By: Martin Pitt <[email protected]>
Closes: 1109272
Changes:
 python-dbusmock (0.37.0-1) unstable; urgency=medium
 .
   * New upstream release:
     - templates: Drop iio-sensors-proxy (See
       https://github.com/martinpitt/python-dbusmock/issues/241)
     - DBusTestCase: Drop obsolete {start,stop}_dbus() methods
     - Fix dbus-daemon startup race condition (Closes: #1109272)
Checksums-Sha1:
 61dea0b64e5b4cc671eec7bbb9bc23f0cc072c79 2435 python-dbusmock_0.37.0-1.dsc
 8f4241e4b49a5d5a0b58442ec6a91047501d8226 107409 
python-dbusmock_0.37.0.orig.tar.gz
 14bbc4b5cdf2042c8555f9c7b34bb081ab96c637 9112 
python-dbusmock_0.37.0-1.debian.tar.xz
 82ceaa1df6aa764214aa78bce6faedac6a9cac13 6413 
python-dbusmock_0.37.0-1_source.buildinfo
Checksums-Sha256:
 e4f09da2a6180d69bddb8dcb356ed904c1013eaedd40ee28629f8d5e9d0f4f97 2435 
python-dbusmock_0.37.0-1.dsc
 38754c5ad2ad8f3936ff67d4b058bca416588a72bc094e91ded9f8f401b06310 107409 
python-dbusmock_0.37.0.orig.tar.gz
 bb41e41dd7fc35879d08e921108c12437e85b53d770166bf30e427593cf7f31d 9112 
python-dbusmock_0.37.0-1.debian.tar.xz
 4459947f88086da4a62f9797afc498c73f1f9ecbafd594dfc5064e603b56add6 6413 
python-dbusmock_0.37.0-1_source.buildinfo
Files:
 632c83faf4781bba90bac95066778fe7 2435 python optional 
python-dbusmock_0.37.0-1.dsc
 79bbdb32701feb7de3c7717771894856 107409 python optional 
python-dbusmock_0.37.0.orig.tar.gz
 1a8eba53a49af3718082014d589cfc18 9112 python optional 
python-dbusmock_0.37.0-1.debian.tar.xz
 b152efcbc915a42b947b4e4ffecc198e 6413 python optional 
python-dbusmock_0.37.0-1_source.buildinfo

-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEbEuHi35jHxYFV8PN7nvd5LhrVxMFAmjGixsACgkQ7nvd5Lhr
VxMZJQ/9EzpPOoecwBHKzD2l4W+DpRwnexYhNf3r0/Tm95oKAZlSl7Ni1QTeyAve
JQcdAQldNgw09B0SZBaWtjhMHe2AaaCmgB8k0q2PyAA/ZL33TbpohQSAH7E8hN9M
5jWKxVslEdcjifPKdjXP8N0OreJRuLofC3F5NVfHaROaev1qRPL0ZVse488Xpxg5
Y6tc5jEuAClUmn4tm2ag6IH6svCZ0XJiv4tfEOVnrrsRwz/k4iap6UCyb/KA/BZx
pCeinriarWtjPIAmVJP2xRxZZ4hk5lQ6l5Cdog092vm/VJmbU+URtrYfmN3IaepK
Gd8d5EOnrOIHJcuDGCVkXM/P3Dmht3q67jRnVRllGwWufZXJyuGF2JEW7umO5Kc8
DF3Q+NYg2yx7Qgfho9fVjiSPsxTbxbngKtGukArc9hlAs9aXy/y+9gwPlz3cO/U1
0TFboMrwhpzcR3cFl1ZEEtO7MqePniJ5CQk3oVosI8Z0UXz8RHD2Mz9Y+pDNf+jW
noceXVz44tedAH+gOYUc3KQSU8ohAuzJjx2Vo1iXHw6YQRAUUtsrFnvRT94QnmzK
d2ajINh1mhi3dWGMTPjcvx/6O7TeEMtI931fQNIg7MFcjwqZVl91UKxORDTHFyp4
3UIm2AP8SR+CfumAgUyTNHJZHzdaZLcY0mUxlxY6ExK6x+ICDxo=
=/ROg
-----END PGP SIGNATURE-----

Attachment: pgpA12jj00IyX.pgp
Description: PGP signature


--- End Message ---

Reply via email to