tonyp7 / esp32-wifi-manager

Captive Portal for ESP32 that can connect to a saved wireless network or start an access point where you can connect to existing wifis.
MIT License
683 stars 222 forks source link

xEventGroupSetBits- assert failed! #76

Open DheeranYuvaraj opened 4 years ago

DheeranYuvaraj commented 4 years ago

Hi @tonyp7

My requirement is to quit wifimanager after some time. To achieve this i am calling wifi_manager_destroy(); . But this is not working. After destroying wifi_manager also ESP32 in AP mode. Please help me to solve this issue.

My Main Code: void app_main() { wifi_manager_start(); wifi_manager_set_callback(EVENT_STA_GOT_IP, &cb_connection_ok); vTaskDelay(20000/portTICK_PERIOD_MS); wifi_manager_destroy(); xTaskCreatePinnedToCore(&monitoring_task, "monitoring_task", 2048, NULL, 1, NULL, 1); }

Debug Log: [1B][0;32mI (1479) wifi_manager: SYSTEM_EVENT_AP_START[1B][0m [1B][0;32mI (20209) main: free heap: 227980[1B][0m [1B][0;32mI (30209) main: free heap: 227980[1B][0m [1B][0;32mI (40209) main: free heap: 227972[1B][0m [1B][0;32mI (50209) main: free heap: 227972[1B][0m [1B][0;32mI (60209) main: free heap: 227972[1B][0m [1B][0;32mI (70209) main: free heap: 227972[1B][0m [1B][0;32mI (80209) main: free heap: 227972[1B][0m [1B][0;32mI (90209) main: free heap: 227972[1B][0m [1B][0;32mI (100209) main: free heap: 227972[1B][0m [1B][0;32mI (110209) main: free heap: 227972[1B][0m [1B][0;32mI (120209) main: free heap: 227972[1B][0m [1B][0;32mI (130209) main: free heap: 226584[1B][0m [1B][0;32mI (140209) main: free heap: 226584[1B][0m [1B][0;32mI (150209) main: free heap: 227972[1B][0m [1B][0;32mI (155289) wifi_manager: SYSTEM_EVENT_AP_STACONNECTED[1B][0m C:/esp32/esp-idf-v3.3/components/freertos/event_groups.c:560 (xEventGroupSetBits)- assert failed! abort() was called at PC 0x4008e0c4 on core 0

tonyp7 commented 4 years ago

wifi_manager_destroy(); is today not really where it should be. It just frees memory but doesn't shutdown the wifi manager properly.

Basically you are de-allocating memory and of course the program crashes when it tries to access some objects which no longer exists.

I mark this as a bug since wifi_manager_destroy(); should indeed properly shutdown everything related to the manager.