Re: getting "assert failed" on socket() call
Posted: Mon Aug 19, 2019 7:35 pm
Ah. Thank you. That is currently not enabled for my project, so I guess that wasn't it. Still good to know about that issue, though.
ESP32 Official Forum
https://esp32.com/
Code: Select all
sys_prot_t
sys_arch_protect(void)
{
sys_mutex_lock(&g_lwip_protect_mutex);
return (sys_prot_t) 1;
}
Also, I'm calling the http startup very early in my program:C:/esp-idf/components/freertos/queue.c:1442 (xQueueGenericReceive)- assert failed!
Guru Meditation Error: Core 0 panic'ed (LoadProhibited). Exception was unhandled.
Core 0 register dump:
Code: Select all
extern "C" void app_main()
{
HttpServer httpServer;
httpd_handle_t httpHandle;
ESP_LOGI(TAG, "entering app_main()");
// start the web server.
ESP_LOGI(TAG, "starting webserver.");
httpHandle = httpServer.start_webserver();
...
So, as far as I can see, the problem is that sys_mutex_lock() is being called before sys_mutex_new(). The argument to sys_mutex_lock() is therefore NULL, and general hilarity ensues.I (357) HTTP_SERVER: calling httpd_start().
I (367) httpd: entering httpd_start().
I (367) httpd: calling httpd_create().
I (377) httpd: calling httpd_server_init().
I (377) httpd: calling socket().
I (377) LWIP: entering lwip_socket().
I (387) LWIP: lwip_socket(): calling netconn_new_with_callback().
I (397) api_lib: netconn_new_with_proto_and_callback(): calling netconn_alloc().
I (397) netconn_alloc: calling memp_malloc().
I (407) memp_malloc: starting.
I (407) memp_malloc: calling do_memp_malloc_pool().
I (417) do_memp_malloc_pool: calling mem_malloc().
I (417) do_memp_malloc_pool: call to mem_malloc() returned 3ffb9724.
I (427) do_memp_malloc_pool: calling SYS_ARCH_PROTECT().
I (437) sys_arch: sys_arch_protect(): calling sys_mutex_lock with 0.