Bug 489434 - Spectacle crashes on finishing recording with pipewire 1.2.0
Summary: Spectacle crashes on finishing recording with pipewire 1.2.0
Status: RESOLVED FIXED
Alias: None
Product: KPipeWire
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: unspecified
Platform: Arch Linux Linux
: NOR crash
Target Milestone: ---
Assignee: Plasma Bugs List
URL:
Keywords:
: 489633 489656 489789 489795 (view as bug list)
Depends on:
Blocks:
 
Reported: 2024-06-29 13:37 UTC by Yujiro Hanma
Modified: 2024-07-27 21:33 UTC (History)
19 users (show)

See Also:
Latest Commit:
Version Fixed In: 6.1.3
Sentry Crash Report:


Attachments
all spectacle output when trying to record video (5.91 KB, text/plain)
2024-07-02 11:19 UTC, SigHunter
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Yujiro Hanma 2024-06-29 13:37:57 UTC
***
If you're not sure this is actually a bug, instead post about it at https://discuss.kde.org

If you're reporting a crash, attach a backtrace with debug symbols; see https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports
***

SUMMARY
With pipewire 1.2.0, spectacle crashes on trying to save a video file.

STEPS TO REPRODUCE
1. Record your screen
2. Try to finish the recording

OBSERVED RESULT
Spectacle stops responding and does not finish the recording.

EXPECTED RESULT
It should finish the recording.

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: Arch Linux
(available in About System)
KDE Plasma Version: 6.1.1
KDE Frameworks Version: 6.3.0
Qt Version: 6.7.2

ADDITIONAL INFORMATION
This is not related to the bug https://bugs.kde.org/show_bug.cgi?id=488896 which causes kpipewire to keep dropping frames on encoding with webm/vp9, since it would work when you switched the encoder to libx264.
Comment 1 pmargeti34 2024-06-30 10:12:13 UTC
Confirming

Linux/KDE Plasma: Arch Linux
(available in About System)
KDE Plasma Version: 6.1.1
KDE Frameworks Version: 6.3.0
Qt Version: 6.7.2
Pipewire 1.2.0
Comment 2 SigHunter 2024-07-02 11:19:15 UTC
Created attachment 171273 [details]
all spectacle output when trying to record video

I can also not record any video with spectacle at the moment. everything seems fine until I press the red button in systray to stop the recording. then nothing happens, the selection rectangle stays, the systray icon stays, file does not get saved, most of the time I have to kill spectacle with task manager (or ctrl + C when started from terminal)

since I also have pipewire-1.2.0 installed, like the bug mentions, I think this might be related. 
 
Operating System: Gentoo Linux 2.15
KDE Plasma Version: 6.1.1
KDE Frameworks Version: 6.3.0
Qt Version: 6.7.2
Kernel Version: 6.9.7-gentoo-dist (64-bit)
Graphics Platform: Wayland
Processors: 8 × Intel® Core™ i7-7700K CPU @ 4.20GHz
Memory: 23.2 GiB of RAM
Graphics Processor: Mesa Intel® Arc
Pipewire: 1.2.0
Comment 3 Noah Davis 2024-07-03 23:08:37 UTC
*** Bug 489656 has been marked as a duplicate of this bug. ***
Comment 4 Noah Davis 2024-07-03 23:15:03 UTC
I just upgraded to pipewire 1.2 and recording has stopped working for me as well. I get "*** pw_stream_destroy called from wrong context, check thread and locking: Not in loop" when I tried to finish recording in the terminal output and the app freezes. I'm not sure why this is happening. Moving this report to KPipeWire since that's where the error message is coming from. The place where it happens is PipeWireSourceStream::~PipeWireSourceStream().
Comment 5 filip.kendes1 2024-07-05 05:57:53 UTC
*** Bug 489633 has been marked as a duplicate of this bug. ***
Comment 6 hi 2024-07-05 06:29:25 UTC
Temporary fix is downgrading Pipewire to 1.0. Screen recording works again
Comment 7 filip.kendes1 2024-07-05 18:00:42 UTC
*** Bug 489795 has been marked as a duplicate of this bug. ***
Comment 8 filip.kendes1 2024-07-05 18:00:56 UTC
*** Bug 489789 has been marked as a duplicate of this bug. ***
Comment 9 pallaswept 2024-07-06 04:35:37 UTC
I also experience this bug. I'm very well tooled for testing pipewire, if I can be of assistance please let me know.

