espressif / arduino-esp32

Arduino core for the ESP32
GNU Lesser General Public License v2.1
13k stars 7.29k forks source link

Captive portal connection crash #7234

Open zekageri opened 1 year ago

zekageri commented 1 year ago

Board

esp-wrover-kit

Device Description

Devkit

Hardware Configuration

Ethernet ( which is not used in this case ), i2c, SPI display, etc..

Version

latest master (checkout manually)

IDE Name

Platform IO

Operating System

Windows 10

Flash frequency

80Mhz

PSRAM enabled

yes

Upload speed

115200

Description

ESP32 crashes on captive portal connection. Restarts two or three times and it's ok after that...

Sketch

class CaptiveRequestHandler : public AsyncWebHandler {
    public:
        CaptiveRequestHandler() {
            captiveSerer.serveStatic("/", LittleFS, ASSETS_PATH).setCacheControl(MAX_CACHE_CONTROL_TIME);

            captiveSerer.on("/welcome.bundle.css", HTTP_GET, [this](AsyncWebServerRequest *request) {
                // Handle request...
            });

            captiveSerer.on("/welcome.bundle.js", HTTP_GET, [this](AsyncWebServerRequest *request) {
                // Handle request...
            });

            captiveSerer.on("/summaryEnd", HTTP_POST, [this](AsyncWebServerRequest *request) {
                // Handle request...
            });

            /* NOT FOUND HANDLERS */
            captiveSerer.on("/notFound.css", HTTP_GET, [this](AsyncWebServerRequest *request) {
                // Handle request...
            });

            captiveSerer.on("/notFound.js", HTTP_GET, [this](AsyncWebServerRequest *request) {
                // Handle request...
            });

            captiveSerer.onNotFound([this](AsyncWebServerRequest *request) {
                // Handle request...
            });
        }

        virtual ~CaptiveRequestHandler() {}

        bool canHandle(AsyncWebServerRequest *request){
            return true;
        }

        void handleRequest(AsyncWebServerRequest *request) {
            String path = fileSys.correctPath(WELCOME_PAGE_PATH);
            AsyncWebServerResponse *response = request->beginResponse(LittleFS, path, "text/html");
            response->addHeader("Server", "HsH Setup");
            if( path.indexOf("zipped") > 0 ){
                response->addHeader("Content-Encoding", "gzip");
            }
            request->send(response);
        }
};

void bootHandler::initAP(){
    WiFi.softAPConfig(apIP, apIP, netMsk);
    WiFi.softAP(firstBootAP_NAME);
    dnsServer.start(53, "*", WiFi.softAPIP());
    IPAddress myIP = WiFi.softAPIP();
    Serial.print("AP IP address: ");
    Serial.println(myIP);
}

void bootHandler::initServer(){
    captiveSerer.addHandler(new CaptiveRequestHandler()).setFilter(ON_AP_FILTER);
    captiveSerer.begin();
}

void bootHandler::setup(){
    Serial.println("First boot handling started...");
    initAP();
    initServer();
}

void bootHandler::loop(){
    dnsServer.processNextRequest();
}

Debug Message

assert failed: tcp_update_rcv_ann_wnd IDF/components/lwip/lwip/src/core/tcp.c:951 (new_rcv_ann_wnd <= 0xffff)

Backtrace:0x40083cbd:0x3ffb37600x4008ece5:0x3ffb3780 0x400944d9:0x3ffb37a0 0x40130a72:0x3ffb38d0 0x40130b20:0x3ffb38f0 0x4019cc4a:0x3ffb3910 0x4012d3ac:0x3ffb3930

  #0  0x40083cbd:0x3ffb3760 in panic_abort at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp_system/panic.c:402
  #1  0x4008ece5:0x3ffb3780 in esp_system_abort at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp_system/esp_system.c:128
  #2  0x400944d9:0x3ffb37a0 in __assert_func at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/newlib/assert.c:85
  #3  0x40130a72:0x3ffb38d0 in tcp_update_rcv_ann_wnd at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/lwip/lwip/src/core/tcp.c:951
      (inlined by) tcp_update_rcv_ann_wnd at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/lwip/lwip/src/core/tcp.c:931
  #4  0x40130b20:0x3ffb38f0 in tcp_recved at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/lwip/lwip/src/core/tcp.c:991
  #5  0x4019cc4a:0x3ffb3910 in _tcp_recved_api(tcpip_api_call_data*) at lib/AsyncTCP/src/AsyncTCP.cpp:423
  #6  0x4012d3ac:0x3ffb3930 in tcpip_thread_handle_msg at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/lwip/lwip/src/api/tcpip.c:172
      (inlined by) tcpip_thread at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/lwip/lwip/src/api/tcpip.c:154

ELF file SHA256: 0000000000000000

Rebooting...

Other Steps to Reproduce

Crashes on both android and ios.

I have checked existing issues, online documentation and the Troubleshooting Guide

gregorykolasis commented 1 year ago

Board esp-wrover-kit

Device Description Devkit

Version 2.0.0

Operating System Windows 11

Flash frequency 80Mhz

PSRAM enabled yes

IDE Name Arduino IDE 1.8.9

Upload speed 115200

=================================

Have the same issue with the same setup ==Restarts two or three times and it's ok after that...==

Error: assert failed: tcp_update_rcv_ann_wnd IDF/components/lwip/lwip/src/core/tcp.c:951 (new_rcv_ann_wnd <= 0xffff)