Bug 437709 - Crash in KWin::SurfacePixmap::platformTexture
Summary: Crash in KWin::SurfacePixmap::platformTexture
Status: VERIFIED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: wayland-generic (show other bugs)
Version: unspecified
Platform: Neon Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
: 441947 (view as bug list)
Depends on:
Blocks:
 
Reported: 2021-05-26 18:25 UTC by techxgames
Modified: 2021-12-03 21:04 UTC (History)
15 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.23


Attachments
KWin Core Dump file (10.11 KB, text/plain)
2021-06-11 09:12 UTC, techxgames
Details
KWin Core Dump file (13.39 KB, text/plain)
2021-06-28 07:13 UTC, techxgames
Details
gdb.txt kwin-wayland (16.81 KB, text/plain)
2021-09-16 20:53 UTC, Pawel
Details
gdb backtrace (15.79 KB, text/plain)
2021-09-19 18:30 UTC, Pawel
Details
with debug symbols now (25.17 KB, text/plain)
2021-09-20 11:18 UTC, Pawel
Details

Note You need to log in before you can comment on or make changes to this bug.
Description techxgames 2021-05-26 18:25:53 UTC
SUMMARY
Whenever Plasma desktop crashes, I lose all of my currently open windows, and I get a lot of "<component> crashed" kind of pop up from Dr Konqi (i.e. KMail, KWallet), which asks me to report and/or restart.  I only do the latter because there are SO MANY.

STEPS TO REPRODUCE
Not sure how to reproduce it, but I remember it happened after I was a lot of the times while switching activities, but there are other times it just happens.

OBSERVED RESULT
The screen would go blank, then I would get spammed with "<component> crashed" error windows.  I would also need to enter my password on KWallet in order for Nextcloud to work again.

My Private Internet Access VPN gets disconnected, as well.

EXPECTED RESULT
When Plasma crashes, I was expecting it wouldn't take EVERYTHING down

SOFTWARE/OS VERSIONS
Operating System: KDE neon Unstable Edition
KDE Plasma Version: 5.22.80
KDE Frameworks Version: 5.83.0
Qt Version: 5.15.2
Kernel Version: 5.8.0-50-generic (64-bit)
Graphics Platform: Wayland
Processors: 4 × Intel® Core™ i7-4510U CPU @ 2.00GHz
Memory: 15.5 GiB of RAM
Graphics Processor: Mesa DRI Intel® HD Graphics 4400

ADDITIONAL INFORMATION
Perfectly aware that this is Unstable, so I checked if there were any updates related to Plasma, but none at the time of writing.
Might be KWin that crashed, but I wasn't sure.  I didn't get the popup that it was Plasma or KWin that crashed, but my desktop did crash.
Comment 1 Nate Graham 2021-05-26 21:54:54 UTC
It's not Plasma that's crashing and bringing everything down; it's KWin. This is a known issue that we are currently working on fixing. We can use this bug report to track when it's fixed.
Comment 2 Vlad Zahorodnii 2021-06-07 08:22:35 UTC
If kwin crashes, we will need a backtrace. Can you please check kwin's coredumps?

   coredumpctl list kwin_wayland

to get a backtrace run `coredumpctl gdb <pid>`
Comment 3 techxgames 2021-06-11 09:12:36 UTC
Created attachment 139226 [details]
KWin Core Dump file

