Bug 463636

Summary: After sleep, KDE Connect complains about dBus service files
Product: [Applications] kdeconnect Reporter: Marcello Massaro <dev>
Component: macos-applicationAssignee: Weixuan XIAO <veyx.shaw>
Status: REPORTED ---    
Severity: normal CC: ian.h.chamberlain, kde, nagrapher, pfyu817
Priority: NOR    
Version: 22.12.0   
Target Milestone: ---   
Platform: macOS (DMG)   
OS: macOS   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Marcello Massaro 2022-12-30 19:55:25 UTC
SUMMARY
After sleep (e.g. after opening/closing the lid on a MBP), the kdeconnect app does not connect to a previously-paired device. In my case, and Android 11 phone.

If I got "Configure..." I get a weird message instead of my mDNS hostname. I couldn't copy the full string, and I don't know how long the computer needs to be in sleep state to reproduce this, but there was some error message about dBus .service files not found.

STEPS TO REPRODUCE
1. Let the computer go to sleep
2. Wait "some" time
3. Check the indicator's configuration

OBSERVED RESULT
The computer's hostname is replaced with some complaint about dbus .service file not found.

EXPECTED RESULT
The app should reconnect to known devices without problems.

SOFTWARE/OS VERSIONS
macOS: 13.1
Comment 1 Samuel 2023-06-21 05:45:13 UTC
*** Bug 470660 has been marked as a duplicate of this bug. ***
Comment 2 Ian H. Chamberlain 2024-07-02 17:08:01 UTC
I have been seeing this as well when waking my mac from sleep (both an ARM mac and an Intel mac on Sonoma 14.5). Seems it's been going on a while...

My guess is that there is some disconnect between the client (KdeConnectKcm?) and the bundled dbus daemon, since macOS doesn't have its own dbus by default. Probably most Linux users wouldn't run into this issue as a result?

I'm not sure how the lifecycle of the dbus daemon is managed, but maybe it becomes inactive during system sleep and would need to be reactivated / restarted when the system wakes. It also seems a bit odd that the "name" field is populated by what looks like an error message, so ideally that would probably get displayed as a popup or added as a warning to the main window, instead of the name?

If anyone else (i.e. maintainer / developer) has any ideas of where to look, I'm interested to help track this down more and maybe even fix it, but I am not sure the best place to start looking in the code. I can also try to collect logs or other debug information the next time this happens, if that's helpful!
Comment 3 Ian H. Chamberlain 2024-07-03 20:21:47 UTC
To add onto my previous comment: I reproduced again today, and I realized that actually the `dbus-daemon` process was still running, but `kdeconnectd` was not! During normal operation I see 3 processes - `kdeconnectd`, `kdeconnect-indicator`, and `dbus-daemon`, but when the issue occurred I only saw `kdeconnect-indicator` and `dbus-daemon`.

Perhaps there is something wrong with the launch daemon configuration that prevents it from restarting after sleep... I'll keep digging in and see if I can find any other clues.