Bug 1222064 - Spectacle segfaults when screen recording on Wayland (pipewire)
Summary: Spectacle segfaults when screen recording on Wayland (pipewire)
Status: RESOLVED FIXED
Alias: None
Product: openSUSE Tumbleweed
Classification: openSUSE
Component: KDE Applications (show other bugs)
Version: Current
Hardware: Other Other
: P5 - None : Normal (vote)
Target Milestone: ---
Assignee: E-Mail List
QA Contact: E-mail List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-03-27 11:39 UTC by Ferdinand Thiessen
Modified: 2024-04-10 18:33 UTC (History)
2 users (show)

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments
Output of GDB when segfaulting (28.45 KB, text/plain)
2024-03-27 11:39 UTC, Ferdinand Thiessen
Details
GDB backtrace (21.85 KB, text/plain)
2024-03-29 15:27 UTC, Ferdinand Thiessen
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ferdinand Thiessen 2024-03-27 11:39:26 UTC
Created attachment 873856 [details]
Output of GDB when segfaulting

Current Tumbleweed (and every version since KDE Plasma 6) segfaults when trying to record the screen on Wayland.

Reproduce:
1. Open Spectacle
2. Select "Record"
3. Choose any option (I chose rectangular area but it does not matter)
4. Start recording
5. Stop recording
6. See segfault on stop

Error (using GDB for debug info):

> Thread 191 "PipeWireProduce" received signal SIGSEGV, Segmentation fault.
> [Switching to Thread 0x7fff996006c0 (LWP 22415)]
> PipeWireRecordProduce::cleanup (this=0x555555f925e0) at /usr/src/debug/kpipewire-6.0.2/src/pipewirerecord.cpp:199

Hardware:
IdeaPad 5 14ALC05
(AMD Ryzen 5 5500U with integrated graphics)

Additional info:
I can not use X11 on Plasma 6 because that uses 100% CPU when screen is locked (kwin). So I am forced to use Wayland.
Comment 1 Christophe Marin 2024-03-27 12:28:56 UTC
> could not load multimedia backend ""                                                                                                                                                                                                                                             
> QtMultimedia is not currently supported on this platform or compiler.
> Failed to create QVideoSink "Not available"
> Failed to initialize QMediaPlayer "Not available"

I don't think that's what causes your crash, but I'll add a qt6-multimedia Requires to spectacle's spec file

I can't reproduce on wayland (with a NVidia card) and my spectacle version
Comment 2 Ferdinand Thiessen 2024-03-27 12:56:07 UTC
(In reply to Christophe Marin from comment #1)
> I don't think that's what causes your crash, but I'll add a qt6-multimedia
> Requires to spectacle's spec file

Yes I have installed that package, but it still segfaults.
I suspect an issue in kpipewire ?
Comment 3 Ferdinand Thiessen 2024-03-27 13:00:54 UTC
BTW in dmesg I receive this message on segfault:

> [ 8912.656331] PipeWireProduce[14032]: segfault at 0 ip 00007f070ee878a0 sp 00007f0699bff050 error 4 in libKPipeWireRecord.so.6.0.2[7f070ee81000+d000] likely on CPU 0 (core 0, socket 0)
> [ 8912.656363] Code: ff 66 0f 1f 84 00 00 00 00 00 48 8b 44 24 38 64 48 2b 04 25 28 00 00 00 75 32 48 83 c4 48 5b 5d c3 66 0f 1f 84 00 00 00 00 00 <48> 8b 04 25 00 00 00 00 0f 0b 66 0f 1f 44 00 00 e8 7b eb ff ff 0f
Comment 4 Vasilis Liaskovitis 2024-03-27 15:09:19 UTC
Can you provide a gdb trace:

- zypper in systemd-coredump (if systemd-coredump is not installed yet)

- make sure the systemd-coredump service is enabled.

- Produce the crash by trying to record wayland screen.

- coredumpctl list

- coredumpctl gdb PID-of-Spectacle-process

gdb> thread apply all bt

I did a quick internet search. If you are using NVIDIA, it might be the same issue as upstream bug:

https://bugs.kde.org/show_bug.cgi?id=481977
Comment 5 Christophe Marin 2024-03-27 15:25:09 UTC
(In reply to Vasilis Liaskovitis from comment #4)
> 
> I did a quick internet search. If you are using NVIDIA, it might be the same
> issue as upstream bug:
> 
> https://bugs.kde.org/show_bug.cgi?id=481977

The attached file indicates the reporter uses an AMD based card
Comment 6 Ferdinand Thiessen 2024-03-29 15:27:18 UTC
Created attachment 873933 [details]
GDB backtrace

GDB backtrace
Comment 7 Ferdinand Thiessen 2024-03-29 15:28:06 UTC
(In reply to Vasilis Liaskovitis from comment #4)
> Can you provide a gdb trace

Sure I added the backtrace.

> I did a quick internet search. If you are using NVIDIA, it might be the same
> issue as upstream bug:

No as written in the initial comment I am using an AMD 5500U with integrated graphics.
Comment 8 Ferdinand Thiessen 2024-04-04 19:26:36 UTC
It seems this is a regression of this commit:
https://invent.kde.org/plasma/kpipewire/-/commit/09124fb076346d0134c631966cdf6513b851708c

This:
```
    if (!m_encoder) {
        // Clear the queue of encoded packets.
        m_encoder->receivePacket();
    }
```

causes a null pointer de-reference and should be fixed to:

```
    if (m_encoder) {
        // Clear the queue of encoded packets.
        m_encoder->receivePacket();
    }
```

The segfault is then gone.

There also seems to be an upstream bug report: https://bugs.kde.org/show_bug.cgi?id=484620
Comment 9 Fabian Vogt 2024-04-05 08:46:10 UTC
Fixed upstream.

I wonder whether this is the cause or only a symptom of a deeper issue, m_encoder should probably not be null in the first place.
Comment 10 Ferdinand Thiessen 2024-04-10 18:33:26 UTC
Still segfaults with current openSUSE Tumbleweed. (Tumbleweed 2024-04-24)