I also suspected that xdg-desktop-portal-kde could be culprit. But after monitoring the D-Bus user session, I saw that the Flatpak app used org.freedesktop.Notifications directly.
I can reliably freeze the plasmashell process in under a minute with this script:
#!/usr/bin/env python3
from time import sleep
from pydbus import SessionBus
from gi.repository import GLib
from PIL import Image
import sys
import string
import secrets
def random_string(length=64):
alphabet = string.ascii_letters + string.digits
return "".join(secrets.choice(alphabet) for _ in range(length))
# Load and prepare the image
try:
img = Image.open("cover.png").convert("RGBA")
except Exception as e:
print("Failed to load image 'cover.png':", e)
sys.exit(1)
# Ensure image is exactly 640x640
if img.size != (640, 640):
print("Image must be 640x640 pixels.")
sys.exit(1)
width, height = img.size
channels = 4 # RGBA
rowstride = width * channels
bits_per_sample = 8
has_alpha = True
data = img.tobytes()
# Construct image-data struct
image_data = GLib.Variant(
"(iiibiiay)",
(
width,
height,
rowstride,
has_alpha,
bits_per_sample,
channels,
GLib.Variant("ay", data),
),
)
# Construct hints
hints = {
"sender-pid": GLib.Variant("x", 2),
"desktop-entry": GLib.Variant("s", "com.mastermindzh.tidal-hifi"),
"urgency": GLib.Variant("y", 1),
"image-data": image_data,
"resident": GLib.Variant("b", True),
}
# Connect to D-Bus
bus = SessionBus()
notifications = bus.get(".Notifications", "/org/freedesktop/Notifications")
while True:
# Send notification
notifications.Notify(
"tidal-hifi", # app_name
0, # replaces_id
"", # app_icon
random_string(), # summary
random_string(), # body
["default", "View"], # actions
hints, # hints dict
-1, # expire_timeout (in ms)
)
sleep(1)
Some strings in the script were extracted from the intercepted D-Bus message. I wanted to be as close to the original message as possible. They really don’t matter for this bug.
But I think it has something to do with the image data which is about 410 kB in size when loaded into memory. Multiplied by the number of messages this could introduce unintended side-effects.