-
-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: Potential off-heap memory leak on Linux #147
[Bug]: Potential off-heap memory leak on Linux #147
Comments
@jypma What Linux distro are you using? KDE or GNOME or whatelse? |
I'll have a go with the beta, thanks! I'm using Arch linux. Using neither KDE or GNOME, just i3 as window manager on plain X11. |
I've tried with a beta version, and I'm still seeing the same behavior. The memory usage increases with about 2MB per second when the streaming is active. |
@jypma |
@jypma I correct myself. I'm not able to reproduce it... memory usage tops out a bit higher than XMX since Luciferin uses "off heap" memory due to native calls to the OS using JNA but then stops growing... Using -Xmx256M is not recommended since it's not enough for all the "capture, post process"... Using the default Xmx1024 my RAM usage tops out at 1.1GiB. Have you tried waiting to see what is the max memory used? |
I'm monitoring the heap usage using
Do you know which native libraries might be in use that stream the video frames into Java? Perhaps it's something outside of firefly that has the leak. I'll also revert to 2.9.2 (the last version I was running before the upgrade), to see what behavior we get there. |
@jypma GStreamer is a lib that uses native APIs, which version are you using? you can check it via
GStreamer is not bundled in the Luciferin's deb or rpm package so this depends on your installation. Reverting back to a previous version of GStreamer may worth a try but be sure to correctly use the package manager in order to not "compromise" your installation. |
It's currently
and I seem to have upgraded from |
ok please keep me posted @jypma :) |
Here's what I've been able to test so far. Downgrade to Luciferin 2.9.2
Back on 2.12.5
and on the latest beta (slightly different):
These are continually occurring, possibly on every frame. I didn't pay attention to them before, figuring it might be a different issue. Don't know JNA that well, but an exception inside a callback there might be reason for some memory to disappear. Now that you mention Downgrade gstreamer from 1.22.6 to 1.20.3
ConcludingI think the above exception is the biggest smoking gun. |
mmm... this is interesting... can you attach the complete FireflyLuciferin.yaml you are using please? |
The LEDs work fine when the exception occurs. Which is strange 😄 Current config is here: FireflyLuciferin.yaml.gz As mentioned above, I'm using firmware 5.11.8, which is the latest release I found on Github. Should I use a different one? I don't think it's likely that the firmware would be causing a memory leak in the client though. It's displaying LED data from both Luciferin versions just fine. |
The magic numbers in this calculation return a negative border size when running at 1280x720 resolution. Let's return at least 0 for all cases, while a more appropriate calculation is derived. Fixes sblantipodi#147.
I decided to dive a little deeper, and a bit of extra logging showed PR is here: #150 |
I love this kind of issue that ends with a pull request :D |
PS: A new release is coming soon and it will obviously include your fix. |
The magic numbers in this calculation return a negative border size when running at 1280x720 resolution. Let's return at least 0 for all cases, while a more appropriate calculation is derived. Fixes #147.
- ***Breaking changes***: requires `Firefly Luciferin` (v2.13.8). - **Introducing the [Luciferin surround lighting with satellites](https://github.com/sblantipodi/firefly_luciferin/wiki/Surround-lighting-with-satellites). Closes [#97](sblantipodi/firefly_luciferin#97 - **[Added Wayland support for Linux.](https://github.com/sblantipodi/firefly_luciferin/wiki/Linux-support#luciferin-supports-wayland)** Thanks @h7io for the contribution to this feature. Closes [#130](sblantipodi/firefly_luciferin#130). - **It's now possible to [**disable Glow Worm device auto discovery**](https://github.com/sblantipodi/firefly_luciferin/wiki/Static-IP-and-auto-discovery) in Firefly Luciferin PC software.** This is useful when PC and ESP lives in separate VLANs/Subnets. Closes [#132](sblantipodi/firefly_luciferin#132). - **Added the possibility to average the color of the screen on all the LEDs**. - **Big performance improvements for [Linux](https://github.com/sblantipodi/firefly_luciferin/wiki/Linux-support) while running on X11.** - **Added an optimization for [Linux users that is specific for NVIDIA GPUs](https://github.com/sblantipodi/firefly_luciferin/wiki/Linux-support#nvidia-cuda).** Thanks to @Phoshi for the support on this feature. - **Ram usage improvements.** - **UI/UX improvements.** Revamped title bar, one left click on tray icon now open settings. Double left click on tray icon starts/stops screen capture, right left click opens the menu as usual. (Windows only, Linux version has no tray bar). - Added an option during the installation process to create a desktop shortcut to Firefly Luciferin (Windows only). - Added an option during the installation process to create a start menu shortcut to Firefly Luciferin (Windows only). - Potential off-heap memory leak on Linux. Fixed. Thanks @jypma for fixing this issue. Closes [#147](sblantipodi/firefly_luciferin#147). - Firefly Luciferin caused a brief audio stutter on some systems during startup. Fixed. - Fixed sporadic crashes on ESP32-S3 devices. - Fixed an issue that prevented Glow Worm Luciferin firmware to be [flashed using external tools like esptool](https://github.com/sblantipodi/firefly_luciferin/wiki/How-to-flash-Glow-Worm-Luciferin-firmware-via-esptool). - Upgrade to Java 21 and JavaFX 21. - [Arduino Bootstrapper](https://github.com/sblantipodi/arduino_bootstrapper/releases) update (v.1.15.3).
- ***Breaking changes***: requires `Glow Worm Luciferin` firmware (v5.12.9). - **Introducing the [Luciferin surround lighting with satellites](https://github.com/sblantipodi/firefly_luciferin/wiki/Surround-lighting-with-satellites). Closes [#97](#97 - **[Added Wayland support for Linux.](https://github.com/sblantipodi/firefly_luciferin/wiki/Linux-support#luciferin-supports-wayland)** Thanks @h7io for the contribution to this feature. Closes [#130](#130). - **It's now possible to [**disable Glow Worm device auto discovery**](https://github.com/sblantipodi/firefly_luciferin/wiki/Static-IP-and-auto-discovery) in Firefly Luciferin PC software.** This is useful when PC and ESP lives in separate VLANs/Subnets. Closes [#132](#132). - **Added the possibility to average the color of the screen on all the LEDs**. - **Big performance improvements for [Linux](https://github.com/sblantipodi/firefly_luciferin/wiki/Linux-support) while running on X11.** - **Added an optimization for [Linux users that is specific for NVIDIA GPUs](https://github.com/sblantipodi/firefly_luciferin/wiki/Linux-support#nvidia-cuda).** Thanks to @Phoshi for the support on this feature. - **Ram usage improvements.** - **UI/UX improvements.** Revamped title bar, one left click on tray icon now open settings. Double left click on tray icon starts/stops screen capture, right left click opens the menu as usual. (Windows only, Linux version has no tray bar). - Added an option during the installation process to create a desktop shortcut to Firefly Luciferin (Windows only). - Added an option during the installation process to create a start menu shortcut to Firefly Luciferin (Windows only). - Potential off-heap memory leak on Linux. Fixed. Thanks @jypma for fixing this issue. Closes [#147](#147). - Firefly Luciferin caused a brief audio stutter on some systems during startup. Fixed. - Fixed sporadic crashes on ESP32-S3 devices. - Fixed an issue that prevented Glow Worm Luciferin firmware to be [flashed using external tools like esptool](https://github.com/sblantipodi/firefly_luciferin/wiki/How-to-flash-Glow-Worm-Luciferin-firmware-via-esptool). - Upgrade to Java 21 and JavaFX 21. - [Arduino Bootstrapper](https://github.com/sblantipodi/arduino_bootstrapper/releases) update (v.1.15.3).
Firefly Luciferin version
2.12.5
Glow Worm Luciferin version
5.11.8
Firmware type
FULL
What is the stream method?
MQTT Stream
Fiefly Luciferin config file
Relevant log output
How to reproduce
Start the video grabber, everything with default options, except for streaming through MQTT.
I've manually started the application using
(on JDK21), to rule out heap usage. The heap and metaspace both look fine, but the RES memory usage of the process increases with ~100MB every few seconds. I've looked at some hints to diagnose, but nothing stands out there. NIO ByteBuffers aren't much in use. I did in
pmap
find a lot of the following entries:So something is allocating memory in 64MB chunks (and it's probably not heap).
That's as far as I got...any hints? I'm unsure which version introduced this, it's been a while since I've attempted to upgrade :-)
The text was updated successfully, but these errors were encountered: