Orphaned dbus-daemon instances on Linux

I upgraded to 3.0.1 (command line) from 2.7.2 in October and have been seeing some strange issues on my server since related to exhausted inotify handles. I finally figured out this morning that it appears that each time I run my backups from CRON, a new dbus-daemon is getting spun up, once per command invocation. For example, in my backup script I run duplicacy twice to backup two different roots, and then run it once to copy the snapshots to backblaze. This means that every time my cron job runs, I get three orphaned dbus-daemon instances:

root      127832       1  0 05:42 ?        00:00:00 /usr/bin/dbus-daemon --syslog --fork --print-pid 4 --print-address 6 --session
root      127855       1  0 05:42 ?        00:00:00 /usr/bin/dbus-daemon --syslog --fork --print-pid 4 --print-address 6 --session
root      127878       1  0 05:42 ?        00:00:00 /usr/bin/dbus-daemon --syslog --fork --print-pid 4 --print-address 6 --session
root      131854       1  0 06:42 ?        00:00:00 /usr/bin/dbus-daemon --syslog --fork --print-pid 4 --print-address 6 --session
root      131877       1  0 06:42 ?        00:00:00 /usr/bin/dbus-daemon --syslog --fork --print-pid 4 --print-address 6 --session
root      131900       1  0 06:42 ?        00:00:00 /usr/bin/dbus-daemon --syslog --fork --print-pid 4 --print-address 6 --session
root      135564       1  0 07:42 ?        00:00:00 /usr/bin/dbus-daemon --syslog --fork --print-pid 4 --print-address 6 --session
root      135587       1  0 07:42 ?        00:00:00 /usr/bin/dbus-daemon --syslog --fork --print-pid 4 --print-address 6 --session
root      135610       1  0 07:42 ?        00:00:00 /usr/bin/dbus-daemon --syslog --fork --print-pid 4 --print-address 6 --session

Checking the GitHub repo, I found that dbus appears to be a transitive dependency, so I was first wondering if there’s a way to turn off its usage. I’m not sure what is pulling in that dependency.

If it can’t be disabled, I did find an article from RedHat that seems to indicate that I can maybe wrap the invocations in dbus-run-session so that it properly shuts down at the end of the job. I’m going to try that and will post back, but I wanted to put this up here in case anyone had a better idea, or runs into the same issue.

Confirmed that just calling duplicacy via dbus-run-session seems to fix it.

I believe if DBUS_SESSION_BUS_ADDRESS is set then Duplicacy won’t start a new dbus-run-session. Here is the relevant code: