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

            Bug ID: 528695
           Summary: Sound-only notification (Action=Sound without Popup)
                    never emits closed(), so ksmserver always waits its 5
                    s fallback at logout
    Classification: Frameworks and Libraries
           Product: frameworks-knotifications
      Version First 6.31.0
       Reported In:
          Platform: Fedora RPMs
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
  Target Milestone: ---

Since kf6-knotifications 6.31 (likely earlier too), a notification whose event
config has `Action=Sound` and no `Popup` never emits `KNotification::closed()`.

This is visible at every logout on Fedora. Fedora's kde-settings sets
`[Event/exitkde] Action=Sound`, and ksmserver (plasma-workspace 6.8.2,
`ksmserver/logout.cpp`) waits for `closed()` of the `exitkde` notification
before it answers `closeSession`. The wait is capped by
`QTimer::singleShot(5000, …logoutSoundFinished)`. Since `closed()` never
arrives, every logout/shutdown/reboot takes an extra ~5 s. The fix for bug
491745 (commit 66795a88, "Only wait for exit sound to *complete* before
logout") is present in 6.8.2. It lets killing and the sound run in parallel,
but the logout still waits the full fallback timer.

Code path (knotifications 6.31):
- `KNotificationManager::notify()`: Action is non-empty → `d->plugin->notify(n,
config)` (NotifyByPopup on Plasma)
- `NotifyByPopup::notify()`: `Popup` flag not set → no
`sendNotificationToServer`/`finish`; `Sound` flag set → `m_audio->notify(...)`
- `NotifyByAudio::finishCallback()` → `finishNotification()` only removes the
id from `m_notifications`/`m_loopSoundUrls`, and nothing calls
`finish(notification)`. On `playSound()` failure ("Failed to play sound with
canberra: File or data not found") it returns early, also without `finish`.
→ `KNotificationPlugin::finished` is never emitted for the notification, so
`KNotification::closed()` never fires.

I tested three variants and the delay is the same in each: the sound file
missing (canberra error), the sound present (0.1 s silent file in the theme),
and the default theme. Setting `Action=None` for `exitkde` in
`~/.config/plasma_workspace.notifyrc` makes `closed()` immediate (`ref();
deref();` path), and the gap drops to 0.05 s.

Evidence (session D-Bus monitor during logout, Plasma 6.8.2 Wayland, Fedora
44):
```
93.014  plasma-shutdown → ksmserver  closeSession
93.018  ksmserver: KSMServer::completeKilling clients.count()= 0
        … no D-Bus traffic for 4.8 s …
97.824  ksmserver → plasma-shutdown  method return (closeSession)
97.825  plasma-shutdown → KWin  closeWaylandWindows   (returns in <1 ms)
```
Over 6 logouts the gap was 4.77–5.35 s, which matches the 5000 ms CoarseTimer.

Expected: NotifyByAudio emits `finished` (via NotifyByPopup) when canberra
playback completes or fails, for notifications that have no popup. Then
ksmserver waits only as long as the sound really plays.

Related: bug 491745. Fedora downstream report about the kde-settings default
will follow.

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

Reply via email to