Bug 479152 - Plasma crashes when no data were found by weather widget
Summary: Plasma crashes when no data were found by weather widget
Status: RESOLVED FIXED
Alias: None
Product: plasmashell
Classification: Plasma
Component: Weather widget (other bugs)
Version First Reported In: 6.1.0
Platform: Neon Linux
: NOR crash
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL:
Keywords: qt6
Depends on:
Blocks:
 
Reported: 2023-12-29 11:22 UTC by Alois Spitzbart
Modified: 2024-12-18 18:41 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments
Backtrace for weather widget (40.73 KB, text/plain)
2023-12-29 11:27 UTC, Alois Spitzbart
Details
Backtrace for weather widget with plasma shel (58.70 KB, text/plain)
2023-12-29 11:31 UTC, Alois Spitzbart
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alois Spitzbart 2023-12-29 11:22:51 UTC
SUMMARY
It looks like there are no values for the weather station and then the widget crashes. The same is with plasmaoidviewer. 


STEPS TO REPRODUCE
1. Add Weather widget
2. Configure and search for Feuerkogel
3. Select and click OK

OBSERVED RESULT
Plasma crashes

EXPECTED RESULT
Weather in Widget are displayed


SOFTWARE/OS VERSIONS
Linux/KDE Plasma:  6.2.0-39
(available in About System)
KDE Plasma Version: 5.91.90
KDE Frameworks Version: 5.248.0
Qt Version: 6.6.1

