Closed
Description
Basic Infos
- This issue complies with the issue POLICY doc.
- I have read the documentation at readthedocs and the issue is not addressed there.
- I have tested that the issue is present in current master branch (aka latest git).
- I have searched the issue tracker for a similar issue.
- If there is a stack dump, I have decoded it.
- I have filled out all fields below.
Platform
- Hardware: [ESP-12]
- Core Version: [core v2.5.0-beta3]
- Development Env: [Arduino IDE|Platformio]
- Operating System: [Windows]
Settings in IDE
- Module: [Nodemcu]
- Flash Mode: [qio]
- Flash Size: [4MB/1MB]
- lwip Variant: [v2 Lower Memory|Higher Bandwidth]
- Reset Method: [nodemcu]
- Flash Frequency: [40Mhz]
- CPU Frequency: [80Mhz]
- Upload Using: [SERIAL]
- Upload Speed: [115200] (serial upload only)
Problem Description
MDNS.setInstanceName("XXXXXXXXXXXXXXX");
when paired with MDNS.update();
in loop() causes crashes.
MCVE Sketch
Below is the mDNS_Web_Server example with MDNS.setInstanceName("XXXXXXXXXXXXXXX");
line added before MDNS.begin();
/*
ESP8266 mDNS responder sample
This is an example of an HTTP server that is accessible
via http://esp8266.local URL thanks to mDNS responder.
Instructions:
- Update WiFi SSID and password as necessary.
- Flash the sketch to the ESP8266 board
- Install host software:
- For Linux, install Avahi (http://avahi.org/).
- For Windows, install Bonjour (http://www.apple.com/support/bonjour/).
- For Mac OSX and iOS support is built in through Bonjour already.
- Point your browser to http://esp8266.local, you should see a response.
*/
#include <ESP8266WiFi.h>
#include <ESP8266mDNS.h>
#include <WiFiClient.h>
#ifndef STASSID
#define STASSID "iHacKedUrWiFi"
#define STAPSK "aishu1357"
#endif
const char* ssid = STASSID;
const char* password = STAPSK;
// TCP server at port 80 will respond to HTTP requests
WiFiServer server(80);
void setup(void) {
Serial.begin(115200);
// Connect to WiFi network
WiFi.mode(WIFI_STA);
WiFi.begin(ssid, password);
Serial.println("");
// Wait for connection
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.print("Connected to ");
Serial.println(ssid);
Serial.print("IP address: ");
Serial.println(WiFi.localIP());
// Set up mDNS responder:
// - first argument is the domain name, in this example
// the fully-qualified domain name is "esp8266.local"
// - second argument is the IP address to advertise
// we send our IP address on the WiFi network
MDNS.setInstanceName("XXXXXXXXXXXXXXX");
if (!MDNS.begin("esp8266")) {
Serial.println("Error setting up MDNS responder!");
while (1) {
delay(1000);
}
}
Serial.println("mDNS responder started");
// Start TCP (HTTP) server
server.begin();
Serial.println("TCP server started");
// Add service to MDNS-SD
MDNS.addService("http", "tcp", 80);
}
void loop(void) {
MDNS.update();
// Check if a client has connected
WiFiClient client = server.available();
if (!client) {
return;
}
Serial.println("");
Serial.println("New client");
// Wait for data from client to become available
while (client.connected() && !client.available()) {
delay(1);
}
// Read the first line of HTTP request
String req = client.readStringUntil('\r');
// First line of HTTP request looks like "GET /path HTTP/1.1"
// Retrieve the "/path" part by finding the spaces
int addr_start = req.indexOf(' ');
int addr_end = req.indexOf(' ', addr_start + 1);
if (addr_start == -1 || addr_end == -1) {
Serial.print("Invalid request: ");
Serial.println(req);
return;
}
req = req.substring(addr_start + 1, addr_end);
Serial.print("Request: ");
Serial.println(req);
client.flush();
String s;
if (req == "/") {
IPAddress ip = WiFi.localIP();
String ipStr = String(ip[0]) + '.' + String(ip[1]) + '.' + String(ip[2]) + '.' + String(ip[3]);
s = "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n<!DOCTYPE HTML>\r\n<html>Hello from ESP8266 at ";
s += ipStr;
s += "</html>\r\n\r\n";
Serial.println("Sending 200");
} else {
s = "HTTP/1.1 404 Not Found\r\n\r\n";
Serial.println("Sending 404");
}
client.print(s);
Serial.println("Done with client");
}
Debug Messages
Connected to YYYYYYYYYY
IP address: 192.168.YYY.YYY
mDNS responder started
TCP server started
Exception (28):
epc1=0x402090d2 epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000000 depc=0x00000000
>>>stack>>>
ctx: cont
sp: 3ffffcb0 end: 3fffffc0 offset: 01a0
3ffffe50: 4020a860 f100a8c0 3ffee860 00000030
3ffffe60: 4020a860 00000000 2d0e5604 40206d3c
3ffffe70: 00000001 3ffee78c 3ffffeb0 00000001
3ffffe80: 402091d2 3ffffeb0 3ffee78c 402091e6
3ffffe90: 00000002 00000001 3fff01ac 40206e88
3ffffea0: 3fffdad0 3ffee78c 3fff01ac 40204e14
3ffffeb0: 00030000 3fff01ac 00000001 00000000
3ffffec0: 40230000 00000000 000003e8 3ffee860
3ffffed0: 3fffdad0 3ffee78c 3ffee78c 4020527a
3ffffee0: 4020a860 00000000 3ffee750 402034fc
3ffffef0: 3fffdad0 3ffee78c 3ffee82c 402060fb
3fffff00: 3fffdad0 00000000 3ffee82c 402045fe
3fffff10: 00000010 00000000 3ffee82c 402026af
3fffff20: 4020a748 00000000 00001388 40100500
3fffff30: 00000000 00000000 3fffff7c 40100948
3fffff40: 3ffe86a3 3ffee78c 3fffff70 402098f0
3fffff50: 3ffe86a3 3ffee78c 3ffee7f4 4020990c
3fffff60: 3ffe86a3 3ffee78c 3ffee7f4 40202612
3fffff70: 00000000 00000000 00000000 00000000
3fffff80: 00000000 00000000 feefeffe feefeffe
3fffff90: 00000000 00000000 00000001 40209ecd
3fffffa0: 3fffdad0 00000000 3ffee82c 40209f58
3fffffb0: feefeffe feefeffe 3ffe8514 401009a5
<<<stack<<<
ets Jan 8 2013,rst cause:2, boot mode:(3,6)
load 0x4010f000, len 1384, room 16
tail 8
chksum 0x2d
csum 0x2d
v21db8fc9
~ld
Stack Trace:
Exception 28: LoadProhibited: A load referenced a page mapped with an attribute that does not permit loads
PC: 0x402090d2: esp8266::MDNSImplementation::MDNSResponder::_sendMDNSMessage_Multicast(esp8266::MDNSImplementation::MDNSResponder::stcMDNSSendParameter&, int) at C:\Users\IIIIIIIIIIII\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.0-beta3\libraries\ESP8266mDNS\src\LEAmDNS_Transfer.cpp line 121
EXCVADDR: 0x00000000
Decoding stack results
0x40206d3c: esp8266::MDNSImplementation::MDNSResponder::stcMDNS_RRDomain::addLabel(char const*, bool) at C:\Users\IIIIIIIIIIII\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.0-beta3\libraries\ESP8266mDNS\src\LEAmDNS_Structs.cpp line 676
0x402091d2: esp8266::MDNSImplementation::MDNSResponder::_sendMDNSMessage(esp8266::MDNSImplementation::MDNSResponder::stcMDNSSendParameter&) at C:\Users\IIIIIIIIIIII\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.0-beta3\libraries\ESP8266mDNS\src\LEAmDNS_Transfer.cpp line 94
0x402091e6: esp8266::MDNSImplementation::MDNSResponder::_sendMDNSMessage(esp8266::MDNSImplementation::MDNSResponder::stcMDNSSendParameter&) at C:\Users\IIIIIIIIIIII\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.0-beta3\libraries\ESP8266mDNS\src\LEAmDNS_Transfer.cpp line 95
0x40206e88: esp8266::MDNSImplementation::MDNSResponder::stcMDNS_RRQuestion::stcMDNS_RRQuestion() at C:\Users\IIIIIIIIIIII\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.0-beta3\libraries\ESP8266mDNS\src\LEAmDNS_Structs.cpp line 869
0x40204e14: esp8266::MDNSImplementation::MDNSResponder::_sendHostProbe() at C:\Users\IIIIIIIIIIII\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.0-beta3\libraries\ESP8266mDNS\src\LEAmDNS_Control.cpp line 1235
0x4020527a: esp8266::MDNSImplementation::MDNSResponder::_updateProbeStatus() at C:\Users\IIIIIIIIIIII\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.0-beta3\libraries\ESP8266mDNS\src\LEAmDNS_Control.cpp line 1053
0x402034fc: ESP8266WiFiSTAClass::isConnected() at C:\Users\IIIIIIIIIIII\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.0-beta3\libraries\ESP8266WiFi\src\ESP8266WiFiSTA.cpp line 339
0x402060fb: esp8266::MDNSImplementation::MDNSResponder::_process(bool) at C:\Users\IIIIIIIIIIII\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.0-beta3\libraries\ESP8266mDNS\src\LEAmDNS_Control.cpp line 82
0x402045fe: esp8266::MDNSImplementation::MDNSResponder::update() at C:\Users\IIIIIIIIIIII\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.0-beta3\libraries\ESP8266mDNS\src\LEAmDNS.cpp line 1095
0x402026af: loop() at C:\Users\IIIIIIIIIIII\AppData\Local\Temp\1\arduino_modified_sketch_795762/mDNS_Web_Server.ino line 80
0x40100500: _umm_free at C:\Users\IIIIIIIIIIII\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.0-beta3\cores\esp8266\umm_malloc\umm_malloc.c line 1300
0x40100948: free at C:\Users\IIIIIIIIIIII\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.0-beta3\cores\esp8266\umm_malloc\umm_malloc.c line 1760
0x402098f0: String::invalidate() at C:\Users\IIIIIIIIIIII\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.0-beta3\cores\esp8266\WString.cpp line 141
0x4020990c: String::~String() at C:\Users\IIIIIIIIIIII\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.0-beta3\cores\esp8266\WString.cpp line 125
0x40202612: setup() at C:\Users\IIIIIIIIIIII\AppData\Local\Temp\1\arduino_modified_sketch_795762/mDNS_Web_Server.ino line 72
0x40209ecd: esp_schedule() at C:\Users\IIIIIIIIIIII\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.0-beta3\cores\esp8266\core_esp8266_main.cpp line 95
0x40209f58: loop_wrapper() at C:\Users\IIIIIIIIIIII\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.0-beta3\cores\esp8266\core_esp8266_main.cpp line 125
Metadata
Metadata
Assignees
Labels
No labels