Ian created a new topic ' KStars memory leak and crash' in the forum. 2 years ago

I recently updated all packages to the latest (available through astroberry) versions kstars-bleeding 3.5.5-1/libindi11.9.2-1. It's been a few months since I've updated (checking apt history: 3.4.3 -> 3.5.0 in January, 3.5.0 -> 3.5.2 in May, 3.5.2 -> 3.5.5 recently). Please let me know if there's any more info I can provide/debugging steps that would help.

I've noticed that the memory consumption of KStars slowly climbs throughout the night while imaging. Last night when checking on the mount just before the meridian flip was scheduled to start, I noticed KStars was closed while the mount was still tracking. Launching KStars notifies me that indi is running in the background and prompts to close the process to launch a fresh one. After launching KStars again, I set up a quick script to log memory usage to disk every 1m and noticed KStars steadily increased over the night from ~300MB to ~900MB reserved memory (no crash this time). Second highest memory usage was python (don't remember which script) @ ~60MB. In journalctl I see:

[color=#000000]Dec 02 21:31:25 astroberry kernel: usb 2-2: reset SuperSpeed Gen 1 USB device number 2 using xhci_hcd [/color]
Dec 02 21:31:26 astroberry kernel: usb 2-2: reset SuperSpeed Gen 1 USB device number 2 using xhci_hcd
Dec 02 21:31:28 astroberry kernel: usb 2-2: reset SuperSpeed Gen 1 USB device number 2 using xhci_hcd
Dec 02 21:31:29 astroberry kernel: usb 2-2: reset SuperSpeed Gen 1 USB device number 2 using xhci_hcd
Dec 02 21:31:30 astroberry kernel: usb 2-2: reset SuperSpeed Gen 1 USB device number 2 using xhci_hcd
Dec 02 21:31:31 astroberry python3[1047]: swig/python detected a memory leak of type 'INDI::BaseDevice::Properties *', no destructor found.
Dec 02 21:31:31 astroberry python3[1047]: swig/python detected a memory leak of type 'INDI::BaseDevice::Properties *', no destructor found.
Dec 02 21:31:31 astroberry python3[1047]: swig/python detected a memory leak of type 'INDI::BaseDevice::Properties *', no destructor found.
Dec 02 21:31:32 astroberry kernel: usb 2-2: reset SuperSpeed Gen 1 USB device number 2 using xhci_hcd
Dec 02 21:31:33 astroberry kernel: usb 2-2: reset SuperSpeed Gen 1 USB device number 2 using xhci_hcd
Dec 02 21:31:35 astroberry kernel: usb 2-2: reset SuperSpeed Gen 1 USB device number 2 using xhci_hcd
Dec 02 21:31:36 astroberry kernel: usb 2-2: reset SuperSpeed Gen 1 USB device number 2 using xhci_hcd
Dec 02 21:31:37 astroberry kernel: usb 2-2: reset SuperSpeed Gen 1 USB device number 2 using xhci_hcd

repeatedly throughout the night.
usb 2-2 is the ASI120MM-S
, and from what I can tell this is "normal" behavior. The swig/python memory leak stands out however. Looking at the python processes running I see:
- /usr/bin/indi-mqtt.py
- /var/www/astropanel/astropanel.py
- /var/www/gpspanel/gpspanel.py
- /var/www/indiwebmanager/main.py
- /usr/bin/virtualgps.py

and it looks like the mqtt and web manager both talk with indi, maybe they're involved/triggering the leak somehow?

Backtrace (probably not helpful since it just crashed due to OOM):
[color=#000000]Core was generated by `kstars'. [/color]
Program terminated with signal SIGABRT, Aborted.
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
50      ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
[Current thread is 1 (Thread 0xa3e81080 (LWP 1793))]
(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1  0xb37ba230 in __GI_abort () at abort.c:79
#2  0xb380a50c in __libc_message (action=action@entry=do_abort, fmt=<optimized out>) at ../sysdeps/posix/libc_fatal.c:181                                                                                           
#3  0xb3811034 in malloc_printerr (str=<optimized out>) at malloc.c:5341
#4  0xb3812e50 in _int_free (av=<optimized out>, p=0x7e7c1b20, have_lock=0) at malloc.c:4258
#5  0xb55db970 in QVector<float>::reallocData(int, int, QFlags<QArrayData::AllocationOption>) () from /usr/lib/arm-linux-gnueabihf/libstellarsolver.so.1                                                            
#6  0xb55e3288 in InternalSextractorSolver::extractPartition(InternalSextractorSolver::ImageParams const&) () from /usr/lib/arm-linux-gnueabihf/libstellarsolver.so.1                                               
#7  0xb55ea5b0 in non-virtual thunk to QtConcurrent::RunFunctionTask<QList<FITSImage::Star> >::run() () from /usr/lib/arm-linux-gnueabihf/libstellarsolver.so.1                                                     
#8  0xb414df30 in ?? () from /usr/lib/arm-linux-gnueabihf/libQt5Core.so.5
#9  0xb4156b58 in ?? () from /usr/lib/arm-linux-gnueabihf/libQt5Core.so.5
#10 0xb4f06494 in start_thread (arg=0xa3e81080) at pthread_create.c:486
#11 0xb387a568 in ?? () at ../sysdeps/unix/sysv/linux/arm/clone.S:73 from /lib/arm-linux-gnueabihf/libc.so.6                                                                                                        
Backtrace stopped: previous frame identical to this frame (corrupt stack?)

journalctl of crash (started KStars ~7:30pm, crashed ~9:54pm):
[color=#000000]Dec 02 21:52:25 astroberry kernel: usb 2-2: reset SuperSpeed Gen 1 USB device number 2 using xhci_hcd [/color]
Dec 02 21:52:26 astroberry kernel: usb 2-2: reset SuperSpeed Gen 1 USB device number 2 using xhci_hcd
Dec 02 21:52:28 astroberry kernel: usb 2-2: reset SuperSpeed Gen 1 USB device number 2 using xhci_hcd
Dec 02 21:52:28 astroberry kernel: [color=#000000]usb 2-2: WARN: Max Exit Latency too large[/color][color=#000000] [/color]
Dec 02 21:52:28 astroberry kernel: [color=#000000]usb 2-2: Could not enable U2 link state, xHCI error -22.[/color][color=#000000] [/color]
Dec 02 21:52:28 astroberry python3[1047]: swig/python detected a memory leak of type 'INDI::BaseDevice::Properties *', no destructor found.
Dec 02 21:52:28 astroberry python3[1047]: swig/python detected a memory leak of type 'INDI::BaseDevice::Properties *', no destructor found.
Dec 02 21:52:28 astroberry python3[1047]: swig/python detected a memory leak of type 'INDI::BaseDevice::Properties *', no destructor found.
Dec 02 21:52:29 astroberry kernel: usb 2-2: reset SuperSpeed Gen 1 USB device number 2 using xhci_hcd
Dec 02 21:52:30 astroberry systemd[1]: Created slice system-systemd\x2dcoredump.slice.
Dec 02 21:52:30 astroberry systemd[1]: Started Process Core Dump (PID 5473/UID 0).
Dec 02 21:53:10 astroberry python3[1047]: swig/python detected a memory leak of type 'INDI::BaseDevice::Properties *', no destructor found.
Dec 02 21:53:11 astroberry python3[1047]: swig/python detected a memory leak of type 'INDI::BaseDevice::Properties *', no destructor found.
Dec 02 21:53:11 astroberry python3[1047]: swig/python detected a memory leak of type 'INDI::BaseDevice::Properties *', no destructor found.
Dec 02 21:53:52 astroberry python3[1047]: swig/python detected a memory leak of type 'INDI::BaseDevice::Properties *', no destructor found.
Dec 02 21:53:52 astroberry python3[1047]: swig/python detected a memory leak of type 'INDI::BaseDevice::Properties *', no destructor found.
Dec 02 21:53:52 astroberry python3[1047]: swig/python detected a memory leak of type 'INDI::BaseDevice::Properties *', no destructor found.
Dec 02 21:53:58 astroberry systemd-coredump[5474]: [color=#ff5454]Process 1782 ([/color][color=#ffffff]kstars[/color][color=#ff5454]) of user 1001 dumped core.[/color][color=#000000] [/color]
                                                   
                                                  [color=#ff5454]Stack trace of thread 1793:[/color][color=#000000] [/color]
                                                  [color=#ff5454]#0  0x00000000b37cef14 __GI_raise (libc.so.6)[/color][color=#000000] [/color]
                                                  [color=#ff5454]#1  0x00000000b37ba230 __GI_abort (libc.so.6)[/color][color=#000000] [/color]
                                                  [color=#ff5454]#2  0x00000000b380a50c __libc_message (libc.so.6)[/color][color=#000000] [/color]
                                                  [color=#ff5454]#3  0x00000000b3811034 malloc_printerr (libc.so.6)[/color][color=#000000] [/color]
                                                  [color=#ff5454]#4  0x00000000b3812e50 _int_free (libc.so.6)[/color][color=#000000] [/color]
                                                  [color=#ff5454]#5  0x00000000b55db970 _ZN7QVectorIfE11reallocDataEii6QFlagsIN10QArrayData16AllocationOptionEE (libstellarsolver.so.1)[/color][color=#000000] [/color]
Dec 02 21:53:59 astroberry systemd[1]: systemd-coredump@0-5473-0.service: Succeeded.
Dec 02 21:54:34 astroberry python3[1047]: swig/python detected a memory leak of type 'INDI::BaseDevice::Properties *', no destructor found.
Dec 02 21:54:34 astroberry python3[1047]: swig/python detected a memory leak of type 'INDI::BaseDevice::Properties *', no destructor found.
Dec 02 21:54:34 astroberry python3[1047]: swig/python detected a memory leak of type 'INDI::BaseDevice::Properties *', no destructor found.
Dec 02 21:55:15 astroberry python3[1047]: swig/python detected a memory leak of type 'INDI::BaseDevice::Properties *', no destructor found.
Dec 02 21:55:15 astroberry python3[1047]: swig/python detected a memory leak of type 'INDI::BaseDevice::Properties *', no destructor found.
Dec 02 21:55:15 astroberry python3[1047]: swig/python detected a memory leak of type 'INDI::BaseDevice::Properties *', no destructor found.
Dec 02 21:55:57 astroberry python3[1047]: swig/python detected a memory leak of type 'INDI::BaseDevice::Properties *', no destructor found.
Dec 02 21:55:57 astroberry python3[1047]: swig/python detected a memory leak of type 'INDI::BaseDevice::Properties *', no destructor found.
Dec 02 21:55:57 astroberry python3[1047]: swig/python detected a memory leak of type 'INDI::BaseDevice::Properties *', no destructor found.
Dec 02 21:56:40 astroberry python3[1047]: swig/python detected a memory leak of type 'INDI::BaseDevice::Properties *', no destructor found.
Dec 02 21:56:40 astroberry python3[1047]: swig/python detected a memory leak of type 'INDI::BaseDevice::Properties *', no destructor found.
Dec 02 21:56:40 astroberry python3[1047]: swig/python detected a memory leak of type 'INDI::BaseDevice::Properties *', no destructor found.
Dec 02 21:57:22 astroberry python3[1047]: swig/python detected a memory leak of type 'INDI::BaseDevice::Properties *', no destructor found.
Dec 02 21:57:22 astroberry python3[1047]: swig/python detected a memory leak of type 'INDI::BaseDevice::Properties *', no destructor found.
Dec 02 21:57:22 astroberry python3[1047]: swig/python detected a memory leak of type 'INDI::BaseDevice::Properties *', no destructor found.
Dec 02 21:58:03 astroberry python3[1047]: swig/python detected a memory leak of type 'INDI::BaseDevice::Properties *', no destructor found.
Dec 02 21:58:03 astroberry python3[1047]: swig/python detected a memory leak of type 'INDI::BaseDevice::Properties *', no destructor found.
Dec 02 21:58:03 astroberry python3[1047]: swig/python detected a memory leak of type 'INDI::BaseDevice::Properties *', no destructor found.
Dec 02 21:58:45 astroberry python3[1047]: swig/python detected a memory leak of type 'INDI::BaseDevice::Properties *', no destructor found.

swig/python messages continue to print after kstars crashed, I'm assuming because indi is still running in the background.

Setup:
- Raspberry Pi 4 Model B/2GB running Astroberry
- ZWO ASI120MM-S (indi_asi_ccd)
- Sky-Watcher EQ6-R Pro (indi_eqmod_telescope)
- Olympus O-MD E-M10 Mark II (external intervalometer, not connected to Pi)

Imaging process:
- Go-to target
- Align -> Slew to target
- Adjust manually
- Align -> Sync
- Mount -> meridian flip @ 0.5h (scheduled to flip ~12am), HA limit 1.5h, park @ 4:10am
- Guide via EQMod Mount
- Start external intervalometer

Read More...