I notice the bug is not raised with the pipewire project. Is this believed to be a KDE bug, where the downgrade workaround is just a coincidence? Otherwise, it might be good to file this over there.
Comment 10 pallaswept 2024-07-07 21:10:41 UTC
(In reply to pallaswept from comment #9)
> I notice the bug is not raised with the pipewire project.

Now it is: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/4101
Comment 11 Torsten Wohlfarth (TUXEDO) 2024-07-08 12:44:29 UTC
This problem does not occur with Debian unstable, which is on Plasma 5.27.11 with kpipewire5 5.27.11-1. Here spectacle is working without problems if pipewire 1.2.0 is installed.
Comment 12 Noah Davis 2024-07-09 00:05:22 UTC
(In reply to pallaswept from comment #9)
> I notice the bug is not raised with the pipewire project. Is this believed
> to be a KDE bug, where the downgrade workaround is just a coincidence?
> Otherwise, it might be good to file this over there.

I wasn't sure yet and I wanted to do additional testing. In any case, thank you for posting the upstream bug report.
Comment 13 Arjen Hiemstra 2024-07-09 10:01:04 UTC
Git commit b787a4953130a14704183dd794e2dbb741001a8b by Arjen Hiemstra.
Committed on 09/07/2024 at 09:33.
Pushed by ahiemstra into branch 'master'.

produce: Destroy PipeWireSourceStream on the right thread

m_stream is created during initialize() which is run on the produce
thread, so we need to ensure we also destroy it on that thread as
otherwise with PipeWire 1.2+ we can end up in a deadlock.

M  +22   -5    src/pipewireproduce.cpp
M  +2    -0    src/pipewireproduce_p.h

https://invent.kde.org/plasma/kpipewire/-/commit/b787a4953130a14704183dd794e2dbb741001a8b
Comment 14 Arjen Hiemstra 2024-07-09 10:02:39 UTC
Git commit 1977da38ed25aa15347eb9027cb1fde3d66b075f by Arjen Hiemstra.
Committed on 09/07/2024 at 10:01.
Pushed by ahiemstra into branch 'Plasma/6.1'.

produce: Destroy PipeWireSourceStream on the right thread

m_stream is created during initialize() which is run on the produce
thread, so we need to ensure we also destroy it on that thread as
otherwise with PipeWire 1.2+ we can end up in a deadlock.


(cherry picked from commit b787a4953130a14704183dd794e2dbb741001a8b)

Co-authored-by: Arjen Hiemstra <ahiemstra@heimr.nl>

M  +22   -5    src/pipewireproduce.cpp
M  +2    -0    src/pipewireproduce_p.h

https://invent.kde.org/plasma/kpipewire/-/commit/1977da38ed25aa15347eb9027cb1fde3d66b075f
Comment 15 SigHunter 2024-07-09 14:12:02 UTC
(In reply to Arjen Hiemstra from comment #14)
> Git commit 1977da38ed25aa15347eb9027cb1fde3d66b075f by Arjen Hiemstra.
> Committed on 09/07/2024 at 10:01.
> Pushed by ahiemstra into branch 'Plasma/6.1'.
> 
> produce: Destroy PipeWireSourceStream on the right thread
> 
> m_stream is created during initialize() which is run on the produce
> thread, so we need to ensure we also destroy it on that thread as
> otherwise with PipeWire 1.2+ we can end up in a deadlock.
> 
> 
> (cherry picked from commit b787a4953130a14704183dd794e2dbb741001a8b)
> 
> Co-authored-by: Arjen Hiemstra <ahiemstra@heimr.nl>
> 
> M  +22   -5    src/pipewireproduce.cpp
> M  +2    -0    src/pipewireproduce_p.h
> 
> https://invent.kde.org/plasma/kpipewire/-/commit/
> 1977da38ed25aa15347eb9027cb1fde3d66b075f

very cool, I can confirm this works. 
patched kpipewire-6.1.2 on Gentoo and spectacle recording works again
Comment 16 elydgolden 2024-07-12 08:58:00 UTC Comment hidden (spam)
Comment 17 Nate Graham 2024-07-15 13:05:49 UTC Comment hidden (spam)
Comment 18 pallaswept 2024-07-27 21:33:27 UTC
Thanks, confirming this is fixed on my end, with the update to kpipewire 6.1.3.