httpd_sock_err: error in send : 11

alitergee
Posts: 14
Joined: Wed Aug 17, 2022 1:31 pm

httpd_sock_err: error in send : 11

Postby alitergee » Tue Jul 18, 2023 10:36 am

I have created an HTTP server on ESP32 that serves a webpage (html, css, js, svg files) as well as handles requests coming from the webpage.
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
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
ESP stops the HTTP server and needs a restart to make it function again.

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);
Following are serial logs :
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
HTTP server has total 26 request handlers.
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.

MicroController
Posts: 1696
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: httpd_sock_err: error in send : 11

Postby MicroController » Tue Jul 18, 2023 6:50 pm

it is destroyed when the access point is disconnected.

Code: Select all

I (15998) WIFI_APP: SYSTEM_EVENT_AP_STADISCONNECTED
W (36778) httpd_txrx: httpd_sock_err: error in send : 11
Does that mean the error only happens after the server is "destroyed"?

alitergee
Posts: 14
Joined: Wed Aug 17, 2022 1:31 pm

Re: httpd_sock_err: error in send : 11

Postby alitergee » Wed Jul 19, 2023 6:47 am

Hi.

No. Most of the time the error occurs when the server is started (not destroyed).

Please go thru the serial logs from the past
D (408689) httpd_txrx: httpd_recv_with_opt: requested length = 128
D (408699) httpd_txrx: httpd_recv_with_opt: received length = 128
D (408709) httpd_parse: read_block: received HTTP request block size = 128
D (408709) httpd_parse: cb_header_value: processing value = 64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36
D (408719) httpd_parse: cb_header_field: processing field = Accept
D (408729) httpd_parse: cb_header_value: processing value = image/avif,image/webp,image/apng,image/svg+xm
D (408739) httpd_parse: parse_block: parsed block size = 218
D (408749) httpd_txrx: httpd_recv_with_opt: requested length = 128
D (408749) httpd_txrx: httpd_recv_with_opt: received length = 127
D (408759) httpd_parse: read_block: received HTTP request block size = 127
D (408769) httpd_parse: cb_header_value: processing value = l,image/*,*/*;q=0.8
D (408769) httpd_parse: cb_header_field: processing field = Referer
D (408779) httpd_parse: cb_header_value: processing value = http://10.0.0.1/
D (408789) httpd_parse: cb_header_field: processing field = Accept-Encoding
D (408789) httpd_parse: cb_header_value: processing value = gzip, deflate
D (408799) httpd_parse: cb_header_field: processing field = Accept-Language
D (408809) httpd_parse: cb_header_value: processing value = en-GB,en-US;q=0.9,en;q=0.8
D (408819) httpd_parse: cb_headers_complete: bytes read = 385
D (408819) httpd_parse: cb_headers_complete: content length = 0
D (408829) httpd_parse: pause_parsing: paused
D (408829) httpd_parse: cb_no_body: message complete
D (408839) httpd_parse: httpd_parse_req: parsing complete
D (408839) httpd_uri: httpd_uri: request for /images/ethernetsvg.svg with type 1
D (408849) httpd_uri: httpd_find_uri_handler: [0] = /jquery-3.6.0.min.js
D (408859) httpd_uri: httpd_find_uri_handler: [1] = /
D (408859) httpd_uri: httpd_find_uri_handler: [2] = /app.css
D (408869) httpd_uri: httpd_find_uri_handler: [3] = /index.js
D (408869) httpd_uri: httpd_find_uri_handler: [4] = /favicon.ico
D (408879) httpd_uri: httpd_find_uri_handler: [5] = /logo.png
D (408889) httpd_uri: httpd_find_uri_handler: [6] = /images/ethernetsvg.svg
I (408889) HTTP_SERVER: ethernet svg requested
D (408899) httpd_txrx: httpd_send_all: sent = 67
W (414089) httpd_txrx: httpd_sock_err: error in send : 11
D (414089) httpd_txrx: httpd_send_all: error in send_fn
D (414089) httpd_sess: httpd_sess_process: httpd_req_delete
D (414089) httpd_sess: httpd_sess_process: success
D (414099) httpd: httpd_server: processing listen socket 48
D (414099) httpd: httpd_accept_conn: newfd = 56
D (414109) httpd_sess: httpd_sess_new: fd = 56
D (414109) httpd_sess: httpd_sess_new: active sockets: 6
D (414119) httpd: httpd_accept_conn: complete
D (414119) httpd: httpd_server: doing select maxfd+1 = 57
D (414129) httpd: httpd_process_session: processing socket 56
D (414129) httpd_sess: httpd_sess_process: httpd_req_new
D (414139) httpd_txrx: httpd_recv_with_opt: requested length = 128
D (414139) httpd_txrx: httpd_recv_with_opt: received length = 128
D (414149) httpd_parse: read_block: received HTTP request block size = 128
D (414159) httpd_parse: cb_url: message begin
D (414159) httpd_parse: cb_url: processing url = /images/signalsvg.svg

Who is online

Users browsing this forum: No registered users and 102 guests