Bug 497187 - Imaging Planner Crashes
Summary: Imaging Planner Crashes
Status: REPORTED
Alias: None
Product: kstars
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Kubuntu Linux
: NOR crash
Target Milestone: ---
Assignee: Hy
URL:
Keywords: drkonqi
Depends on:
Blocks:
 
Reported: 2024-12-08 04:32 UTC by Philip Bartlett
Modified: 2024-12-10 07:28 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report: https://crash-reports.kde.org/organizations/kde/issues/104306/events/e4055469360f4a92b7b816e31421ce06/


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Philip Bartlett 2024-12-08 04:32:54 UTC
Application: kstars (3.7.4 Stable)

Qt Version: 6.6.2
Frameworks Version: 6.6.0
Operating System: Linux 6.11.0-9-generic x86_64
Windowing System: X11
Distribution: Ubuntu 24.10
DrKonqi: 6.1.5 [KCrashBackend]

-- Information about the crash:
Upon selection Tools > Imaging Planner, kstars immediately crashes

My system is:

Operating System: Kubuntu 24.10
KDE Plasma Version: 6.1.5
KDE Frameworks Version: 6.6.0
Qt Version: 6.6.2
Kernel Version: 6.11.0-9-generic (64-bit)
Graphics Platform: X11
Processors: 12 × AMD Ryzen 5 7640U w/ Radeon 760M Graphics
Memory: 27.2 GiB of RAM
Graphics Processor: AMD Radeon 760M
Manufacturer: Framework
Product Name: Laptop 13 (AMD Ryzen 7040Series)
System Version: A5

The crash can be reproduced every time.

