esp32-wifi-manager icon indicating copy to clipboard operation
esp32-wifi-manager copied to clipboard

wifi_manager_destroy() causes ESP32 to crash

Open rgleim opened this issue 2 years ago • 0 comments

Prerequisites

  • [x] I have written a descriptive issue title
  • [x] I have verified that I am using the latest version of esp32-wifi-manager
  • [x] I have searched open and closed issues to ensure it has not already been reported

Description

When calling wifi_manager_destroy(), the ESP32 crashes with: Guru Meditation Error: Core 1 panic'ed (LoadProhibited). Exception was unhandled.

Steps to Reproduce

Used Demo program and modified the monitor task to call destroy after wifi is established

void monitoring_task(void *pvParameter)
{
    for (;;)
    {
        ESP_LOGI(TAG, "free heap: %d", esp_get_free_heap_size());
        vTaskDelay(pdMS_TO_TICKS(10000));

        if (isWifiVerified)
        {
            if (wifi_manager_fetch_wifi_sta_config())
            {
                wifi_config_t *wifiConfig = wifi_manager_get_wifi_sta_config();

                printf("ssid:%s password:%s\r\n", wifiConfig->sta.ssid, wifiConfig->sta.password);

                // delay after connection to allow the wifi_manager to send info back to phone
                vTaskDelay(pdMS_TO_TICKS(5000));

                // kill and cleanup the wifi manager.  Not needed anymore.
                wifi_manager_destroy();
            }
        }
    }
}

void cb_connection_ok(void *pvParameter)
{
	ip_event_got_ip_t* param = (ip_event_got_ip_t*)pvParameter;

	/* transform IP to human readable string */
	char str_ip[16];
	esp_ip4addr_ntoa(&param->ip_info.ip, str_ip, IP4ADDR_STRLEN_MAX);

	ESP_LOGI(TAG, "I have a connection and my IP is %s!", str_ip);

    //set boolean to tell task we are connected
    isWifiVerified = true;
}

System Configuration

ESP32 with demo code provided by esp32-wifi-manager

  • Environment (Operating system, version and so on):
  • Additional information:
  • Full Error output when crash happens:
I (45717) main: free heap: 148764
Guru Meditation Error: Core  1 panic'ed (LoadProhibited). Exception was unhandled.

Core  1 register dump:
PC      : 0x4000c688  PS      : 0x00060230  A0      : 0x800d89e4  A1      : 0x3ffda1d0  
A2      : 0x3ffd8ff8  A3      : 0x00000000  A4      : 0x3ffd86a2  A5      : 0x0000000a  
A6      : 0x3ffd869c  A7      : 0x00000007  A8      : 0x00000000  A9      : 0x00000000
A10     : 0x00000000  A11     : 0x3ffd86ab  A12     : 0x000000ff  A13     : 0x0000ff00
A14     : 0x00ff0000  A15     : 0xff000000  SAR     : 0x0000001d  EXCCAUSE: 0x0000001c  
EXCVADDR: 0x00000000  LBEG    : 0x400014fd  LEND    : 0x4000150d  LCOUNT  : 0xfffffffd

Backtrace:0x4000c685:0x3ffda1d0 0x400d89e1:0x3ffda1f0 0x400f2a75:0x3ffda210 0x400f1c79:0x3ffda250 0x400f1d14:0x3ffda2e0 0x400f2124:0x3ffda300 0x400f105e:0x3ffda320 0x400f10df:0x3ffda360 0x4008bff1:0x3ffda380
0x400d89e1: http_server_get_handler at C:\Git\Square1\MyPatchSB\mypatch-rtos_dev\esp32\build/../components/esp32-wifi-manager/src/http_app.c:233 (discriminator 1)

0x400f2a75: httpd_uri at C:/esp/esp4.3/esp-idf/components/esp_http_server/src/httpd_uri.c:339

0x400f1c79: httpd_parse_req at C:/esp/esp4.3/esp-idf/components/esp_http_server/src/httpd_parse.c:667 (discriminator 15)

0x400f1d14: httpd_req_new at C:/esp/esp4.3/esp-idf/components/esp_http_server/src/httpd_parse.c:789

0x400f2124: httpd_sess_process at C:/esp/esp4.3/esp-idf/components/esp_http_server/src/httpd_sess.c:304 (discriminator 15)

0x400f105e: httpd_server at C:/esp/esp4.3/esp-idf/components/esp_http_server/src/httpd_main.c:217 (discriminator 15)

0x400f10df: httpd_thread at C:/esp/esp4.3/esp-idf/components/esp_http_server/src/httpd_main.c:247 (discriminator 15)

0x4008bff1: vPortTaskWrapper at C:/esp/esp4.3/esp-idf/components/freertos/port/xtensa/port.c:168

rgleim avatar Sep 24 '21 03:09 rgleim