Skip to content
This repository was archived by the owner on Jan 20, 2025. It is now read-only.

Enabling regex causes crash and bootloop #648

Closed
teemue opened this issue Nov 13, 2019 · 9 comments
Closed

Enabling regex causes crash and bootloop #648

teemue opened this issue Nov 13, 2019 · 9 comments
Labels

Comments

@teemue
Copy link

teemue commented Nov 13, 2019

Using PlatformIO and latest ESPAsyncWebServer.
Accessing http://ip/hello works but if I access /sensor, ESP crashes and bootloops.

server.on("/hello", HTTP_GET, [](AsyncWebServerRequest *request) {
  Serial.println("hello");
  request->send(200, "text / plain", "Other URL");
});

server.on("^\\/sensor\\/([0-9]+)$", HTTP_GET, [](AsyncWebServerRequest *request) {
  String sensorId = request->pathArg(0);
});

platform.ini:

[env:esp01]
platform = espressif8266
board = esp01_1m
framework = arduino
build_flags = 
  -DASYNCWEBSERVER_REGEX
@Bmooij
Copy link
Contributor

Bmooij commented Nov 16, 2019

Does it still crash when you add an response to the sensors request?

server.on("^\\/sensor\\/([0-9]+)$", HTTP_GET, [](AsyncWebServerRequest *request) {
  String sensorId = request->pathArg(0);
  request->send(200, "text / plain", "sensor: " + sensorId);
});

@teemue
Copy link
Author

teemue commented Nov 16, 2019

It crashes. Here's the full code:

#include <ESP8266WiFi.h>
#include <DNSServer.h>
#include <ESPAsyncWebServer.h>
#include <ESPAsyncWiFiManager.h>

AsyncWebServer server(80);
DNSServer dns;
#define HOST_NAME "ESP"

void setup()
{
  Serial.begin(115200,SERIAL_8N1,SERIAL_TX_ONLY);
  AsyncWiFiManager wifiManager(&server, &dns);
  if (!wifiManager.autoConnect())
  {
    ESP.reset();
    delay(1000);
  }

  String hostNameWifi = HOST_NAME;
  hostNameWifi.concat(".local");
  WiFi.hostname(hostNameWifi);

  server.on("/hello", HTTP_GET, [](AsyncWebServerRequest *request) {
    Serial.println("hello");
    request->send(200, "text / plain", "Other URL");
  });

  server.on("^\\/sensor\\/([0-9]+)$", HTTP_GET, [](AsyncWebServerRequest *request) {
    String sensorId = request->pathArg(0);
    request->send(200, "text / plain", "sensor: " + sensorId);
  });

  server.begin();
}

void loop()
{
}

@teemue
Copy link
Author

teemue commented Nov 17, 2019

I tried also without WifiManager (only ESP8266WiFi and ESPAsyncWebServer included), no effect.

@niklasdoerfler
Copy link

I can observe the same behaviour. Is there already a solution to the problem?

@Bmooij
Copy link
Contributor

Bmooij commented Dec 27, 2019

There is an issue with regex and the esp8266.
See:
esp8266/Arduino#6198
esp8266/Arduino#6952

There is no fix for now. When I have some time, I will rewrite the regex part and create an new pull request

@stale
Copy link

stale bot commented Feb 26, 2020

[STALE_SET] This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Feb 26, 2020
@stale
Copy link

stale bot commented Mar 11, 2020

[STALE_DEL] This stale issue has been automatically closed. Thank you for your contributions.

@stale stale bot closed this as completed Mar 11, 2020
@kjyv
Copy link

kjyv commented Aug 2, 2022

still an issue, so should be reopened

1 similar comment
@flier268
Copy link

still an issue, so should be reopened

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

5 participants