-- Backtrace:
Application: KStars (kstars), signal: Segmentation fault
Content of s_kcrashErrorMessage: std::unique_ptr<char []> = {get() = <optimized out>}
[KCrash Handler]
#6  0x00007fd593e5efbd in QPainter::begin (this=0x7ffe0dd97460, pd=0x7fd588004b30) at painting/qpainter.cpp:1765
#7  0x00007fd593e5f6b5 in QPainter::QPainter (this=<optimized out>, pd=<optimized out>) at painting/qpainter.cpp:1500
#8  0x00007fd5944652bf in QFrame::paintEvent (this=this@entry=0x620b5b4e87f0) at widgets/qframe.cpp:514
#9  0x00007fd5944688d6 in QAbstractScrollArea::event (this=0x620b5b4e87f0, e=0x7ffe0dd975f0) at widgets/qabstractscrollarea.cpp:958
#10 0x00007fd59436bef5 in QApplicationPrivate::notify_helper (this=<optimized out>, receiver=0x620b5b4e87f0, e=0x7ffe0dd975f0) at kernel/qapplication.cpp:3640
#11 0x00007fd5936e8c98 in QCoreApplication::notifyInternal2 (receiver=0x620b5b4e87f0, event=0x7ffe0dd975f0) at kernel/qcoreapplication.cpp:1064
#12 0x00007fd5936e8ee2 in QCoreApplication::sendSpontaneousEvent (receiver=<optimized out>, event=<optimized out>) at kernel/qcoreapplication.cpp:1474
#13 0x00007fd5943a8d5c in QWidgetPrivate::sendPaintEvent (this=this@entry=0x620b5b4f0f10, toBePainted=...) at kernel/qwidget.cpp:5479
#14 0x00007fd5943a9731 in QWidgetPrivate::drawWidget (this=this@entry=0x620b5b4f0f10, pdev=pdev@entry=0x7fd588004b30, rgn=..., offset=..., flags=flags@entry=..., sharedPainter=sharedPainter@entry=0x0, repaintManager=<optimized out>) at kernel/qwidget.cpp:5429
#15 0x00007fd5943aabec in QWidgetPrivate::paintSiblingsRecursive (this=0x620b5b4f6900, pdev=0x7fd588004b30, siblings=..., index=<optimized out>, rgn=..., offset=..., flags=..., sharedPainter=0x0, repaintManager=0x620b5d16abe0) at kernel/qwidget.cpp:5610
#16 0x00007fd5943aaa33 in QWidgetPrivate::paintSiblingsRecursive (this=0x620b5b4f6900, pdev=0x7fd588004b30, siblings=..., index=2, rgn=..., offset=..., flags=..., sharedPainter=0x0, repaintManager=0x620b5d16abe0) at kernel/qwidget.cpp:5596
#17 0x00007fd5943aaa33 in QWidgetPrivate::paintSiblingsRecursive (this=this@entry=0x620b5b4f6900, pdev=pdev@entry=0x7fd588004b30, siblings=..., index=3, rgn=..., offset=..., flags=..., sharedPainter=0x0, repaintManager=0x620b5d16abe0) at kernel/qwidget.cpp:5596
#18 0x00007fd5943a9333 in QWidgetPrivate::drawWidget (this=this@entry=0x620b5b4f6900, pdev=pdev@entry=0x7fd588004b30, rgn=..., offset=..., flags=..., flags@entry=..., sharedPainter=sharedPainter@entry=0x0, repaintManager=<optimized out>) at kernel/qwidget.cpp:5470
#19 0x00007fd5943aabec in QWidgetPrivate::paintSiblingsRecursive (this=0x620b5b4f6660, pdev=0x7fd588004b30, siblings=..., index=<optimized out>, rgn=..., offset=..., flags=..., sharedPainter=0x0, repaintManager=0x620b5d16abe0) at kernel/qwidget.cpp:5610
#20 0x00007fd5943aaa33 in QWidgetPrivate::paintSiblingsRecursive (this=this@entry=0x620b5b4f6660, pdev=pdev@entry=0x7fd588004b30, siblings=..., index=1, rgn=..., offset=..., flags=..., sharedPainter=0x0, repaintManager=0x620b5d16abe0) at kernel/qwidget.cpp:5596
#21 0x00007fd5943a9333 in QWidgetPrivate::drawWidget (this=this@entry=0x620b5b4f6660, pdev=pdev@entry=0x7fd588004b30, rgn=..., offset=..., flags=..., flags@entry=..., sharedPainter=sharedPainter@entry=0x0, repaintManager=<optimized out>) at kernel/qwidget.cpp:5470
#22 0x00007fd5943aabec in QWidgetPrivate::paintSiblingsRecursive (this=this@entry=0x620b5b588060, pdev=pdev@entry=0x7fd588004b30, siblings=..., index=<optimized out>, rgn=..., offset=..., flags=..., sharedPainter=0x0, repaintManager=0x620b5d16abe0) at kernel/qwidget.cpp:5610
#23 0x00007fd5943a9333 in QWidgetPrivate::drawWidget (this=this@entry=0x620b5b588060, pdev=<optimized out>, rgn=..., offset=..., flags=..., flags@entry=..., sharedPainter=sharedPainter@entry=0x0, repaintManager=<optimized out>) at kernel/qwidget.cpp:5470
#24 0x00007fd59437d168 in QWidgetRepaintManager::paintAndFlush (this=this@entry=0x620b5d16abe0) at kernel/qwidgetrepaintmanager.cpp:1023
#25 0x00007fd59437d968 in QWidgetRepaintManager::sync (this=0x620b5d16abe0, exposedWidget=0x620b587487d0, exposedRegion=...) at kernel/qwidgetrepaintmanager.cpp:743
#26 0x00007fd5943cf62a in QWidgetWindow::event (this=0x620b587bce90, event=0x7ffe0dd98820) at kernel/qwidgetwindow.cpp:347
#27 0x00007fd59436bef5 in QApplicationPrivate::notify_helper (this=<optimized out>, receiver=0x620b587bce90, e=0x7ffe0dd98820) at kernel/qapplication.cpp:3640
#28 0x00007fd5936e8c98 in QCoreApplication::notifyInternal2 (receiver=0x620b587bce90, event=0x7ffe0dd98820) at kernel/qcoreapplication.cpp:1064
#29 0x00007fd5936e8ee2 in QCoreApplication::sendSpontaneousEvent (receiver=<optimized out>, event=<optimized out>) at kernel/qcoreapplication.cpp:1474
#30 0x00007fd593b4c248 in QGuiApplicationPrivate::processExposeEvent (e=0x7fd588001810) at kernel/qguiapplication.cpp:3254
#31 0x00007fd593b1afac in QWindowSystemInterface::sendWindowSystemEvents (flags=flags@entry=...) at kernel/qwindowsysteminterface.cpp:1169
#32 0x00007fd58d8f63f6 in xcbSourceDispatch (source=<optimized out>) at qxcbeventdispatcher.cpp:105
#33 0x00007fd5928ba397 in g_main_dispatch (context=0x7fd588000ed0) at ../../../glib/gmain.c:3357
#34 0x00007fd59291adc7 in g_main_context_dispatch_unlocked (context=0x7fd588000ed0) at ../../../glib/gmain.c:4208
#35 g_main_context_iterate_unlocked.isra.0 (context=context@entry=0x7fd588000ed0, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at ../../../glib/gmain.c:4273
#36 0x00007fd5928b98b3 in g_main_context_iteration (context=0x7fd588000ed0, may_block=1) at ../../../glib/gmain.c:4338
#37 0x00007fd593747afd in QEventDispatcherGlib::processEvents (this=0x620b584305e0, flags=...) at kernel/qeventdispatcher_glib.cpp:423
#38 0x00007fd5936e75ab in QEventLoop::exec (this=this@entry=0x7ffe0dd98b20, flags=..., flags@entry=...) at ../../include/QtCore/../../src/corelib/global/qflags.h:69
#39 0x00007fd5936f0286 in QCoreApplication::exec () at ../../include/QtCore/../../src/corelib/global/qflags.h:121
#40 0x00007fd593b3db7d in QGuiApplication::exec () at kernel/qguiapplication.cpp:1863
#41 0x00007fd59436be69 in QApplication::exec () at kernel/qapplication.cpp:2832
#42 0x0000620b2180d6b8 in main (argc=<optimized out>, argv=<optimized out>) at /usr/src/kstars-bleeding-6:3.7.4+202412052202~ubuntu24.10.1/kstars/main.cpp:387
[Inferior 1 (process 1396478) detached]

