CORRUPT HEAP in WiFi mode WIFI_MODE_APSTA
Posted: Thu Nov 24, 2022 2:51 pm
I'm posting this problem in a new post, even I think it could be related to the problem I posted some weeks ago: viewtopic.php?f=13&t=30038
Configuration:
* ESP-IDF v5.0-rc1
* ESP32-C3
* Heap debugging is activated in comprehensive mode.
* WiFi is in mode WIFI_MODE_APSTA
* Scan is running in background (esp_wifi_scan_start).
Now an external device tries to connect to ESP32-C3 (AP mode).
This error occurs many times but not every time.
I'm wondering why after connecting (event = WIFI_EVENT_AP_STACONNECTED) the event WIFI_EVENT_AP_STADISCONNECTED occurs twice.
The first time, WIFI_EVENT_AP_STACONNECTED occurs, heap_caps_check_integrity_all returns 1 = no error.
The second time, WIFI_EVENT_AP_STACONNECTED occurs, heap_caps_check_integrity_all returns 0 = error.
Between heap_caps_check_integrity_all = 1 and heap_caps_check_integrity_all = 0 no custom code is executed. So I guess the bug can't be within custom code. Am I right?
Sometimes the error occurs if connection has succeeded, after scan has finished.
It looks like scanning while ESP32-C3 is connected in AP mode, doesn't work properly in this case.
Connecting in STA mode works without any problems (AP disconnected).
If heap debugging is in no poisoning mode, no error occurs.
Configuration:
* ESP-IDF v5.0-rc1
* ESP32-C3
* Heap debugging is activated in comprehensive mode.
* WiFi is in mode WIFI_MODE_APSTA
* Scan is running in background (esp_wifi_scan_start).
Now an external device tries to connect to ESP32-C3 (AP mode).
- !!!!!! wifi_event_handler: event_base = 87, event_id = WIFI_EVENT_AP_START !!!!!!
- !!!!!! heap_caps_check_integrity_all = 1 !!!!!!
- I (763) wifi:Set ps type: 1
- I (763) wifi:Set ps type: 0
- I (763) dns_server: Socket created
- I (773) dns_server: Socket bound, port 53
- I (773) dns_server: Waiting for data
- I (3403) wifi:new:<2,1>, old:<2,1>, ap:<2,1>, sta:<0,0>, prof:2
- I (3403) wifi:station: xx:xx:xx:xx:xx:xx join, AID=1, bgn, 40U
- !!!!!! wifi_event_handler: event_base = 87, event_id = WIFI_EVENT_AP_STACONNECTED !!!!!!
- !!!!!! heap_caps_check_integrity_all = 1 !!!!!!
- I (3553) esp_netif_lwip: DHCP server assigned IP to a client, IP is: 192.168.4.2
- I (5573) esp_netif_lwip: DHCP server assigned IP to a client, IP is: 192.168.4.2
- I (12033) esp_netif_lwip: DHCP server assigned IP to a client, IP is: 192.168.4.2
- !!!!!! wifi_event_handler: event_base = 87, event_id = WIFI_EVENT_AP_STADISCONNECTED !!!!!!
- !!!!!! heap_caps_check_integrity_all = 1 !!!!!!
- W (39333) wifi:Haven't to connect to a suitable AP now!
- I (39333) wifi:new:<2,1>, old:<2,1>, ap:<2,1>, sta:<0,0>, prof:2
- I (39533) wifi:Send SA Query req with transaction id 5e01
- I (39743) wifi:Send SA Query req with transaction id f227
- I (39943) wifi:Send SA Query req with transaction id a77a
- I (40153) wifi:Send SA Query req with transaction id aaf8
- I (40353) wifi:Send SA Query req with transaction id d7b4
- I (40563) wifi:STA not responded to 5 SA Query attempts, Reset connection sending disassoc
- I (40563) wifi:station: xx:xx:xx:xx:xx:xx leave, AID = 1, bss_flags is 658547, bss:0x3fcb1998
- I (40563) wifi:new:<2,0>, old:<2,1>, ap:<2,1>, sta:<0,0>, prof:2
- !!!!!! wifi_event_handler: event_base = 87, event_id = WIFI_EVENT_AP_STADISCONNECTED !!!!!!
- CORRUPT HEAP: Invalid data at 0x3fcb1c98. Expected 0xfefefefe got 0x00000000
- !!!!!! heap_caps_check_integrity_all = 0 !!!!!!
- W (40593) wifi:Haven't to connect to a suitable AP now!
- I (40903) wifi:new:<2,1>, old:<2,0>, ap:<2,1>, sta:<0,0>, prof:2
- I (40903) wifi:station: xx:xx:xx:xx:xx:xx join, AID=1, bgn, 40U
- CORRUPT HEAP: Invalid data at 0x3fcb1c98. Expected 0xfefefefe got 0x00000000
- assert failed: multi_heap_malloc multi_heap_poisoning.c:256 (ret)
- Stack dump detected
- MEPC : 0x40380922 RA : 0x40388254 SP : 0x3fca42d0 GP : 0x3fc91a00
- 0x40380922: panic_abort at /home/marc/esp/esp-idf_v5.0-rc1/components/esp_system/panic.c:412
- 0x40388254: __ubsan_include at /home/marc/esp/esp-idf_v5.0-rc1/components/esp_system/ubsan.c:313
This error occurs many times but not every time.
I'm wondering why after connecting (event = WIFI_EVENT_AP_STACONNECTED) the event WIFI_EVENT_AP_STADISCONNECTED occurs twice.
The first time, WIFI_EVENT_AP_STACONNECTED occurs, heap_caps_check_integrity_all returns 1 = no error.
The second time, WIFI_EVENT_AP_STACONNECTED occurs, heap_caps_check_integrity_all returns 0 = error.
Between heap_caps_check_integrity_all = 1 and heap_caps_check_integrity_all = 0 no custom code is executed. So I guess the bug can't be within custom code. Am I right?
Sometimes the error occurs if connection has succeeded, after scan has finished.
It looks like scanning while ESP32-C3 is connected in AP mode, doesn't work properly in this case.
Connecting in STA mode works without any problems (AP disconnected).
If heap debugging is in no poisoning mode, no error occurs.