0

I have a systemd service, which is activated by a DBus service. The mechanism itself works:

  1. The systemd service is not running
  2. I send a call via DBus to the requested bus
  3. My service is started

The issue is that the message from step 2 is lost. I need to re-send the DBus call in order to get a response from the now-running service.

Is that behavior expected? Is there a way of queuing the message from 2 until the service is started, and delivering it then?

my dbus service file looks like this:

[D-BUS Service]
Name=d.d.service
Exec=/bin/false
SystemdService=dbus-example.service                                  

And my service file like this:

[Unit]
Description=example dbus service

[Service]
ExecStart=/home/daniel/Projects/dbus/asdf.sh
Type=dbus
BusName=d.d.service
Environment=DISPLAY=:0
2
  • Why is your service started through a shell script? What does the script contain? Commented Dec 4, 2024 at 7:38
  • The script starts a node process through asdf. The node process itself is long-running Commented Dec 4, 2024 at 11:32

1 Answer 1

0

Is that behavior expected?

No, it's not.

Is there a way of queuing the message from 2 until the service is started, and delivering it then?

That's the default behavior. See specification.

If the messages are lost, I suspect your service is connecting to the bus twice: the first connection claims the name, receives queued messages and does nothing with them, and is immediately replaced by a second connection that re-claims the name and starts processing messages.

Use dbus-monitor or busctl monitor to verify this – watch for the RequestName method and the NameOwnerChanged signal. (If they are repeated twice, then the above explanation applies.)

1
  • Thanks! I'll investigate Commented Dec 5, 2024 at 10:24

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.