Robusto replied to the topic 'Memory Leak' in the forum. 4 years ago

Indeed, those two settings do the magic - but this is probably not just about getting memory filled as this happens even with a handful of captured frames.
This is very disappointing, I finally bit the bullet and upgraded my KStars to the latest and this is now practically unusable the way it is.

Also, brief rundown on how to reproduce the problem:

- Using simulator devices: CCD sim, telescope sim, guider sim
- Created a new sequence (3x lum, 3x red) and saved it
- Opened the scheduler, chose M 34 (I doubt this matters), selected the sequence
- Did not touch the sequence conditions
- Add and run the sequence

A crash will most likely occur at some point (had one happen at 2 frames, one happen at 3 frames, etc).
I doubt this is even exactly a simple memory leak since it happens so quickly, and my machine has 8GB of RAM, a pair of simulator camera frames hardly make a dent.
As said, disabling those two options act as a workaround, so this is definitely FITS viewer related.

Attached a verbose log.
The crash happens right after "Reading FITS file buffer".

I tried the bug reporting tool but unfortunately it failed to get anything useful out of it, so I tried running it with gdb, and that perhaps gave out something useful:

Thread 14 "Thread (pooled)" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffa1cc2700 (LWP 8338)]
0x00005555557d7878 in FITSData::loadWCS (this=0x55555b2185e0) at ./kstars/fitsviewer/fitsdata.cpp:2444

And backtrace for thread 14:
Thread 14 (Thread 0x7fffa1cc2700 (LWP 8338)):
#0  0x00005555557d7878 in FITSData::loadWCS (this=0x55555b2185e0) at ./kstars/fitsviewer/fitsdata.cpp:2444
#1  0x00005555557b01c2 in QtConcurrent::StoredMemberFunctionPointerCall0<bool, FITSData>::runFunctor (this=0x55555ba61720)
    at /usr/include/x86_64-linux-gnu/qt5/QtConcurrent/qtconcurrentstoredfunctioncall.h:189
#2  0x00005555556748e5 in QtConcurrent::RunFunctionTask<bool>::run (this=0x55555ba61720)
    at /usr/include/x86_64-linux-gnu/qt5/QtConcurrent/qtconcurrentrunbase.h:108
#3  0x00007ffff21dc2b2 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#4  0x00007ffff21df17d in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#5  0x00007ffff14ab6db in start_thread (arg=0x7fffa1cc2700) at pthread_create.c:463
#6  0x00007ffff026788f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

And backtrace for Thread 1:
Thread 1 (Thread 0x7ffff7f9a440 (LWP 8321)):
#0  0x00007ffff14b19f3 in futex_wait_cancelable (private=<optimized out>, expected=0, futex_word=0x55555ba01d90)
    at ../sysdeps/unix/sysv/linux/futex-internal.h:88
#1  __pthread_cond_wait_common (abstime=0x0, mutex=0x55555ba01d40, cond=0x55555ba01d68) at pthread_cond_wait.c:502
#2  __pthread_cond_wait (cond=0x55555ba01d68, mutex=0x55555ba01d40) at pthread_cond_wait.c:655
#3  0x00007ffff21e05ab in QWaitCondition::wait(QMutex*, unsigned long) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#4  0x00007ffff21d30e0 in QFutureInterfaceBase::waitForFinished() () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#5  0x00005555557bbd72 in FITSView::loadFITSFromData (this=this@entry=0x55555b9fef10, data=data@entry=0x55555c239000, inFilename=...)
    at ./kstars/fitsviewer/fitsview.cpp:309
#6  0x000055555590f53c in FITSTab::loadFITSFromData (this=this@entry=0x55555b10b650, data=data@entry=0x55555c239000, imageURL=..., 
    mode=<optimized out>, filter=<optimized out>) at ./kstars/fitsviewer/fitstab.cpp:478
#7  0x00005555558f6715 in FITSViewer::updateFITSFromData (this=0x7fff48001c30, data=data@entry=0x55555c239000, imageName=..., 
    fitsUID=<optimized out>, tab_uid=tab_uid@entry=0x7fffffffd560, filter=filter@entry=FITS_NONE) at ./kstars/fitsviewer/fitsviewer.cpp:538
#8  0x00005555558d3786 in ISD::CCD::processBLOB (this=0x555557c64380, bp=0x7fff7c0186d0) at ./kstars/indi/indiccd.cpp:1722
#9  0x00005555558c0656 in INDIListener::processBLOB (this=<optimized out>, bp=0x7fff7c0186d0) at ./kstars/indi/indilistener.cpp:435
#10 0x000055555586b1d4 in INDIListener::qt_static_metacall (_o=<optimized out>, _c=<optimized out>, _id=<optimized out>, _a=<optimized out>)
    at ./obj-x86_64-linux-gnu/kstars/KStarsLib_autogen/FRI4DANIHA/moc_indilistener.cpp:189
#11 0x00007ffff23ec645 in QMetaObject::activate(QObject*, int, int, void**) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#12 0x00005555558389a2 in ClientManager::newINDIBLOB (this=<optimized out>, _t1=<optimized out>)
    at ./obj-x86_64-linux-gnu/kstars/KStarsLib_autogen/FRI4DANIHA/moc_clientmanager.cpp:363
#13 0x00007ffff23ed1b2 in QObject::event(QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#14 0x00007ffff384283c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#15 0x00007ffff384a104 in QApplication::notify(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#16 0x00007ffff23bd9c8 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#17 0x00007ffff23c013d in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#18 0x00007ffff2417353 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#19 0x00007fffed8f3417 in g_main_context_dispatch () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#20 0x00007fffed8f3650 in ?? () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#21 0x00007fffed8f36dc in g_main_context_iteration () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#22 0x00007ffff241697f in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#23 0x00007ffff23bb9fa in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#24 0x00007ffff23c4aa4 in QCoreApplication::exec() () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#25 0x000055555562a412 in main (argc=<optimized out>, argv=<optimized out>) at ./kstars/main.cpp:333

I hope this'll help in investigating this.

Read More...