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

[email protected] changed:

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

--- Comment #2 from [email protected] ---
Same thing here, measured, on 25.12.3 — the D-Bus traffic answers the question
in comment 1
(what keeps the model busy after resume).

Environment: Kubuntu 26.04, kdeconnect 25.12.3 (distro package), Plasma 6.6.6,
Qt 6.10.2,
Wayland, Android phone with KDE Connect 1.37.3, 136 phone notifications
mirrored.

What happened: after resume from suspend the panel and notification popups
ignored clicks for
roughly 7–10 minutes, then recovered by themselves (no restart). The same
symptom happened
three times in four days; this is the only occurrence I measured, so I am not
claiming the
other two had the same cause.

Measurements during the freeze (dbus-monitor, session bus, 5 s window):
- plasmashell → kdeconnectd: 5803 org.freedesktop.DBus.Properties.Get calls in
5 s
  (~1160/s), later 2446 and 2666 per 3 s; all blocking, from the main thread.
- Paths /modules/kdeconnect/devices/<id>/notifications/<n>, properties
dismissable,
  appName, title, text, iconPath, replyId.
- One notification's "dismissable" was read 527 times in 5 s.
- 42 UnknownObject errors: reads of notification objects that had already been
removed.
- org.freedesktop.Notifications.GetServerInformation (served by the plasmashell
main thread)
  timed out after 6 s, while Peer.Ping to plasmashell still answered.
- Even without a storm, just opening the applet popup with 119 notifications
costs ~1100
  synchronous Properties.Get calls and freezes the shell for 7–8 s (measured
three times);
  every notification update while the popup is open costs the same again.

Mechanism in 25.12.3, as I read the code:
1. NotificationsModel::notificationUpdated() emits dataChanged for all rows
when any one
   notification emits ready (full range since fbf8852d6, 2017; ready-driven
since 74e7a90cd,
   2019).
2. data() reads every role with a synchronous property call — the FIXME "Add a
cache?" has
   been there since 2013 (1cb1b2641).
3. isAnyDimissable is a loop over D-Bus, bound in the header and in every
delegate
   (802bb26a2, 2013), re-evaluated on every dataChanged/rowsInserted.
So each ready costs roughly 6·N + (N+1)·k blocking calls; with N=136 that is
~1000 per event.

Where the ready stream comes from after resume:
- The daemon's NotificationsPlugin::receivePacket() calls update() for a known
id, and
  Notification::update() → createKNotification() → show() always emits ready,
even when the
  content and payloadHash did not change. Icons that still need downloading
emit ready again
  when the transfer finishes.
- The Android app (1.37.3 here) pushes all current notifications whenever its
notifications
  plugin is created — 9ebd3ee59 (1.35.16) and a74d7a56 (1.37.1) — and sends
them again in
  reply to the desktop's "request" from NotificationsPlugin::connected(), so
one reconnect can
  deliver the full set twice. Filed separately for the Android app: bug 528848.
The resent
  packets are silent, so no popups repeat, but every one of them is another
ready on the
  desktop. If the second batch arrives while an icon of the first is still
downloading,
  addNotification() removes the pending one and re-adds it under a new public
id, which
  would explain the UnknownObject errors (inferred from the code, not
verified).

Nothing here looks like a desktop regression: all pieces date from 2013–2019.
The duplicate
resend on the Android side (2026-09) multiplies the number of ready signals per
reconnect.

master already fixes the quadratic part: b180447d (dataChanged only for the
sender row),
e4e378e8 (cached isAnyDismissable, bug 527656) and 6645a72b (interface leak on
removal).
They are in v26.11.80 and not in release/26.08.

Suggestions, in the direction the code is already going (async D-Bus,
incremental models):
1. Backport b180447d, e4e378e8 and 6645a72b to the stable branch (without the
   isAnyDimissable → isAnyDismissable rename, so third-party QML keeps working)
—
   distributions on 25.12/26.08 freeze for minutes on every resume, and e.g.
Ubuntu 26.04
   (LTS) ships 25.12.3 with no newer package in the Kubuntu backports PPA.
2. Close the 2013 FIXME: cache all roles in NotificationsModel, filled by an
asynchronous
   Properties.GetAll when a row is added and on ready; data() serves the cache.
That also
   stops the model from blocking plasmashell when kdeconnectd itself is stuck
(the second
   trace in this bug, and bug 526760).
3. Daemon: in Notification::update(), do not emit ready (and do not rebuild the
   KNotification) when nothing changed.
4. Android (bug 528848): send the current notifications once per connection
(either the
   listener path or the reply to "request"), or have the desktop skip its
request when it
   already got them.
5. Daemon: when a packet arrives for an id whose Notification is still waiting
for its icon,
   update the pending object instead of creating a second one.

Workaround I use until a fix ships: a local copy of the plasmoid where the
notifications list
gets its model only while the popup is expanded, is a ListView instead of a
Repeater (only the
rows in view are created), and isAnyDimissable is read once per device. With
the popup closed,
dbus-monitor shows 0 calls to kdeconnectd in 10 s; opening it costs ~80 calls
instead of
~1100. Scrolling still stutters, because every row that comes into view makes
six blocking
reads — which is why I think the role cache (2.) is the real fix. Popups for
phone
notifications are unaffected because kdeconnectd sends them itself.

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

Reply via email to