HTTP server is started when a device connects to ESP's access point and it is destroyed when the access point is disconnected.
Sometimes during operation on the webpage httpd socket error occurs as shown below
ESP stops the HTTP server and needs a restart to make it function again.W (102778) httpd_txrx: httpd_sock_err: error in send : 11
W (113778) httpd_txrx: httpd_sock_err: error in send : 11
W (124778) httpd_txrx: httpd_sock_err: error in send : 11
W (135778) httpd_txrx: httpd_sock_err: error in send : 11
W (146778) httpd_txrx: httpd_sock_err: error in send : 11
Following is my HTTP server cofiguration :
Code: Select all
ESP_LOGI(TAG, "Configuring HTTP Server");
httpd_config_t config = HTTPD_DEFAULT_CONFIG();
if (http_server_monitor_queue_handle == NULL)
{
// Create the message queue
http_server_monitor_queue_handle = xQueueCreate(5, sizeof(http_server_queue_message_t));
}
// Create HTTP server monitor task
if (task_http_server_monitor == NULL)
{
xTaskCreate(&http_server_monitor, "http_server_monitor", HTTP_SERVER_MONITOR_STACK_SIZE, NULL, HTTP_SERVER_MONITOR_PRIORITY, &task_http_server_monitor);
}
// The core that the HTTP server will run on
config.core_id = 0; //0
// Adjust the default priority to 1 less than the wifi application task
config.task_priority = 4;
// Bump up the stack size (default is 4096)
config.stack_size = 20480;
// Increase uri handlers
config.max_uri_handlers = 30;
// Increase the timeout limits //seconds
config.recv_wait_timeout = 10;
config.send_wait_timeout = 10;
config.lru_purge_enable = true;
esp_err_t err1 = httpd_start(&server, &config);
HTTP server has total 26 request handlers.I (9138) wifi:'new':<1,1>, old:<1,1>, ap:<1,1>, sta:<255,255>, prof:1
I (9138) wifi:'station': ac:12:03:10:8a:f1 join, AID=1, bgn, 40U
I (10168) WIFI_APP: SYSTEM_EVENT_AP_STACONNECTED
E (10168) WIFI_APP: [ before stop all tasks (Heap_Memory) : 94348 ]
E (10168) MQTT:
xx -- STOPPING MQTT -- xx
E (10168) MQTT: Deleted MQTT Publish task
I (10248) esp_netif_lwip: DHCP server assigned IP to a station, IP is: 10.0.0.2
E (10258) MQTT:
MQTT CLIENT STOPPED ESP_OK
W (10258) MQTT_CLIENT: Client asked to stop, but was not started
I (10268) MQTT: MQTT Client Destroyed succesfully
E (10268) HTTP_SERVER: free Heap http server stop : 104032
W (10278) IO: [ uninstalling ISR Service ]
E (10278) HTTP_DATA_POST: free Heap : 106208
I (10288) SPIFFS: Deleting Spiffs Task
E (10288) HTTP_CLIENT: free Heap stop frontend post task : 114628
E (10298) WIFI_APP: [ stop all tasks (Heap_Memory) : 114628 ]
I (10298) HTTP_SERVER: Configuring HTTP Server
I (10308) HTTP_SERVER: http_server_configure: Starting server on port: '80' with task priority: '4'
I (10318) HTTP_SERVER: HTTP SERVER STARTED
I (10328) HTTP_SERVER: free heap after URI setting: 96740
W (10328) WIFI_APP: Free Heap after HTTP server init :96740
I (10398) wifi:<ba-add>idx:2 (ifx:1, ac:12:03:10:8a:f1), tid:0, ssn:22, winSize:64
E (10418) HTTP_SERVER: free Heap : 94776
I (10428) HTTP_SERVER: index.html requested
I (10428) HTTP_SERVER: Webpage Reload Count: 1
E (10468) HTTP_SERVER: free Heap : 91320
E (10478) HTTP_SERVER: free Heap : 93884
I (10478) HTTP_SERVER: app.css requested
E (10518) HTTP_SERVER: free Heap : 91100
E (10538) HTTP_SERVER: free Heap : 94664
I (10538) HTTP_SERVER: Jquery requested
E (15148) HTTP_SERVER: free Heap : 87884
E (15148) HTTP_SERVER: free Heap : 89612
I (15148) HTTP_SERVER: poweroff svg requested
E (15158) HTTP_SERVER: free Heap : 86392
E (15158) HTTP_SERVER: free Heap : 88120
I (15158) HTTP_SERVER: index.js requested
E (15228) HTTP_SERVER: free Heap : 88000
I (15658) HTTP_SERVER: Sock err occured1 0
I (15668) HTTP_SERVER: [ JSON : {"status":1,"data":{}} ]
I (15738) HTTP_SERVER: Sock err occured2 0
E (15758) HTTP_SERVER: free Heap : 90840
I (15758) HTTP_SERVER: favicon.ico requested
I (15988) wifi:'station': ac:12:03:10:8a:f1 leave, AID = 1, bss_flags is 658531, bss:0x3ffe1104
I (15988) wifi:'new':<1,0>, old:<1,1>, ap:<1,1>, sta:<255,255>, prof:1
I (15998) wifi:<ba-del>idx
I (15998) WIFI_APP: SYSTEM_EVENT_AP_STADISCONNECTED
W (36778) httpd_txrx: httpd_sock_err: error in send : 11
W (47778) httpd_txrx: httpd_sock_err: error in send : 11
W (58778) httpd_txrx: httpd_sock_err: error in send : 11
W (69778) httpd_txrx: httpd_sock_err: error in send : 11
W (80778) httpd_txrx: httpd_sock_err: error in send : 11
W (91778) httpd_txrx: httpd_sock_err: error in send : 11
W (102778) httpd_txrx: httpd_sock_err: error in send : 11
W (113778) httpd_txrx: httpd_sock_err: error in send : 11
W (124778) httpd_txrx: httpd_sock_err: error in send : 11
W (135778) httpd_txrx: httpd_sock_err: error in send : 11
W (146778) httpd_txrx: httpd_sock_err: error in send : 11
W (157778) httpd_txrx: httpd_sock_err: error in send : 11
W (168778) httpd_txrx: httpd_sock_err: error in send : 11
W (179778) httpd_txrx: httpd_sock_err: error in send : 11
W (190778) httpd_txrx: httpd_sock_err: error in send : 11
W (201778) httpd_txrx: httpd_sock_err: error in send : 11
W (212778) httpd_txrx: httpd_sock_err: error in send : 11
W (223778) httpd_txrx: httpd_sock_err: error in send : 11
W (234778) httpd_txrx: httpd_sock_err: error in send : 11
W (245778) httpd_txrx: httpd_sock_err: error in send : 11
W (256778) httpd_txrx: httpd_sock_err: error in send : 11
W (267778) httpd_txrx: httpd_sock_err: error in send : 11
W (278778) httpd_txrx: httpd_sock_err: error in send : 11
W (289778) httpd_txrx: httpd_sock_err: error in send : 11
W (300778) httpd_txrx: httpd_sock_err: error in send : 11
W (311778) httpd_txrx: httpd_sock_err: error in send : 11
W (322778) httpd_txrx: httpd_sock_err: error in send : 11
W (333778) httpd_txrx: httpd_sock_err: error in send : 11
W (344778) httpd_txrx: httpd_sock_err: error in send : 11
Only 2 more tasks are running alongside HTTP server.
What is the root cause of this error and how to solve it?
Any advice would be appreciated.
Thank you.