esp32_https_server icon indicating copy to clipboard operation
esp32_https_server copied to clipboard

LoadProhibited exception in SSL_pending when delivery page from SPIFFS

Open dmarc1234 opened this issue 2 years ago • 1 comments

I have an issue where delivering pages results in a LoadProhibited exception on a pretty constant basis, the decoded exception results are as follows:

Decoding stack results 0x40193c9d: SSL_pending at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/openssl/library/ssl_lib.c line 574 0x400d9459: httpsserver::HTTPSConnection::pendingByteCount() at C:/Users/DavidMain/.arduinocdt/libraries/ESP32_HTTPS_Server/1.0.0/src/HTTPSConnection.cpp line 116 0x400d6d27: httpsserver::HTTPConnection::pendingBufferSize() at C:/Users/DavidMain/.arduinocdt/libraries/ESP32_HTTPS_Server/1.0.0/src/HTTPConnection.cpp line 258 0x401917d6: httpsserver::HTTPRequest::requestComplete() at C:/Users/DavidMain/.arduinocdt/libraries/ESP32_HTTPS_Server/1.0.0/src/HTTPRequest.cpp line 109 0x400d7e4d: httpsserver::HTTPConnection::loop() at C:/Users/DavidMain/.arduinocdt/libraries/ESP32_HTTPS_Server/1.0.0/src/HTTPConnection.cpp line 515 0x400d96be: httpsserver::HTTPServer::loop() at C:/Users/DavidMain/.arduinocdt/libraries/ESP32_HTTPS_Server/1.0.0/src/HTTPServer.cpp line 122 0x400d25e3: ethernet_task() at ../../src/ethernet_handler.cpp line 268 0x400d1f29: ethernet_thread(void*) at ../../main.cpp line 407 0x40089af1: vPortTaskWrapper at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/port.c line 143

This happens when delivering synchronously or asynchronously (using a task wrapper).

The pages are 5~15K in length and also call css and js functions so it could be that buffer is not long enough somewhere.

Any ideas ?

dmarc1234 avatar Nov 16 '22 18:11 dmarc1234

I have managed to overcome the above issue by reducing the size of the buffer used to write to the HTTPS response through res->write().

However, there is still something not working correctly as I am not getting all the web page files being delivered to the browser, Chrome or Firefox:

image

If I re-order the CSS file loading in the HTML webpage the later ones are the ones not delivered so it looks like the library is able to deliver a certain amount of data before falling over. I am still getting a lot of:

[HTTPS:I] New connection. Socket FID=63
[HTTPS:E] SSL_accept failed. Aborting handshake. FID=63
[HTTPS:I] Connection closed. Socket FID=63

Errors but these don't seem to be related to the files not being delivered but to the ones that are ie. re-tries.

Has anyone managed to deliver complex HTML pages though this library and if so then how.

dmarc1234 avatar Mar 21 '23 11:03 dmarc1234