Reported using DrKonqi
Comment 1 Hy 2024-12-08 19:02:04 UTC
Philip,

I'm not sure how to reproduce/debug this...I don't have your environment, and it doesn't crash in other environments. Are you able to compile from source and test? If so, I have a "shot-in-the-dark" that I'd like you to try. Could you please add these 3 lines:

    {
        static QMutex eventFilterMutex;
        QMutexLocker lock(&eventFilterMutex);

right after line 2278 in kstars/kstars/tools/imagingplanner.cpp so that the start of ImagingPlanner::eventFilter() looks like this:

------------------------------------------------------
bool ImagingPlanner::eventFilter(QObject * obj, QEvent * event)
{
    if (m_InitialLoad && event->type() == QEvent::Paint)
    {
        m_InitialLoad = false;
        // Load the initial catalog in another thread.
        setStatus(i18n("Loading Catalogs..."));
        loadInitialCatalog();
    }

    {
        static QMutex eventFilterMutex;
        QMutexLocker lock(&eventFilterMutex);
        // Right click on object in catalog view brings up this menu.
------------------------------------------------------


then, at the end of the method you'd need to add a matching close-curly-bracket right before the "return false;" on line 2373 (line numbers after the above addition) e.g.

------------------------------------------------------
    }
    return false;
}

void ImagingPlanner::keywordEditFinished()
------------------------------------------------------

Thanks,
Hy
Comment 2 Philip Bartlett 2024-12-08 20:37:52 UTC
Hy,

Yes, it was happening when I downloaded from source, so waited for the 
stable release to see if that fixed it. I will try your shot-in-the-dark 
in the next couple of days and report back.

Cheers,

Philip

On 9/12/24 06:02, Hy wrote:
> https://bugs.kde.org/show_bug.cgi?id=497187
>
> --- Comment #1 from Hy <hymur67@gmail.com> ---
> Philip,
>
> I'm not sure how to reproduce/debug this...I don't have your environment, and
> it doesn't crash in other environments. Are you able to compile from source and
> test? If so, I have a "shot-in-the-dark" that I'd like you to try. Could you
> please add these 3 lines:
>
>      {
>          static QMutex eventFilterMutex;
>          QMutexLocker lock(&eventFilterMutex);
>
> right after line 2278 in kstars/kstars/tools/imagingplanner.cpp so that the
> start of ImagingPlanner::eventFilter() looks like this:
>
> ------------------------------------------------------
> bool ImagingPlanner::eventFilter(QObject * obj, QEvent * event)
> {
>      if (m_InitialLoad && event->type() == QEvent::Paint)
>      {
>          m_InitialLoad = false;
>          // Load the initial catalog in another thread.
>          setStatus(i18n("Loading Catalogs..."));
>          loadInitialCatalog();
>      }
>
>      {
>          static QMutex eventFilterMutex;
>          QMutexLocker lock(&eventFilterMutex);
>          // Right click on object in catalog view brings up this menu.
> ------------------------------------------------------
>
>
> then, at the end of the method you'd need to add a matching close-curly-bracket
> right before the "return false;" on line 2373 (line numbers after the above
> addition) e.g.
>
> ------------------------------------------------------
>      }
>      return false;
> }
>
> void ImagingPlanner::keywordEditFinished()
> ------------------------------------------------------
>
> Thanks,
> Hy
>
Comment 3 Hy 2024-12-10 01:12:58 UTC
Philip, 
I no longer think that that change is a good idea. Sorry if you spent time testing it.  I just put i an MR with some changes and am trying to merge it into the 3.7.5 beta tree. When it's merged, or if you can get imagingPlanner.cpp and imagingPlanner.h from https://invent.kde.org/education/kstars/-/merge_requests/1385 please test that. If it does fix things, we can see if we can patch it into 3.7.4.
Hy
Comment 4 Hy 2024-12-10 06:02:35 UTC
It's merged now into the head of the code tree. Would be on the next nightly build as well.
Comment 5 Philip Bartlett 2024-12-10 07:28:48 UTC
Hy,

I tried your suggested change yesterday and it didn't work. However, 
after playing around, I got it partially working. I used the "Settings > 
Startup Wizard > Download Extra Data" to download the "ImagingPlanner 
Catalog1". Once this was installed, the ImagingPlanner launched and it 
began populating the targets table on the left ... then it crashes!

I downloaded the imagingPlanner.cpp and .h from your merge request, but 
this also crashes.

I then updated kstars on the mini-PC on my telescope to 3.7.4 stable. 
This PC is still running Kubuntu 24.04.1 LTS (my laptop was upgraded to 
Kubuntu 24.10) so I thought this would rule out anything that is related 
to 24.10. This also crashed, but because it is such a slow PC I could 
see what it was up too. It cycles, successfully,  through five lists of 
objects (sizes 109, 95 151, 191 and 9), adding them to the table, and 
then crashes. But, if you don't blink!!!, it does seem to update the 
altitude vs time plot just before the crash. After restarting kstars and 
running imagingPlanner it crashes immediately, so presumably it has 
saved the targets list to a database and doesn't need to perform the 
initial setup.

I have very little experience with c++ and no experience with the QT 
environment (I have a supercomputing background with Fortran) but am 
happy to put some DPRINT(stderr,"message") statements throughout the 
code to trace where it is getting to if you can direct me to which 
functions in imagingPlanner.cpp might be worth focusing on based on my 
description of where it got up to before the crash. Or any other 
suggestions for trying to help debug it.

FYI, there is some stderr output when I run kstars from the terminal. 
After launching kstars I get:

kf.i18n: KLocalizedString: Using an empty domain, fix the code. msgid: 
"unnamed object" msgid_plural: "" msgctxt: ""
kf.i18n: KLocalizedString: Using an empty domain, fix the code. msgid: 
"star" msgid_plural: "" msgctxt: ""
MESA: error: ZINK: failed to choose pdev
glx: failed to create drisw screen
Call to writableLocation without an application-based location.

There are MANY of the kf.i18n: errors that I haven't included. After the 
crash it shows:

KCrash: crashing... crashRecursionCounter = 2
KCrash: Application Name = kstars path = /usr/bin pid = 9019
KCrash: Arguments: /usr/bin/kstars
KCrash: Attempting to start /usr/lib/x86_64-linux-gnu/libexec/drkonqi
MESA: error: ZINK: failed to choose pdev
glx: failed to create drisw screen


I hope this helps, and I look forward to further ideas.

Regards,

Philip

On 10/12/24 12:12, Hy wrote:
> https://bugs.kde.org/show_bug.cgi?id=497187
>
> --- Comment #3 from Hy <hymur67@gmail.com> ---
> Philip,
> I no longer think that that change is a good idea. Sorry if you spent time
> testing it.  I just put i an MR with some changes and am trying to merge it
> into the 3.7.5 beta tree. When it's merged, or if you can get
> imagingPlanner.cpp and imagingPlanner.h from
> https://invent.kde.org/education/kstars/-/merge_requests/1385 please test that.
> If it does fix things, we can see if we can patch it into 3.7.4.
> Hy
>