altdesktop / python-dbus-next

🚌 The next great DBus library for Python with asyncio support
https://python-dbus-next.readthedocs.io/en/latest/
MIT License
191 stars 60 forks source link

Fix race condition in examples for high level service interface #39

Closed MarSoft closed 4 years ago

MarSoft commented 4 years ago

If we first request_name and then bus.export our service then there is a (short) period of time when we already own the name but our MessageBus class doesn't know which services shall it provide. As a result, if we get a request in this period of time, we will reply with an error "SERVICE.METHOD with signature SIGNATURE not found".

This situation will happen regularly if we are started by dbus-daemon because we were declared in the .service file. For example:

[D-BUS Service]
Name=test.name
Exec=/path/to/my/service.py

With the old vesion of examples, this will fail to handle the first request for which D-Bus started our service.

acrisci commented 4 years ago

:+1: