Bug 454647

Summary: Crash upon connecting external Bluetooth headset
Product: [Plasma] plasma-pa Reporter: Hynek Mlnarik <hmlnarik>
Component: generalAssignee: Plasma Bugs List <plasma-bugs>
Status: RESOLVED FIXED    
Severity: crash CC: kde, me, nate, nowrep
Priority: NOR Keywords: drkonqi
Version: 5.24.5   
Target Milestone: ---   
Platform: Fedora RPMs   
OS: Linux   
Latest Commit: Version Fixed In: 5.24.7

Description Hynek Mlnarik 2022-05-31 10:19:04 UTC
Application: plasmashell (5.24.5)

Qt Version: 5.15.3
Frameworks Version: 5.93.0
Operating System: Linux 5.15.12-200.fc35.x86_64 x86_64
Windowing System: X11
Distribution: Fedora Linux 36 (Workstation Edition)
DrKonqi: 5.24.5 [KCrashBackend]

-- Information about the crash:
- What I was doing when the application crashed:
Connected external bluetooth headset

- Unusual behavior I noticed:
Panels have been unresponsive for maybe tens of seconds
Global shortcuts stopped working

The crash can be reproduced sometimes.

-- Backtrace:
Application: Plasma (plasmashell), signal: Segmentation fault

[KCrash Handler]
#4  0x00007f9e54453b01 in QPulseAudio::server_cb(pa_context*, pa_server_info const*, void*) [clone .lto_priv.0] () from /usr/lib64/qt5/qml/org/kde/plasma/private/volume/libplasma-volume-declarative.so
#5  0x00007f9e543d0b94 in context_get_server_info_callback () from /lib64/libpulse.so.0
#6  0x00007f9e54375bd1 in run_action () from /usr/lib64/pulseaudio/libpulsecommon-15.0.so
#7  0x00007f9e5441495a in dispatch_func () from /lib64/libpulse-mainloop-glib.so.0
#8  0x00007f9ed401bf4f in g_main_context_dispatch () from /lib64/libglib-2.0.so.0
#9  0x00007f9ed4071168 in g_main_context_iterate.constprop () from /lib64/libglib-2.0.so.0
#10 0x00007f9ed40198e0 in g_main_context_iteration () from /lib64/libglib-2.0.so.0
#11 0x00007f9ed5c24c8a in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /lib64/libQt5Core.so.5
#12 0x00007f9ed5bd2b7a in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /lib64/libQt5Core.so.5
#13 0x00007f9ed5bdac22 in QCoreApplication::exec() () from /lib64/libQt5Core.so.5
#14 0x00005636f0c8a8cd in main ()
[Inferior 1 (process 16521) detached]

Possible duplicates by query: bug 435809, bug 381569, bug 363291, bug 353378, bug 345834.

Reported using DrKonqi
Comment 1 Bug Janitor Service 2022-10-10 14:08:01 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-pa/-/merge_requests/142
Comment 2 Bug Janitor Service 2022-10-10 14:08:38 UTC
A possibly relevant merge request was started @ https://invent.kde.org/libraries/pulseaudio-qt/-/merge_requests/16
Comment 3 Harald Sitter 2022-10-11 11:24:52 UTC
Git commit e87f2b13c8701a5d332f7a84fe1a0c344204cbfb by Harald Sitter.
Committed on 11/10/2022 at 10:12.
Pushed by sitter into branch 'master'.

don't crash when the server doesn't respond

inside libpulse a non-reply (e.g. caused by a timeout) results in info
being a nullptr. when that happens simply skip over the callback. when
this happens chances are the server crashed or is otherwise defunct so
we won't be able to do much about this anyway

easy to test by attaching to both plasmashell and pulseaudio and
interrupting the latter when the former calls
pa_context_get_server_info. this results in the reply timeout getting
hit -> nullptr callback.

it is unclear if we can somehow recover from this but in lieu of a
reliable real world test case for this we at least shouldn't crash on
nullptr access.
Related: bug 437272

M  +6    -0    src/context.cpp

https://invent.kde.org/plasma/plasma-pa/commit/e87f2b13c8701a5d332f7a84fe1a0c344204cbfb
Comment 4 Harald Sitter 2022-10-11 11:24:57 UTC
Git commit f6b02f21a9131bafc4965ebb64acf01a4505ce04 by Harald Sitter.
Committed on 10/10/2022 at 14:06.
Pushed by sitter into branch 'master'.

don't crash when the server doesn't respond

inside libpulse a non-reply (e.g. caused by a timeout) results in info
being a nullptr. when that happens simply skip over the callback. when
this happens chances are the server crashed or is otherwise defunct so
we won't be able to do much about this anyway

easy to test by attaching to both plasmashell and pulseaudio and
interrupting the latter when the former calls
pa_context_get_server_info. this results in the reply timeout getting
hit -> nullptr callback.

it is unclear if we can somehow recover from this but in lieu of a
reliable real world test case for this we at least shouldn't crash on
nullptr access.

M  +6    -0    src/context.cpp

https://invent.kde.org/libraries/pulseaudio-qt/commit/f6b02f21a9131bafc4965ebb64acf01a4505ce04
Comment 5 Harald Sitter 2022-10-11 23:58:26 UTC
Git commit 89d33990bbd4e63e4624a01fb0e74c341ac50fa4 by Harald Sitter.
Committed on 11/10/2022 at 23:58.
Pushed by sitter into branch 'Plasma/5.26'.

don't crash when the server doesn't respond

inside libpulse a non-reply (e.g. caused by a timeout) results in info
being a nullptr. when that happens simply skip over the callback. when
this happens chances are the server crashed or is otherwise defunct so
we won't be able to do much about this anyway

easy to test by attaching to both plasmashell and pulseaudio and
interrupting the latter when the former calls
pa_context_get_server_info. this results in the reply timeout getting
hit -> nullptr callback.

it is unclear if we can somehow recover from this but in lieu of a
reliable real world test case for this we at least shouldn't crash on
nullptr access.
Related: bug 437272


(cherry picked from commit e87f2b13c8701a5d332f7a84fe1a0c344204cbfb)

M  +6    -0    src/context.cpp

https://invent.kde.org/plasma/plasma-pa/commit/89d33990bbd4e63e4624a01fb0e74c341ac50fa4
Comment 6 Harald Sitter 2022-10-11 23:58:42 UTC
Git commit b33f3a4c0f4c5b7b7c193370165e799e38c9dddd by Harald Sitter.
Committed on 11/10/2022 at 23:58.
Pushed by sitter into branch 'Plasma/5.24'.

don't crash when the server doesn't respond

inside libpulse a non-reply (e.g. caused by a timeout) results in info
being a nullptr. when that happens simply skip over the callback. when
this happens chances are the server crashed or is otherwise defunct so
we won't be able to do much about this anyway

easy to test by attaching to both plasmashell and pulseaudio and
interrupting the latter when the former calls
pa_context_get_server_info. this results in the reply timeout getting
hit -> nullptr callback.

it is unclear if we can somehow recover from this but in lieu of a
reliable real world test case for this we at least shouldn't crash on
nullptr access.
Related: bug 437272


(cherry picked from commit e87f2b13c8701a5d332f7a84fe1a0c344204cbfb)

M  +6    -0    src/context.cpp

https://invent.kde.org/plasma/plasma-pa/commit/b33f3a4c0f4c5b7b7c193370165e799e38c9dddd