Is this it?
Comment 4 Alex 2021-06-11 09:15:47 UTC
(In reply to techxgames from comment #3)
> Created attachment 139226 [details]
> KWin Core Dump file
> 
> Is this it?

Almost. Instead of quitting (with "q"), you should type the following commands into gdb:

set logging on
thread apply all bt

This will save the backtrace to gdb.txt. That is what we're after.
Comment 5 Bug Janitor Service 2021-06-26 04:33:48 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 6 techxgames 2021-06-26 11:31:00 UTC
(In reply to Alex from comment #4)
> (In reply to techxgames from comment #3)
> > Created attachment 139226 [details]
> > KWin Core Dump file
> > 
> > Is this it?
> 
> Almost. Instead of quitting (with "q"), you should type the following
> commands into gdb:
> 
> set logging on
> thread apply all bt
> 
> This will save the backtrace to gdb.txt. That is what we're after.

I've been trying to get it to crash, but it's been stable so far.  I tried to see if changing the button positions in window decorations work (after applying, it just freezes), but nothing.
Comment 7 techxgames 2021-06-27 06:03:48 UTC
I also need to inform you that running `qdbus org.kde.KWin /KWin reconfigure` just freezes KWin, and required me to do a hard reboot, but the setting does apply.

Nothing shows up when I do a `coredumpctl list kwin_wayland`, however.

Sorta does apply I think.
Comment 8 techxgames 2021-06-28 07:13:18 UTC
Created attachment 139712 [details]
KWin Core Dump file

I followed your instructions and here's the output.

Happened right after I switched to another activity.
Comment 9 David Edmundson 2021-06-28 10:02:05 UTC
Thread 1 (Thread 0x7f35799e6d80 (LWP 3775)):
#0  0x00007f35808f32f4 in KWin::SurfacePixmap::platformTexture() const () at /lib/x86_64-linux-gnu/libkwin.so.5
#1  0x00007f357852197a in  () at /usr/lib/x86_64-linux-gnu/qt5/plugins/org.kde.kwin.scenes/KWinSceneOpenGL.so
#2  0x000055ded3205ed7 in  ()
#3  0x00007f357ee4e77e in  () at /lib/x86_64-linux-gnu/libQt5Core.so.5
#4  0x00007f35808b07c8 in KWin::Scene::paintScreen(int*, QRegion const&, QRegion const&, QRegion*, QRegion*, KWin::RenderLoop*, QMatrix4x4 const&) () at /lib/x86_64-linux-gnu/libkwin.so.5
#5  0x00007f357851d67f in KWin::SceneOpenGL::paint(int, QRegion const&, QList<KWin::Toplevel*> const&, KWin::RenderLoop*) () at /usr/lib/x86_64-linux-gnu/qt5/plugins/org.kde.kwin.scenes/KWinSceneOpenGL.so
#6  0x00007f35807e8c58 in KWin::Compositor::composite(KWin::RenderLoop*) () at /lib/x86_64-linux-gnu/libkwin.so.5
#7  0x00007f357ee4e77e in  () at /lib/x86_64-linux-gnu/libQt5Core.so.5
#8  0x00007f358079efb6 in KWin::RenderLoop::frameRequested(KWin::RenderLoop*) () at /lib/x86_64-linux-gnu/libkwin.so.5
Comment 10 David Edmundson 2021-09-05 23:16:26 UTC
*** Bug 441947 has been marked as a duplicate of this bug. ***
Comment 11 Pawel 2021-09-16 20:53:53 UTC
Created attachment 141619 [details]
gdb.txt kwin-wayland

I just had the same crash (I think) - I have attached the gdb.txt file with the core dump.

Operating System: Arch Linux
KDE Plasma Version: 5.22.90
KDE Frameworks Version: 5.86.0
Qt Version: 5.15.2
Kernel Version: 5.13.0-1-amd-staging-drm-next-git-00935-gb44d240c34d2 (64-bit)
Graphics Platform: X11
Processors: 16 × AMD Ryzen 7 3700X 8-Core Processor
Memory: 31.3 GiB of RAM
Comment 12 Pawel 2021-09-19 18:30:43 UTC
Created attachment 141707 [details]
gdb backtrace

the wayland session crashes reliably for me every 15-20 minutes, making the wayland session unusable on arch. the crash is always in: KWin::SurfacePixmap::platformTexture()

I attach thread apply all bt full for the most recent crash
Comment 13 Vlad Zahorodnii 2021-09-20 08:35:01 UTC
I don't understand how kwin crash in platformTexture(). Could you please re-compile kwin so the backtrace includes debug symbols?
Comment 14 Pawel 2021-09-20 11:18:58 UTC
Created attachment 141727 [details]
with debug symbols now

Hi Vlad,

As requested, I have recompiled kwin with debug symbols and I have captured this crash again and applied thread apply all bt full.

The log is attached.
Comment 15 Bug Janitor Service 2021-09-20 11:24:43 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/1438
Comment 16 Pawel 2021-09-20 11:27:42 UTC
Hi Vlad,

Would you like me to apply this patch and re-test?

The crash occurs every 20-30 minutes of desktop use so I should be able to verify it resolves the issue.

Let me know.
Comment 17 Vlad Zahorodnii 2021-09-20 11:28:47 UTC
Yes please! If you can, please give it a try.
Comment 18 Pawel 2021-09-20 11:38:16 UTC
Cool , n/p

I have now re-compiled Kwin with this patch and I will report back.
Comment 19 Vlad Zahorodnii 2021-09-20 12:39:45 UTC
Git commit f2b6a6b2f6e9013a57efbda5cfea944558131aa4 by Vlad Zahorodnii.
Committed on 20/09/2021 at 12:39.
Pushed by vladz into branch 'master'.

scenes/opengl: Fix null dereference in OpenGLWindow::windowTexture()

If the SurfaceItem has no SurfacePixmap, kwin will crash when trying to
access the surface texture.

M  +1    -1    src/plugins/scenes/opengl/scene_opengl.cpp

https://invent.kde.org/plasma/kwin/commit/f2b6a6b2f6e9013a57efbda5cfea944558131aa4
Comment 20 Vlad Zahorodnii 2021-09-20 12:40:14 UTC
Git commit 7ad42418cf2791bec6befe0d21455f8990182009 by Vlad Zahorodnii.
Committed on 20/09/2021 at 12:40.
Pushed by vladz into branch 'Plasma/5.23'.

scenes/opengl: Fix null dereference in OpenGLWindow::windowTexture()

If the SurfaceItem has no SurfacePixmap, kwin will crash when trying to
access the surface texture.


(cherry picked from commit f2b6a6b2f6e9013a57efbda5cfea944558131aa4)

M  +1    -1    src/plugins/scenes/opengl/scene_opengl.cpp

https://invent.kde.org/plasma/kwin/commit/7ad42418cf2791bec6befe0d21455f8990182009
Comment 21 Pawel 2021-09-20 17:26:12 UTC
Hi Vlad,

So I have not had this crash for 8 hours now and I have been using the desktop extensively.

I think we can safely say this bug is resolved.

Many thanks for your help.
Comment 22 Pawel 2021-09-20 17:27:19 UTC
actually, 6 hours, but still I normally has a crash every 20-30 minutes, so my conclusion stands.
Comment 23 maringrly69 2021-11-22 03:02:28 UTC
When's the planned release for this fix? Hoping it's on 5.23.4...
Comment 24 Alex 2021-11-22 03:03:53 UTC
(In reply to maringrly69 from comment #23)
> When's the planned release for this fix? Hoping it's on 5.23.4...

It's on the 5.23 branch, so yes.
Comment 25 Alex Elsayed 2021-12-03 11:07:07 UTC
(In reply to Nate Graham from comment #1)
> It's not Plasma that's crashing and bringing everything down; it's KWin.
> This is a known issue that we are currently working on fixing. We can use
> this bug report to track when it's fixed.

Since this was not done, and this bug was closed when the proximate crash
was fixed, should a new bug be opened to serve as a tracking issue for
kwin_wayland crashes bringing down all clients?
Comment 26 Alex Elsayed 2021-12-03 11:07:51 UTC
I'll note that currently, https://community.kde.org/Plasma/Wayland_Showstoppers refers to this bug on the topic, which is rather confusing with this bug closed.
Comment 27 Nate Graham 2021-12-03 16:13:21 UTC
Oops, that's a mistake. I'll fix it.
Comment 28 Alex Elsayed 2021-12-03 21:04:55 UTC
(In reply to Nate Graham from comment #27)
> Oops, that's a mistake. I'll fix it.

It might be worth linking to some material on the progress being made, such as https://www.mail-archive.com/wayland-devel@lists.freedesktop.org/msg41274.html