Bug 481977

Summary: Spectacle crashes in NVIDIA driver code on startup after upgrade to plasma 6
Product: [Frameworks and Libraries] KPipeWire Reporter: Michele Palazzi <sysdadmin>
Component: generalAssignee: Plasma Bugs List <plasma-bugs>
Status: RESOLVED DOWNSTREAM    
Severity: crash CC: a.a.klevtsov, aleixpol, david.lee.ricardo1026, ddrs, duprezjm, dustin, kde, louis, nate, nicolas.fella, rgkumar937, zanderhawk11
Priority: HI Keywords: qt6
Version: unspecified   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Michele Palazzi 2024-02-28 23:28:20 UTC
SUMMARY
***
Process 3019 (spectacle) of user 1000 dumped core.
                                                         
                                                         Stack trace of thread 3019:
                                                         #0  0x0000794360f5dab4 XDisplayString (libX11.so.6 + 0x2bab4)
                                                         #1  0x0000794349cb6a1d __vaDriverInit_1_13 (nvidia_drv_video.so + 0xda1d)
                                                         #2  0x000079436214d27c vaInitialize (libva.so.2 + 0x627c)
                                                         #3  0x00007943645c0dfa n/a (libKPipeWireRecord.so.6 + 0x13dfa)
                                                         #4  0x00007943645bd945 n/a (libKPipeWireRecord.so.6 + 0x10945)
                                                         #5  0x00007943645bdce2 _ZNK25PipeWireBaseEncodedStream17suggestedEncodersEv (libKPipeWireRecord.so.6 + 0x10ce2)
                                                         #6  0x00007943645be30e _ZN25PipeWireBaseEncodedStreamC1EP7QObject (libKPipeWireRecord.so.6 + 0x1130e)
                                                         #7  0x00007943645be4ce _ZN14PipeWireRecordC2EP7QObject (libKPipeWireRecord.so.6 + 0x114ce)
                                                         #8  0x00005800aa9164f8 n/a (spectacle + 0xbf4f8)
                                                         #9  0x00005800aa916a67 n/a (spectacle + 0xbfa67)
                                                         #10 0x00005800aa8841e6 n/a (spectacle + 0x2d1e6)
                                                         #11 0x0000794362a43cd0 n/a (libc.so.6 + 0x25cd0)
                                                         #12 0x0000794362a43d8a __libc_start_main (libc.so.6 + 0x25d8a)
                                                         #13 0x00005800aa886855 n/a (spectacle + 0x2f855)
                                                         
                                                         Stack trace of thread 3020:
                                                         #0  0x0000794362b190bf __poll (libc.so.6 + 0xfb0bf)
                                                         #1  0x000079435dd6c2f6 n/a (libglib-2.0.so.0 + 0xb82f6)
                                                         #2  0x000079435dd0c162 g_main_context_iteration (libglib-2.0.so.0 + 0x58162)
                                                         #3  0x00007943619739c4 _ZN20QEventDispatcherGlib13processEventsE6QFlagsIN10QEventLoop17ProcessEventsFlagEE (libQt6Core.so.6 + 0x3739c4)
                                                         #4  0x0000794361743d6e _ZN10QEventLoop4execE6QFlagsINS_17ProcessEventsFlagEE (libQt6Core.so.6 + 0x143d6e)
                                                         #5  0x000079436182106f _ZN7QThread4execEv (libQt6Core.so.6 + 0x22106f)
                                                         #6  0x0000794363b5f9df n/a (libQt6DBus.so.6 + 0x299df)
                                                         #7  0x00007943618a0bd3 n/a (libQt6Core.so.6 + 0x2a0bd3)
                                                         #8  0x0000794362aa955a n/a (libc.so.6 + 0x8b55a)
                                                         #9  0x0000794362b26a3c n/a (libc.so.6 + 0x108a3c)
                                                         
                                                         Stack trace of thread 3022:
                                                         #0  0x0000794362b190bf __poll (libc.so.6 + 0xfb0bf)
                                                         #1  0x0000794363d7eb18 n/a (libQt6WaylandClient.so.6 + 0x64b18)
                                                         #2  0x00007943618a0bd3 n/a (libQt6Core.so.6 + 0x2a0bd3)
                                                         #3  0x0000794362aa955a n/a (libc.so.6 + 0x8b55a)
                                                         #4  0x0000794362b26a3c n/a (libc.so.6 + 0x108a3c)
                                                         
                                                         Stack trace of thread 3024:
                                                         #0  0x0000794362aa5ebe n/a (libc.so.6 + 0x87ebe)
                                                         #1  0x0000794362aa8750 pthread_cond_wait (libc.so.6 + 0x8a750)
                                                         #2  0x0000794331c8686c n/a (iris_dri.so + 0x8686c)
                                                         #3  0x0000794331c9e83c n/a (iris_dri.so + 0x9e83c)
                                                         #4  0x0000794362aa955a n/a (libc.so.6 + 0x8b55a)
                                                         #5  0x0000794362b26a3c n/a (libc.so.6 + 0x108a3c)
                                                         
                                                         Stack trace of thread 3021:
                                                         #0  0x0000794362aa5ebe n/a (libc.so.6 + 0x87ebe)
                                                         #1  0x0000794362aa8750 pthread_cond_wait (libc.so.6 + 0x8a750)
                                                         #2  0x00007943618a3c10 _ZN14QWaitCondition4waitEP6QMutex14QDeadlineTimer (libQt6Core.so.6 + 0x2a3c10)
                                                         #3  0x0000794363d7ea98 n/a (libQt6WaylandClient.so.6 + 0x64a98)
                                                         #4  0x00007943618a0bd3 n/a (libQt6Core.so.6 + 0x2a0bd3)
                                                         #5  0x0000794362aa955a n/a (libc.so.6 + 0x8b55a)
                                                         #6  0x0000794362b26a3c n/a (libc.so.6 + 0x108a3c)
                                                         
                                                         Stack trace of thread 3023:
                                                         #0  0x0000794362aa5ebe n/a (libc.so.6 + 0x87ebe)
                                                         #1  0x0000794362aa8750 pthread_cond_wait (libc.so.6 + 0x8a750)
                                                         #2  0x0000794331c8686c n/a (iris_dri.so + 0x8686c)
                                                         #3  0x0000794331c9e83c n/a (iris_dri.so + 0x9e83c)
                                                         #4  0x0000794362aa955a n/a (libc.so.6 + 0x8b55a)
                                                         #5  0x0000794362b26a3c n/a (libc.so.6 + 0x108a3c)
                                                         ELF object binary architecture: AMD x86-64

***


STEPS TO REPRODUCE
launch spectale

OBSERVED RESULT
crash

EXPECTED RESULT
app opens

SOFTWARE/OS VERSIONS
Linux/KDE Plasma:  Arch Linux
KDE Plasma Version:  6.0.0
KDE Frameworks Version: 6.0.0
Qt Version: 6.6.2

ADDITIONAL INFORMATION

Laptop with hybrid graphics, intel igpu + nvidia 3060 with nvidia-dkms version 550.54
Comment 1 Michele Palazzi 2024-02-28 23:41:32 UTC
(gdb) run
Starting program: /usr/bin/spectacle 
[Thread debugging using libthread_db enabled]                                                                                       
Using host libthread_db library "/usr/lib/libthread_db.so.1".
[New Thread 0x7fffde8006c0 (LWP 4412)]                                                                                              
[New Thread 0x7fffdde006c0 (LWP 4413)]                                                                                              
[New Thread 0x7fffdd4006c0 (LWP 4414)]
[New Thread 0x7fffd5a006c0 (LWP 4415)]                                                                                              
[New Thread 0x7fffd50006c0 (LWP 4416)]
[New Thread 0x7fffbea006c0 (LWP 4417)]
[New Thread 0x7fffbe0006c0 (LWP 4418)]
[New Thread 0x7fffbd6006c0 (LWP 4419)]
[New Thread 0x7fffbcc006c0 (LWP 4420)]
[Thread 0x7fffbcc006c0 (LWP 4420) exited]
[Thread 0x7fffbd6006c0 (LWP 4419) exited]
[Thread 0x7fffbe0006c0 (LWP 4418) exited]
[Thread 0x7fffbea006c0 (LWP 4417) exited]
                                                                                                                                    
Thread 1 "spectacle" received signal SIGSEGV, Segmentation fault.
XDisplayString (dpy=0x0) at /usr/src/debug/libx11/libX11-1.8.7/src/Macros.c:119
119     char *XDisplayString(Display *dpy) { return (DisplayString(dpy)); }
Comment 2 Michele Palazzi 2024-02-28 23:46:13 UTC
(In reply to Michele Palazzi from comment #1)
> (gdb) run
> Starting program: /usr/bin/spectacle 
> [Thread debugging using libthread_db enabled]                               
> 
> Using host libthread_db library "/usr/lib/libthread_db.so.1".
> [New Thread 0x7fffde8006c0 (LWP 4412)]                                      
> 
> [New Thread 0x7fffdde006c0 (LWP 4413)]                                      
> 
> [New Thread 0x7fffdd4006c0 (LWP 4414)]
> [New Thread 0x7fffd5a006c0 (LWP 4415)]                                      
> 
> [New Thread 0x7fffd50006c0 (LWP 4416)]
> [New Thread 0x7fffbea006c0 (LWP 4417)]
> [New Thread 0x7fffbe0006c0 (LWP 4418)]
> [New Thread 0x7fffbd6006c0 (LWP 4419)]
> [New Thread 0x7fffbcc006c0 (LWP 4420)]
> [Thread 0x7fffbcc006c0 (LWP 4420) exited]
> [Thread 0x7fffbd6006c0 (LWP 4419) exited]
> [Thread 0x7fffbe0006c0 (LWP 4418) exited]
> [Thread 0x7fffbea006c0 (LWP 4417) exited]
>                                                                             
> 
> Thread 1 "spectacle" received signal SIGSEGV, Segmentation fault.
> XDisplayString (dpy=0x0) at
> /usr/src/debug/libx11/libX11-1.8.7/src/Macros.c:119
> 119     char *XDisplayString(Display *dpy) { return (DisplayString(dpy)); }

(gdb) bt
#0  XDisplayString (dpy=0x0) at /usr/src/debug/libx11/libX11-1.8.7/src/Macros.c:119
#1  0x000075fdd7ff7a1d in __vaDriverInit_1_13 () at /usr/lib/dri/nvidia_drv_video.so
#2  0x000075fdf466827c in va_openDriver (driver_name=<optimized out>, dpy=0x6006372c6170) at ../libva/va/va.c:478
#3  va_new_opendriver (dpy=0x6006372c6170) at ../libva/va/va.c:714
#4  vaInitialize (minor_version=0x7fff4f1d3044, major_version=0x7fff4f1d3040, dpy=0x6006372c6170) at ../libva/va/va.c:743
#5  vaInitialize (dpy=0x6006372c6170, major_version=0x7fff4f1d3040, minor_version=0x7fff4f1d3044) at ../libva/va/va.c:727
#6  0x000075fdf60ecdfa in VaapiUtils::openDevice(int*, QByteArray const&) [clone .constprop.0] (fd=<optimized out>, path=...)
    at /usr/src/debug/kpipewire/kpipewire-6.0.0/src/vaapiutils.cpp:165
#7  0x000075fdf60e9945 in VaapiUtils::supportsH264 (path=..., this=0x7fff4f1d3230)
    at /usr/src/debug/kpipewire/kpipewire-6.0.0/src/vaapiutils.cpp:86
#8  VaapiUtils::VaapiUtils (this=0x7fff4f1d3230, this=<optimized out>)
    at /usr/src/debug/kpipewire/kpipewire-6.0.0/src/vaapiutils.cpp:37
Comment 3 Nicolas Fella 2024-03-01 17:01:57 UTC
Are you running X11 or Wayland?
Comment 4 Michele Palazzi 2024-03-01 17:14:32 UTC
(In reply to Nicolas Fella from comment #3)
> Are you running X11 or Wayland?

Wayland, i'm also using pipewire if relevant
Comment 5 Nicolas Fella 2024-03-01 17:16:42 UTC
#0  XDisplayString (dpy=0x0) at /usr/src/debug/libx11/libX11-1.8.7/src/Macros.c:119
#1  0x000075fdd7ff7a1d in __vaDriverInit_1_13 () at /usr/lib/dri/nvidia_drv_video.so

For some reason the Nvidia video acceleration driver is trying to talk to X11, which of course doesn't make sense on Wayland.

I'm 98% sure that's a driver bug
Comment 7 Nicolas Fella 2024-03-01 17:19:10 UTC
And https://bugs.archlinux.org/task/72241
Comment 8 Michele Palazzi 2024-03-01 17:24:04 UTC
(In reply to Nicolas Fella from comment #5)
> #0  XDisplayString (dpy=0x0) at
> /usr/src/debug/libx11/libX11-1.8.7/src/Macros.c:119
> #1  0x000075fdd7ff7a1d in __vaDriverInit_1_13 () at
> /usr/lib/dri/nvidia_drv_video.so
> 
> For some reason the Nvidia video acceleration driver is trying to talk to
> X11, which of course doesn't make sense on Wayland.
> 
> I'm 98% sure that's a driver bug

i'm not in a position to argue with you about that, the only thing for sure is that on kde 5.27.10 spectacle did not crash on Wayland, same driver
Comment 9 Nate Graham 2024-03-01 18:47:07 UTC
If you were using X11 in Plasma 5.27 and just started using Wayland in Plasma 6, then the issue was probably there all along, just not manifesting yet. Is that the case?
Comment 10 Michele Palazzi 2024-03-01 19:11:02 UTC
(In reply to Nate Graham from comment #9)
> If you were using X11 in Plasma 5.27 and just started using Wayland in
> Plasma 6, then the issue was probably there all along, just not manifesting
> yet. Is that the case?

nope, I just rolled back to confirm, on 5.27 Wayland there is no crash
Comment 11 zanderhawk11 2024-03-06 21:11:23 UTC
(In reply to Nate Graham from comment #9)
> If you were using X11 in Plasma 5.27 and just started using Wayland in
> Plasma 6, then the issue was probably there all along, just not manifesting
> yet. Is that the case?

I've got the same issue. It worked on Plasma 5.27 under Wayland.
Comment 12 SR_team 2024-03-06 23:53:24 UTC
Same issue

System: ArchLinux, KDE 6
GPU: NVIDIA RTX4070, driver 550.54.14 (closed source)

backtrace:
```
119     char *XDisplayString(Display *dpy) { return (DisplayString(dpy)); }
(gdb) bt
#0  XDisplayString (dpy=0x0) at /usr/src/debug/libx11/libX11-1.8.7/src/Macros.c:119
#1  0x00007fffdc449a1d in __vaDriverInit_1_13 () at /usr/lib/dri/nvidia_drv_video.so
#2  0x00007ffff625427c in va_openDriver (driver_name=<optimized out>, dpy=0x5555559554a0) at ../libva/va/va.c:478
#3  va_new_opendriver (dpy=0x5555559554a0) at ../libva/va/va.c:714
#4  vaInitialize (minor_version=0x7fffffffca94, major_version=0x7fffffffca90, dpy=0x5555559554a0) at ../libva/va/va.c:743
#5  vaInitialize (dpy=0x5555559554a0, major_version=0x7fffffffca90, minor_version=0x7fffffffca94) at ../libva/va/va.c:727
#6  0x00007ffff7cc9dfa in VaapiUtils::openDevice(int*, QByteArray const&) [clone .constprop.0] (fd=<optimized out>, path=...) at /usr/src/debug/kpipewire/kpipewire-6.0.1.1/src/vaapiutils.cpp:165
#7  0x00007ffff7cc6945 in VaapiUtils::supportsH264 (path=..., this=0x7fffffffcc80) at /usr/src/debug/kpipewire/kpipewire-6.0.1.1/src/vaapiutils.cpp:86
#8  VaapiUtils::VaapiUtils (this=0x7fffffffcc80, this=<optimized out>) at /usr/src/debug/kpipewire/kpipewire-6.0.1.1/src/vaapiutils.cpp:37
#9  0x00007ffff7cc6ce2 in PipeWireBaseEncodedStream::suggestedEncoders (this=this@entry=0x5555559550a0) at /usr/src/debug/kpipewire/kpipewire-6.0.1.1/src/pipewirebaseencodedstream.cpp:180
#10 0x00007ffff7cc730e in PipeWireBaseEncodedStream::PipeWireBaseEncodedStream (this=0x5555559550a0, parent=<optimized out>, this=<optimized out>, parent=<optimized out>)
at /usr/src/debug/kpipewire/kpipewire-6.0.1.1/src/pipewirebaseencodedstream.cpp:50
#11 0x00007ffff7cc74ce in PipeWireRecord::PipeWireRecord (this=this@entry=0x5555559550a0, parent=parent@entry=0x0, this=<optimized out>, parent=<optimized out>)
at /usr/src/debug/kpipewire/kpipewire-6.0.1.1/src/pipewirerecord.cpp:59
#12 0x00005555556134f8 in VideoPlatformWayland::VideoPlatformWayland(QObject*) [clone .constprop.0] (this=this@entry=0x7fffd4008500, parent=0x0)
at /usr/src/debug/spectacle/spectacle-24.02.0/src/Platforms/VideoPlatformWayland.cpp:78
#13 0x0000555555613a67 in std::make_unique<VideoPlatformWayland> () at /usr/include/c++/13.2.1/bits/unique_ptr.h:1070
#14 loadVideoPlatform () at /usr/src/debug/spectacle/spectacle-24.02.0/src/Platforms/PlatformLoader.cpp:93
#15 SpectacleCore::SpectacleCore(QObject*) [clone .constprop.0] (this=0x7fffffffd090, parent=0x0) at /usr/src/debug/spectacle/spectacle-24.02.0/src/SpectacleCore.cpp:120
#16 0x00005555555811e6 in main (argc=<optimized out>, argv=<optimized out>) at /usr/src/debug/spectacle/spectacle-24.02.0/src/Main.cpp:103
```

core dump: https://nc.sr.team/s/XnXSm7taKaeoSb6
! saved with warning: `warning: Memory read failed for corefile section, 4096 bytes at 0xffffffffff600000.`

P.S. Screen sharing via pipewire (obs, browser) work fine.
Comment 13 Noah Davis 2024-03-07 02:47:53 UTC
Moved to KPipeWire since that's what all the backtraces seem to indicate where the bug is.
Comment 14 SR_team 2024-03-07 15:22:30 UTC
(In reply to Noah Davis from comment #13)
> Moved to KPipeWire since that's what all the backtraces seem to indicate
> where the bug is.

KMail have same crash, but it not contain KPipeWire in backtrace:
```
Thread 22 "Chrome_InProcGp" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffa74006c0 (LWP 500908)]
XDisplayString (dpy=0x0) at /usr/src/debug/libx11/libX11-1.8.7/src/Macros.c:119
119     char *XDisplayString(Display *dpy) { return (DisplayString(dpy)); }
(gdb) bt
#0  XDisplayString (dpy=0x0) at /usr/src/debug/libx11/libX11-1.8.7/src/Macros.c:119
#1  0x00007fffcc702a1d in __vaDriverInit_1_13 () at /usr/lib/dri/nvidia_drv_video.so
#2  0x00007fffe1b3927c in va_openDriver (driver_name=<optimized out>, dpy=0x7fff600712d0) at ../libva/va/va.c:478
#3  va_new_opendriver (dpy=0x7fff600712d0) at ../libva/va/va.c:714
#4  vaInitialize (minor_version=0x7fffa73febf0, major_version=0x7fffa73febe4, dpy=0x7fff600712d0) at ../libva/va/va.c:743
#5  vaInitialize (dpy=0x7fff600712d0, major_version=0x7fffa73febe4, minor_version=0x7fffa73febf0) at ../libva/va/va.c:727
#6  0x00007ffff06e8f01 in InitializeVaDriver_Locked () at ../../../../../qtwebengine-everywhere-src-6.6.2/src/3rdparty/chromium/media/gpu/vaapi/vaapi_wrapper.cc:858
#7  InitializeOnce () at ../../../../../qtwebengine-everywhere-src-6.6.2/src/3rdparty/chromium/media/gpu/vaapi/vaapi_wrapper.cc:899
#8  Initialize () at ../../../../../qtwebengine-everywhere-src-6.6.2/src/3rdparty/chromium/media/gpu/vaapi/vaapi_wrapper.cc:782
#9  0x00007ffff06f06f3 in VASupportedProfiles () at ../../../../../qtwebengine-everywhere-src-6.6.2/src/3rdparty/chromium/media/gpu/vaapi/vaapi_wrapper.cc:1200
#10 0x00007ffff06f56bc in NoDestructor<> () at ../../../../../qtwebengine-everywhere-src-6.6.2/src/3rdparty/chromium/base/no_destructor.h:88
#11 Get () at ../../../../../qtwebengine-everywhere-src-6.6.2/src/3rdparty/chromium/media/gpu/vaapi/vaapi_wrapper.cc:1177
#12 Get () at ../../../../../qtwebengine-everywhere-src-6.6.2/src/3rdparty/chromium/media/gpu/vaapi/vaapi_wrapper.cc:1176
#13 media::VaapiWrapper::PreSandboxInitialization () at ../../../../../qtwebengine-everywhere-src-6.6.2/src/3rdparty/chromium/media/gpu/vaapi/vaapi_wrapper.cc:3141
#14 0x00007ffff3d42ea8 in content::InProcessGpuThread::Init () at ./../../../../../qtwebengine-everywhere-src-6.6.2/src/3rdparty/chromium/content/gpu/in_process_gpu_thread.cc:76
#15 0x00007ffff1ef7885 in base::Thread::ThreadMain () at ./../../../../../qtwebengine-everywhere-src-6.6.2/src/3rdparty/chromium/base/threading/thread.cc:403
#16 0x00007ffff1f08b2a in ThreadFunc () at ./../../../../../qtwebengine-everywhere-src-6.6.2/src/3rdparty/chromium/base/threading/platform_thread_posix.cc:101
#17 0x00007fffed8a955a in start_thread (arg=<optimized out>) at pthread_create.c:447
#18 0x00007fffed926a3c in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
```
Comment 15 Nicolas Fella 2024-03-08 22:21:41 UTC
*** Bug 482921 has been marked as a duplicate of this bug. ***
Comment 16 Nicolas Fella 2024-03-08 22:26:23 UTC
This is caused by the libva-vdpau-driver package on Arch. Removing that should fix it
Comment 17 SR_team 2024-03-08 23:47:05 UTC
(In reply to Nicolas Fella from comment #16)
> This is caused by the libva-vdpau-driver package on Arch. Removing that
> should fix it

I replaced with `libva-nvidia-driver` - now spectacle and kmail works for me. Thanks
Comment 18 Michele Palazzi 2024-03-09 00:07:10 UTC
(In reply to Nicolas Fella from comment #16)
> This is caused by the libva-vdpau-driver package on Arch. Removing that
> should fix it

in my case the problem disappeared after upgrading the system yesterday, many packages got updated but not the one mentioned, which i still have installed, i tried to pinpoint which package did solve the issue but i did not manage to reproduce the crash anymore.
Comment 19 Nate Graham 2024-03-09 00:12:28 UTC
Cool, sounds like it was a driver or packaging issue.
Comment 20 Antonio Rojas 2024-03-13 07:22:53 UTC
*** Bug 483394 has been marked as a duplicate of this bug. ***
Comment 21 Antonio Rojas 2024-03-14 15:08:02 UTC
*** Bug 483554 has been marked as a duplicate of this bug. ***
Comment 22 Nicolas Fella 2024-03-20 20:15:14 UTC
*** Bug 484099 has been marked as a duplicate of this bug. ***
Comment 23 Nicolas Fella 2024-05-15 05:38:46 UTC
*** Bug 487044 has been marked as a duplicate of this bug. ***
Comment 24 cwo 2024-09-24 16:04:15 UTC
*** Bug 493553 has been marked as a duplicate of this bug. ***