ADDITIONAL INFORMATION
Comment 1 Alois Spitzbart 2023-12-29 11:27:11 UTC
Created attachment 164535 [details]
Backtrace for weather widget
Comment 2 Alois Spitzbart 2023-12-29 11:31:29 UTC
Created attachment 164536 [details]
Backtrace for weather widget with plasma shel
Comment 3 Nicolas Fella 2023-12-29 22:19:16 UTC
#0  0x00007f34010969fc __pthread_kill_implementation (libc.so.6 + 0x969fc)
#1  0x00007f3401042476 __GI_raise (libc.so.6 + 0x42476)
#2  0x00007f34041123ce _ZN6KCrash19defaultCrashHandlerEi (libKF6Crash.so.6 + 0x83ce)
#3  0x00007f3401042520 __restore_rt (libc.so.6 + 0x42520)
#4  0x00007f34010969fc __pthread_kill_implementation (libc.so.6 + 0x969fc)
#5  0x00007f3401042476 __GI_raise (libc.so.6 + 0x42476)
#6  0x00007f34010287f3 __GI_abort (libc.so.6 + 0x287f3)
#7  0x00007f3401cd8417 _Z6qAbortv (libQt6Core.so.6 + 0x4d8417)
#8  0x00007f3401cd38c5 n/a (libQt6Core.so.6 + 0x4d38c5)
#9  0x00007f3401cd8e43 _ZNK14QMessageLogger5fatalEPKcz (libQt6Core.so.6 + 0x4d8e43)
#10 0x00007f3401ca6f14 _Z9qt_assertPKcS0_i (libQt6Core.so.6 + 0x4a6f14)
#11 0x00007f33e0800758 n/a (plasma_engine_dwd.so + 0x8758)
#12 0x00007f33e080be7c _ZN6DWDIon24forecast_slotJobFinishedEP4KJob (plasma_engine_dwd.so + 0x13e7c)
#13 0x00007f3401c2767e n/a (libQt6Core.so.6 + 0x42767e)
#14 0x00007f340279bb50 _ZN4KJob6resultEPS_NS_14QPrivateSignalE (libKF6CoreAddons.so.6 + 0x74b50)
#15 0x00007f340279f91b n/a (libKF6CoreAddons.so.6 + 0x7891b)
#16 0x00007f3401c2767e n/a (libQt6Core.so.6 + 0x42767e)
#17 0x00007f3401371915 n/a (libKF6KIOCore.so.6 + 0x125915)
#18 0x00007f340136e4a3 n/a (libKF6KIOCore.so.6 + 0x1224a3)
#19 0x00007f340136d81a n/a (libKF6KIOCore.so.6 + 0x12181a)
#20 0x00007f3401c2767e n/a (libQt6Core.so.6 + 0x42767e)
#21 0x00007f3401bc8782 _ZN7QObject5eventEP6QEvent (libQt6Core.so.6 + 0x3c8782)
#22 0x00007f3403bf1bcb _ZN19QApplicationPrivate13notify_helperEP7QObjectP6QEvent (libQt6Widgets.so.6 + 0x5f1bcb)
#23 0x00007f3401c5fd88 _ZN16QCoreApplication15notifyInternal2EP7QObjectP6QEvent (libQt6Core.so.6 + 0x45fd88)
#24 0x00007f3401c604a0 _ZN23QCoreApplicationPrivate16sendPostedEventsEP7QObjectiP11QThreadData (libQt6Core.so.6 + 0x4604a0)
#25 0x00007f3401b079f7 n/a (libQt6Core.so.6 + 0x3079f7)
#26 0x00007f340038ad3b g_main_context_dispatch (libglib-2.0.so.0 + 0x55d3b)
#27 0x00007f34003e0258 n/a (libglib-2.0.so.0 + 0xab258)
#28 0x00007f34003883e3 g_main_context_iteration (libglib-2.0.so.0 + 0x533e3)
#29 0x00007f3401b05790 _ZN20QEventDispatcherGlib13processEventsE6QFlagsIN10QEventLoop17ProcessEventsFlagEE (libQt6Core.so.6 + 0x305790)
#30 0x00007f3401c61fbb _ZN10QEventLoop4execE6QFlagsINS_17ProcessEventsFlagEE (libQt6Core.so.6 + 0x461fbb)
#31 0x00007f3401c63bec _ZN16QCoreApplication4execEv (libQt6Core.so.6 + 0x463bec)
#32 0x000055ad6bbf7964 n/a (plasmashell + 0x3a964)
#33 0x00007f3401029d90 __libc_start_call_main (libc.so.6 + 0x29d90)
#34 0x00007f3401029e40 __libc_start_main_impl (libc.so.6 + 0x29e40)
#35 0x000055ad6bbf7bf5 n/a (plasmashell + 0x3abf5)
Comment 4 Ismael Asensio 2024-01-12 19:16:02 UTC
(In reply to Nicolas Fella from comment #3)
> #10 0x00007f3401ca6f14 _Z9qt_assertPKcS0_i (libQt6Core.so.6 + 0x4a6f14)
> #11 0x00007f33e0800758 n/a (plasma_engine_dwd.so + 0x8758)
> #12 0x00007f33e080be7c _ZN6DWDIon24forecast_slotJobFinishedEP4KJob
> (plasma_engine_dwd.so + 0x13e7c)
> #13 0x00007f3401c2767e n/a (libQt6Core.so.6 + 0x42767e)
> #14 0x00007f340279bb50 _ZN4KJob6resultEPS_NS_14QPrivateSignalE

With the little information here, my take is that the job finishes before it is added to the hashes a few lines later (ion_dwd.cpp, lines 218 to 227). https://invent.kde.org/plasma/plasma-workspace/-/blob/master/dataengines/weather/ions/dwd/ion_dwd.cpp#L218
 Then `forecast_slotFinished` is reached and we try to access `m_searchJobList.value(job)` and/or `m_searchJobData[job]` (lines 282, 285) and the key is not there, triggering the Q_ASSERT in QHash.

Nicolas, could this happen if the job is fast enough? I cannot reproduce the crash even faking a wrong url or no data, but we could guard against this anyway for 6.0

For 6.1 beside adding this guard, I'd also like to do a small refactor like the one in `ion_noaa.cpp` to simplify the code.
Comment 5 Alois Spitzbart 2024-12-18 18:41:23 UTC
I checked it now. It does not crash anymore. I think I can close the bug.