×

INDI Library v2.0.6 is Released (02 Feb 2024)

Bi-monthly release with minor bug fixes and improvements

Memory Leak

  • Posts: 1119
  • Thank you received: 182

Replied by Jose Corazon on topic Memory Leak


I was about to make the same comment. That box needs to be checked to prevent consecutive tabs from opening.
In addition, I always leave my FITS viewer minimized. I also use an SSD with swap enabled, that might also make a difference.
I had the memory overflow a couple of times, but only when I ran KStars from a microSD card. Unsure how to explain that, though.

4 years 2 months ago #47751
Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 44
  • Thank you received: 10

Replied by J. Hill on topic Memory Leak

Sounds strange, but I can apparently duplicate the memory leak with those options disabled. Using Canon T6s, Astroberry over VNC. I duplicated with upload to client set. After a few images, I get the "Unsufficient Memory" errors.

I did some testing with the CCD Simulator (with the same frame size as the Canon) and did not notice a memory leak, even looping to the FITS viewer.
4 years 2 months ago #47752

Please Log in or Create an account to join the conversation.

  • Posts: 1119
  • Thank you received: 182

Replied by Jose Corazon on topic Memory Leak



I should have kept my big mouth shut! I did not have these out of memory problems for a long time - until last night.
I had made no changes to my configuration from the night before, when the system performed flawlessly and collected over 300 frames. Last night it ran out of memory after 113. I woke up to the message on the desktop that there was not enough free memory to report the cause of the crash. KStars had shut down.
I have no clue what is causing this, but I did not change any of the parameters I had highlighted earlier. And as I said, the system performed great the night before, no changes made, no updates, nothing....
4 years 2 months ago #47761

Please Log in or Create an account to join the conversation.

  • Posts: 983
  • Thank you received: 375

Replied by Radek Kaczorek on topic Memory Leak

I have just confirmed that after disabling FITS previews there is no memory leak. You can go hundreds of frames with no problem whatsoever.
The workaround to the memory leak is to disable:
- fits viewer (Settings / Configure KStars / FITS / Use FITS Viewer) and
- preview on main Ekos tab (Settings / Configure KStars / Ekos / Capture / Summary Screen Preview)
The following user(s) said Thank You: Robusto
4 years 2 months ago #47790

Please Log in or Create an account to join the conversation.

  • Posts: 10
  • Thank you received: 3

Replied by Robusto on topic Memory Leak

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.
The following user(s) said Thank You: Radek Kaczorek, Tim Schuh
4 years 2 months ago #47797
Attachments:

Please Log in or Create an account to join the conversation.

Replied by Jasem Mutlaq on topic Memory Leak

The WCS crash is not a memory leak issue, but thread synchronization issue that I thought we resolved already. At any rate, I just pushed memory-related fixes in the hope that it improves the situation. Can everyone please compile from GIT and report back?
The following user(s) said Thank You: Tim Schuh
4 years 2 months ago #47833

Please Log in or Create an account to join the conversation.

  • Posts: 10
  • Thank you received: 3

Replied by Robusto on topic Memory Leak

I suspected as much - when did the thread sync issue get fixed, which commit hash? It is present in the current release, 3.3.9 (Build 2020-01-02T08:17:38Z).
I did try to re-produce that yesterday from the latest sources but failed, so it does seem like it has been fixed (can't be 100% sure since I was testing on another computer) but I can't exactly find which commit did that.
4 years 2 months ago #47843

Please Log in or Create an account to join the conversation.

  • Posts: 1208
  • Thank you received: 559

Replied by Hy Murveit on topic Memory Leak

I'm curious if there's a common thread among the people who experience this leak (e.g. I still can't replicate it, and as of recently, I don't believe Jasem could either--I know he's hard at work looking into it). For instance, are you all DSLR users? RGB camera users with debayering, etc?

If you experience this leak, could you please post more details about the minimum configuration you use that will trigger this leak.
E.g.:
camera model and type, e.g. Canon DSLR with resolution WxH, ZWO 1600 monochome resolution WxH, ...
fits, raw, ???
Running fitsviewer while you capture?
Processor (e.g. RPi4) on what OS (Raspbian? Ubuntu 18.04? Stellarmate?)
How did you install KStars (Stellarmate, AstroPi3, AstroBerry, ...)
What release are you using when you observed the leak? (released 3.3.9, nightly at what date),

Also, can you tell how much is leaked per image? (e.g. by running the linux command 'ps aux | grep kstars" after every 5th or 10th image for as long as makes sense) and how that relates to the size of the image your camera captures

Thanks,
Hy
4 years 2 months ago #47900

Please Log in or Create an account to join the conversation.

  • Posts: 388
  • Thank you received: 17

Replied by Ronald Scotti on topic Memory Leak

I have not experienced the memory link and have not had clear skies to try my cameras (SBIG 8300M and SX Lodestar) other than test shots. But I applied the two settings recommended above and then the issue is that you have no star image in the focus routing. you can pull it up in the fits viewer, but you cannot select stars there.

I am hoping this is not an issue with my setup and have gone back to the 'normal' settings.

thanks,
Ron
4 years 2 months ago #47991

Please Log in or Create an account to join the conversation.

  • Posts: 527
  • Thank you received: 139

Replied by Andrew Burwell on topic Memory Leak


I experienced this recently, it’s unrelated. But it seems that drivers for cameras got reset to default values with one of the latest updates. Make sure your camera is set to 16-bit raw. Mine reset to 8-bit and no guide stars showed up.
4 years 2 months ago #47992

Please Log in or Create an account to join the conversation.

  • Posts: 388
  • Thank you received: 17

Replied by Ronald Scotti on topic Memory Leak

thanks I will check, but I don't think that was my issue. When I changed to 2 settings back as they were originally, the star window did show up again, with no changes to camera driver.

This overall program is 'extremely' complicated and I find I have to test everything I want to use before hand; otherwise I am sure to have a problem (mostly of my understanding of available options) when I go to actually use a module.

thanks for all the hard work.
Ron
4 years 2 months ago #47999

Please Log in or Create an account to join the conversation.

  • Posts: 4
  • Thank you received: 0

Replied by Tim Schuh on topic Memory Leak


I'm on a 4GB RPi4 running StellarmateOS, updated via internet between tests. I haven't got a record of the versions that I experienced this issue with since I've upgraded Stellarmate since then. It would have been what ever packages were published when I started this thread.

Camera I was using here is a QHY168C, consuming about 300MB per frame, filling 4GB of RAM in less than 15 frames. Shooting FITS and debayered. I will test again tonight.
4 years 2 months ago #48016

Please Log in or Create an account to join the conversation.

Time to create page: 0.926 seconds