mirror of
https://github.com/tzapu/WiFiManager.git
synced 2026-04-27 09:05:56 +03:00
[GH-ISSUE #1663] wm.autoConnect(ssid, password); consumes cumulative memory #1411
Labels
No labels
📶 WiFi
🕸️ HTTP
Branch
DEV Help Wanted
Discussion
Documentation
ESP32
Example
Good First Issue
Hotfix
In Progress
Incomplete
Needs Feeback
Priority
QA
Question
Task
Upstream/Dependancy
bug
duplicate
enhancement
invalid
pull-request
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/WiFiManager#1411
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @RulioHT2021 on GitHub (Oct 9, 2023).
Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/1663
PLEASE TRY Latest Master BRANCH before submitting bugs, in case they were already fixed.
Issues without basic info will be ignored or closed!
Please fill the info fields, it helps to get you faster support ;)
if you have a stack dump decode it:
https://github.com/esp8266/Arduino/blob/master/doc/Troubleshooting/stack_dump.rst
for better debug messages:
https://github.com/esp8266/Arduino/blob/master/doc/Troubleshooting/debugging.rst
----------------------------- Remove above -----------------------------
Basic Infos
Hardware
WiFimanager Branch/Release: Master
Esp8266/Esp32:
Hardware: ESP-12e, esp01, esp25
Core Version: 2.4.0, staging
Description
Problem description
Settings in IDE
Module: NodeMcu, Wemos D1
Additional libraries:
Sketch
Debug Messages
@RulioHT2021 commented on GitHub (Oct 9, 2023):
Sorry, I'm new here, I'm having a memory problem, as each reconnection test consumes more memory.
@tablatronix commented on GitHub (Oct 10, 2023):
Will test thanks
@tablatronix commented on GitHub (Oct 10, 2023):
I am assuming you have removed your local callouts to timeClient, ping, client checks and you are not leaking memory in them ?
@tablatronix commented on GitHub (Oct 10, 2023):
Make sure you are pulling git, there was an esp8266 fix recently
I am calling autoconnect in a loop and not leaking any memory.. Are you using blocking or non blocking mode?
Let me try esp8266
@RulioHT2021 commented on GitHub (Oct 10, 2023):
Sorry I wasn't so clear, after connecting the network I turn off the router and with each reconnection attempt with the router turned off it consumes memory.
I'm using it without blocking.
@tablatronix commented on GitHub (Oct 11, 2023):
Ok so the configportal is starting each time? How do you get out of it, do you have a timeout?
and how do you know its not your code?
@tablatronix commented on GitHub (Oct 11, 2023):
Not seeing it, what exact hardware you using ?
@RulioHT2021 commented on GitHub (Oct 11, 2023):
`bool ping_test(){
bool success = Ping.ping(p_url, 1);
float avg_time_ms = Ping.averageTime();
if (success) {
resp = "{"avg_ping":"" + String(avg_time_ms) + ""}";
} else {
resp = "{"avg_ping":"erro"}";
}
return success;
}
if(((millis() - time_conect_broker) >= 60000)||(timeClient.getSeconds() == 50)){
Serial.println("Tempo atingido!");
time_conect_broker = millis();
digitalWrite(LED, HIGH);
if(!client.connected()){
Serial.println("Chamando task_reconnect");
xTaskCreate(
task_reconnect, //Nome da função
"task_reconnect", //Nome da tarefa
10000, //Tamanho da tarefa
NULL, //Parametros
2, //Prioridade
NULL //Handle
);
}else{
Serial.println("Conectado!");
}
}
`
@RulioHT2021 commented on GitHub (Oct 11, 2023):
I make a routine to check if 60 seconds have passed or if the timestamp is correct when it is 50 seconds, and I leave it inside the main loop.
@tablatronix commented on GitHub (Oct 11, 2023):
Are you sure your tasks wrappers are cleaned up after each ? Sounds like it could be leaking there
@RulioHT2021 commented on GitHub (Oct 11, 2023):
I'll need to test other routines, I'll get back to you as soon as possible.
Thanks.
@RulioHT2021 commented on GitHub (Oct 19, 2023):
16:39:29.378 -> ESP.getFreeHeap(): 207916
16:39:29.378 -> *wm:AutoConnect
16:39:29.378 -> *wm:Connecting to SAVED AP: Teste
16:39:29.892 -> *wm:connectTimeout not set, ESP waitForConnectResult...
16:39:34.269 -> *wm:AutoConnect: FAILED for 4902 ms
16:39:34.269 -> *wm:StartAP with SSID: AFL_0212848844
16:39:34.784 -> *wm:AP IP address: 192.168.4.1
16:39:34.784 -> Entrando em modo de configuração
16:39:34.784 -> Nome da rede WIFI, SSID: AFL_0212848844
16:39:34.784 -> Endereço de IP: 192.168.4.1
16:39:34.784 -> *wm:Starting Web Portal
16:39:35.297 -> *wm:config portal has timed out
16:39:35.297 -> *wm:[ERROR] disconnect configportal - softAPdisconnect FAILED
16:39:36.278 -> *wm:config portal exiting
16:39:36.278 -> ESP.getFreeHeap(): 206900
16:42:33.080 -> ESP.getFreeHeap(): 206852
16:42:33.080 -> *wm:AutoConnect
16:42:33.080 -> *wm:Connecting to SAVED AP: Teste
16:42:33.590 -> *wm:connectTimeout not set, ESP waitForConnectResult...
16:42:38.012 -> *wm:AutoConnect: FAILED for 4902 ms
16:42:38.012 -> *wm:StartAP with SSID: AFL_0212848844
16:42:38.475 -> *wm:AP IP address: 192.168.4.1
16:42:38.475 -> Entrando em modo de configuração
16:42:38.521 -> Nome da rede WIFI, SSID: AFL_0212848844
16:42:38.521 -> Endereço de IP: 192.168.4.1
16:42:38.521 -> *wm:Starting Web Portal
16:42:38.988 -> *wm:config portal has timed out
16:42:38.988 -> *wm:[ERROR] disconnect configportal - softAPdisconnect FAILED
16:42:40.015 -> *wm:config portal exiting
16:42:40.015 -> ESP.getFreeHeap(): 205848
@RulioHT2021 commented on GitHub (Oct 19, 2023):
I created a task to reconnect and as you can see, each call consumes a little memory after wm.autoConnect(ssid, password);
The scenario I'm testing is:
in case there is a power outage and the router does not come back on.
Sooner or later it will restart due to lack of memory.
The problem is that I'm running a routine that cannot be restarted.
@tablatronix commented on GitHub (Oct 19, 2023):
Just set WM debug level to WM_DEBUG_MAX it will dump heap stats
@tablatronix commented on GitHub (Oct 20, 2023):
Looks like leaking 1440 bytes, hmm I was not seeing this the other day.
@tablatronix commented on GitHub (Oct 20, 2023):
I cant find it yet, but my memory jumps up and down but stays <100% so something is cleaning up, but maybe not under certain conditions. I will have to run memory deugging and find what on the heap. I thought It was the known DNSD issue but that might only be a tiny bit.
Do you have many AP found during scans?
Are you using hostname or mdns?
If you change the configportaltimeout to like 20 seconds does anything change memory wise?
I might also want to copy your config, what partition config are you using, and what esp32 and rev ?
I am testing on an S3 with default partitions
@RulioHT2021 commented on GitHub (Oct 20, 2023):
partitions: LITTLEFS
If you change the configportaltimeout to like 20 seconds does anything change memory wise?
yes, Do not change
Are you using hostname or mdns?
no
@RulioHT2021 commented on GitHub (Oct 20, 2023):
I changed the code this way and solved the consumption problem.
12:38:56.216 -> ESP.getFreeHeap(): 207768
12:38:56.216 -> E (67820332) wifi:sta is connecting, return error
12:38:56.216 -> ESP.getFreeHeap(): 207476
12:39:56.854 -> ESP.getFreeHeap(): 207768
12:39:56.854 -> E (67880968) wifi:sta is connecting, return error
12:39:56.854 -> ESP.getFreeHeap(): 207476
12:40:57.179 -> ESP.getFreeHeap(): 207768
12:40:57.179 -> E (67941314) wifi:sta is connecting, return error
12:40:57.179 -> ESP.getFreeHeap(): 207476
@tablatronix commented on GitHub (Oct 20, 2023):
Yeah I am not really sure what the issue is.. I will keep testing
My memory does this if i autoconnect loop
