Skip to content
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

Free Memory decreased by HTTP API requests #2216

Closed
semmel3k opened this issue Nov 17, 2024 · 16 comments
Closed

Free Memory decreased by HTTP API requests #2216

semmel3k opened this issue Nov 17, 2024 · 16 comments
Labels
bug Something isn't working
Milestone

Comments

@semmel3k
Copy link

DESCRIPTION

With frequent HTTP API requests every minute (for example with "/api?device=boiler&cmd=info") , the free memory continuously decreases until the module freezes after 45 minutes.
No other services active (MODBUS off; MQTT off, etc.). This occured with latest 3.7.0. and 3.7.1. developer version with ESP32-S3.

TO REPRODUCE

frequent HTTP API requests

EXPECTED BEHAVIOUR

That the free memory not decreases and no freeze

@proddy
Copy link
Contributor

proddy commented Nov 17, 2024

Thanks for reporting. We'll try and reproduce it. Can you send your Support Info please so we can see what hardware, memory etc is being used. Did you notice the same behaviour with v3.6.5?

@semmel3k
Copy link
Author

I guess the problem was also with v3.6.5
image

@proddy
Copy link
Contributor

proddy commented Nov 17, 2024

There's a benchmark load test I wrote a while back at https://github.com/emsesp/EMS-ESP32/blob/dev/scripts/run_memory_test.py . I'm not sure it works with the latest 3.7.0, so probably needs updating.

I don't know how 'techie' you are, but it'll help if you could try and reproduce this using a script (maybe with curl or a Python equivalent) and help trace where it's breaking. Or look into advancing that script above.

@semmel3k
Copy link
Author

The frequent requests I do with my Gira Homeserver. How can I trace the issue? Currently I can only see the discrease of free memory every 3-10 seconds.
Now I'm using MODBUS and this works well.

@proddy
Copy link
Contributor

proddy commented Nov 17, 2024

It's ok. It's just a script that uses curl and makes frequent API calls while monitoring the memory. I'll can work on that. The Gira homeserver is KNX based, you may be interested in the great work @Ing-Dom has been doing at #1737

@MichaelDvP
Copy link
Contributor

I don't think it's the api call. I have ioBroker adapter running with >50000 api reads the last day with no effect to memory.
Could you please add the system info from the help page.

@semmel3k
Copy link
Author

Yes, but currently I use Modbus.
emsesp_system_info.json.txt

@proddy
Copy link
Contributor

proddy commented Nov 18, 2024

I improved the memory load tests (in my fork) and ran it for 1hr calling boiler info, and saw no decrease in memory. I'll close this. If the issue is with Modbus (which doesn't use the API) then please create a new issue.

@proddy proddy closed this as completed Nov 18, 2024
@proddy proddy added the help wanted Extra attention is needed label Nov 18, 2024
@MichaelDvP
Copy link
Contributor

es, but currently I use Modbus.

You have still 38 API calls and 2 API fails. Could it be another API call, or a API fail that have the memory leak.
Can you reproduce or remember the AP calls/command you have used?

@proddy proddy reopened this Nov 18, 2024
@semmel3k
Copy link
Author

semmel3k commented Nov 18, 2024

Now with active HTTP API requests.
emsesp_system_info.json

image

image

Video.mov

@MichaelDvP
Copy link
Contributor

Does this setting mean that you always cut the connection before all data are received (3382 bytes)?
I think then some data stuck in sending buffer and waiting.

@semmel3k
Copy link
Author

semmel3k commented Nov 18, 2024

Yes but without this setting I have same behaviour. This was just a try to solve the problem without success.
Besides of the memory issue all works fine. I receive all informations that I need.

@MichaelDvP
Copy link
Contributor

Oh, just tested, if i use the v2 style command i can reproduce a memory leak.
Try v3 API: URL: api/boiler/info

MichaelDvP added a commit to MichaelDvP/EMS-ESP32 that referenced this issue Nov 18, 2024
@MichaelDvP
Copy link
Contributor

Please check 3.7.1-dev.9 from here https://github.com/MichaelDvP/EMS-ESP32/releases/tag/latest
Should work now also with v2 api commands.

@proddy
Copy link
Contributor

proddy commented Nov 18, 2024

great find @MichaelDvP - I was only testing v3 style.

and thanks @semmel3k for reporting this, you found a bug.

@semmel3k
Copy link
Author

Great work guys! I think we can close this issue 👍

@proddy proddy added this to the v3.7.1 milestone Nov 19, 2024
@proddy proddy added bug Something isn't working and removed help wanted Extra attention is needed labels Nov 19, 2024
proddy added a commit that referenced this issue Nov 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants