https://bugs.kde.org/show_bug.cgi?id=526660

Seitaro Sugawara <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[email protected]
                   |                            |m

--- Comment #3 from Seitaro Sugawara <[email protected]> ---
I think I am seeing the same issue, and I was able to track down the cause on
my machine.

Environment:
- MacBook Pro M1 (MacBookPro17,1), macOS 27.0.1
- KStars 3.8.5, both the arm64 and Intel DMG builds

Symptom:
KStars shows a Dock icon but no window, same as described above. A macOS hang
report shows the main thread blocked in KDBusService::KDBusService() ->
QDBusConnection::sessionBus(), and the QDBusConnectionManager thread waiting
forever in dbus_bus_register() -> dbus_connection_send_with_reply_and_block().
No dbus-daemon process is running.

Cause:
The launchd job created by KStars
(~/Library/LaunchAgents/org.freedesktop.dbus-kstars.plist, pointing to
/Applications/kstars.app/Contents/MacOS/dbus-daemon with
Sockets/unix_domain_listener and
SecureSocketWithKey=DBUS_LAUNCHD_SESSION_BUS_SOCKET) never starts successfully:

  $ launchctl print gui/$(id -u)/org.freedesktop.dbus-kstars
    state = spawn scheduled
    last exit code = 1

After adding StandardErrorPath to the plist, dbus-daemon logs:

  dbus-daemon[2354]: Failed to start message bus: Expected 1 socket from
launchd, got 0.

launchd does create the socket (launchctl getenv
DBUS_LAUNCHD_SESSION_BUS_SOCKET returns a valid path), so KStars connects to
it, but dbus-daemon exits because the launchd check-in returns no sockets.
KStars then waits for a reply forever.

What I checked:
- Reproduced with the plist generated by KStars itself, and on a freshly
created macOS user account (so it is not a per-user configuration issue).
- The Intel build of 3.8.5 fails the same way on this Mac.
- The plist has no quarantine attribute (only com.apple.provenance), and the
job is enabled and allowed in Background Task Management (sfltool dumpbtm).
- Another user reports that both the arm64 and Intel builds of 3.8.5 work fine
on a MacBook Air M1 with macOS 15.7.3 Sequoia.
- Since this report is on macOS 26.6.2, the launchd socket activation used by
dbus (launch_msg / LAUNCH_KEY_CHECKIN) may no longer work on macOS 26 and
later. That could also explain why it does not reproduce on a Mac with an older
macOS.

The bundled dbus-daemon itself works. KStars starts normally when the bus is
started manually:

  /Applications/kstars.app/Contents/MacOS/dbus-daemon --nofork \
    --config-file=/Applications/kstars.app/Contents/PlugIns/dbus/kstars.conf \
    --address=unix:path=$HOME/kstars-dbus.sock
  DBUS_SESSION_BUS_ADDRESS=unix:path=$HOME/kstars-dbus.sock
/Applications/kstars.app/Contents/MacOS/kstars

Workaround I am using now: a LaunchAgent with RunAtLoad/KeepAlive that starts
the bundled dbus-daemon with --address=unix:path=... and sets
DBUS_SESSION_BUS_ADDRESS via "launchctl setenv". With this, KStars starts
normally from Finder.

Two additional observations:
1. On a fresh user account, the first launch exits immediately with
"kf.dbusaddons: DBus session bus not found", because
org.freedesktop.dbus-kstars.plist does not exist yet. It seems to be created
only after KStars has connected to a session bus.
2. When the bus never answers, KStars hangs silently with no error message,
which makes this hard for users to diagnose.

For other affected users, these two commands should show whether it is the same
problem:

  launchctl print gui/$(id -u)/org.freedesktop.dbus-kstars | grep -E
"state|last exit"
  pgrep -l dbus-daemon

I can provide the full hang report and more logs if needed.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to