openatv / enigma2

openatv-gui
GNU General Public License v2.0
200 stars 314 forks source link

memory leak gdi lcd? #3076

Closed norhap closed 1 year ago

norhap commented 1 year ago

! Before registering an issue, have you updated to the latest version? use the latest version.

Describe the actual error/behavior: LCDlinux plugin is installed on the receiver, and configured with what was declared, after approximately 8 hours the receiver loses memory and becomes inaccessible.

Expected behavior: There should be no memory leak from installing and configuring a plugin.

Has this problem started occurring recently? I notice the problem since the changes in lcd.cpp were made

Play: Steps to reproduce the behavior:

  1. Install LCD4linux plugin
  2. configure the plugin within the options it offers.
  3. after approximately 8 hours
  4. The receiver loses memory and becomes inaccessible through the navigation menus.

Screenshots https://photos.google.com/share/AF1QipPZiIpRk6A46A1k_wYPW1I-8lQ7VsIlImcwaE9BZL9ZkRrUuix6quytX2fHPOLpig?key=ak9EVnMxX2dubmIxWWlMaVF6eXNGNTlPdUlmNkNR

Image/Box Model (please complete the following information):

Additional context This problem did not exist before the C++ changes. The video is in openspa, it uses the same C++ lcd code, it has also been played in OpenATV.

jbleyel commented 1 year ago

The latest changes on lcd.cpp are 4 months ago. Are you really sure abut this issue? Why didn't you notice the issue until now?

norhap commented 1 year ago

This problem has been reproduced and investigated from openspa, as you know openspa is based on ATV, and in version 8.0 before the changes you introduced in gdi lcd.cpp it was fine, with or without this plugin installed it was indifferent, openspa merged your changes As you say, a few months ago when 8.1 was released and that was when we reproduced this problem. (if I install 8.0 this problem does not exist). From here we started possible errors in openspa without any result, then it was decided to install openatv with the same configuration and indeed the problem is also present in openatv.

I am not sure if this is the problem, that is why I opened the issue in question, but with what we have deduced and given the differences that exist over time and the changes in the code, it is something that makes us think that these changes are the causes of such a problem.

norhap commented 1 year ago

gdi.zip

Huevos commented 1 year ago

Are you sure it is not the commits for the panel grab causing the problem? Nov 2022.

norhap commented 1 year ago

can you show me that change?

Huevos commented 1 year ago

I'm not sure. OpenViX took this code from ATV in december but not sure what commits in ATV it corresponds to.

https://github.com/OpenViX/enigma2/commit/2fd36593803e3220fda6e7f5759d7ea6dd92ff75

With this code after taking a few screen grabs of the panel the the onscreen rendering is completely broken.

Around this time people started reporting L4L memory leak problems. I'm not sure if that is related but the other bug is very real.

jbleyel commented 1 year ago

Dump lcd is for creating screenshots of the display. This has nothing to do with LCD4Linux. Except you making screenshots.

atvcaptain commented 1 year ago

the Mem Leak problem have but also users with SAMSUNG USB displays even with devices without display and the problem existed for a long time, so even before the rework of LCD GDI, the plugin creates masses of images, I think there is some memory is not released again, or it is always more files open and never closed, if in seconds images are created, it may be that always a few bytes less will be

if it was the internal display, which is used by all users even without lcd4linux , we would have much more problems

I also don't think it's pil because it's a standard E2 function as it is often used, otherwise we would have noticed it on all users.

jbleyel commented 1 year ago

With this code after taking a few screen grabs of the panel the the onscreen rendering is completely broken.

Around this time people started reporting L4L memory leak problems. I'm not sure if that is related but the other bug is very real.

I will check the dump function. There is probably a bug but this function is not used in the plugin as far as i know.

Huevos commented 1 year ago

Dump lcd is for creating screenshots of the display. This has nothing to do with LCD4Linux. Except you making screenshots.

Yes, exactly, so why does it corrupt the main on screen display? @Ev0-BH tested this on openATV and reports the same happens on that distro too after taking a few grabs of the panel.

jbleyel commented 1 year ago

I have started my box and I have called dumplcd 100 times. No issues here. Valgrind don't show any leak in lcd.cpp

jbleyel commented 1 year ago

Hi @Huevos , I cannot reproduce the screen grab issue on my box. What you mean with "a few" .. I have made 100 in a loop.

jbleyel commented 1 year ago

Valgrind has detected a lot of cpython leaks. This is probably false positive because of the gc. But there is definitely an issue if you reserve too much memory without explicit deletion after usage in a short time period. Especially if you use Pillow.

I think the Plugin needs a memory management design change.

This is not proved! It’s only another guess.

jbleyel commented 1 year ago

DumpLCD is fixed -> https://github.com/openatv/enigma2/commit/df56350737acce49eaa0f5965b9b0211c2a4cece

The leak in LCD4Linux needs to fix in the plugin.