Admin interface creates memory problem.
my AD uses a lot of run_ins (also with run_in(cb,0)) when a lot of run_ins are used in a short time and the admin is opened, memory from AD grows.
in my case, without admin, AD uses 55 MB. with admin, on the peak moments that a lot of motion is there, AD memory grows up to 6 GB!
this is with AD dev from 18 august 2020
edit: this AD only got 1 app that is instantiated around 300 times.
the principle from the app is:
listen_state(CB1, entity, custom_constraint = {from args}) or
run_at_sunset(CB2, custom_constraint = {from args}) or
run_at_sunrise(CB2 , custom_constraint = {from args}) or
run_daily(CB2, starttime, custom_constraint = {from args})
def CB1(...):
run_in(CB3,delay)
def CB2(...):
run_in(CB3,delay)
def CB3(...):
for arg in args_list:
run_in(CB4, delay) or
run_in(CB5, delay) or
run_in(CB7, delay) or
run_in(CB8, delay) or
...
I can confirm that admin interface definitely can cause heavy memory problems. Last time I developed new Appdaemon apps I was using the interface very often with different browsers on several hardware platforms and many manual page refresh requests. This caused a huge increase of memory consumption (starting from 25 MB to some GB on Raspi4/4GB) and I observed twice a strange refresh loop which ended up in a complete automatic reset of the Appdaemon after memory errors. Unfortunately I cannot provide debug logs right now but when I have some time, I will try to reproduce this problem.
im not sure if the use from the AI is making much difference. but im sure that what is in the apps makes a lot of difference.
if there are a lot of callbacks called in a short time, then even without the AI opened, memory increases rapidly. in AD version with a simular amount of apps, but way less callbacks called i dont see the problem.
if after a severe memory increase AD gets to a more quiet period, the memory goes down again.
so to me it seems like there is a pile up somewhere when AD is heavyly used.
ok, I think we are facing two different problems here. When I restart AD and never use Admin interface at all, memory consumption stays about 25-30MB. As soon as I start using Admin Interface (open it several times, refresh pages, etc.) memory increases and never gets down again, even after some time. I will start using glance addon to track memory and come back with some debug logs.
Closing as we have a new version of the AUI - please feel free to re-open if this is still problem in the new code.