Closed liquidfalcon closed 6 years ago
/cc @larsenglund
Can you enable MDNS_DEBUG_RX and post the serial output here?
Sorry for the slow response there gents, log output is below (Immediately after this log is the WDT fire and subsequent stack trace):
Reading answers RX: REQ, ID:0, Q:0, A:4, NS:0, ADD:0
12 5f 50 6f 77 65 72 53 65 6e 73 6f 72
found matching service: PowerSensor
4 5f 74 63 70
5 6c 6f 63 61 6c
type: 000c rdlength: 40
0e 4c 69 6e 65 7a 2d 30 30 30 30 31 36 33 34 0c 5f 50 6f 77 65 72 53 65 6e 73 6f 72 04 5f 74 63 70 05 6c 6f 63 61 6c 00
14 4c 69 6e 65 7a 2d 30 30 30 30 31 36 33 34
12 5f 50 6f 77 65 72 53 65 6e 73 6f 72
found matching service: PowerSensor
4 5f 74 63 70
5 6c 6f 63 61 6c
type: 0010 rdlength: 0
14 4c 69 6e 65 7a 2d 30 30 30 30 31 36 33 34
12 5f 50 6f 77 65 72 53 65 6e 73 6f 72
found matching service: PowerSensor
4 5f 74 63 70
5 6c 6f 63 61 6c
type: 0021 rdlength: 28
14 6c 69 6e 65 7a 2d 30 30 30 30 31 36 33 34
linez-00001634
14 6c 69 6e 65 7a 2d 30 30 30 30 31 36 33 34
5 6c 6f 63 61 6c
type: 0001 rdlength: 4
All answers parsed, adding to _answers list..
Reading answers RX: REQ, ID:0, Q:0, A:4, NS:0, ADD:0
12 5f 50 6f 77 65 72 53 65 6e 73 6f 72
found matching service: PowerSensor
4 5f 74 63 70
5 6c 6f 63 61 6c
type: 000c rdlength: 40
0e 4c 69 6e 65 7a 2d 30 30 30 30 31 37 37 37 0c 5f 50 6f 77 65 72 53 65 6e 73 6f 72 04 5f 74 63 70 05 6c 6f 63 61 6c 00
14 4c 69 6e 65 7a 2d 30 30 30 30 31 37 37 37
12 5f 50 6f 77 65 72 53 65 6e 73 6f 72
found matching service: PowerSensor
4 5f 74 63 70
5 6c 6f 63 61 6c
type: 0010 rdlength: 0
14 4c 69 6e 65 7a 2d 30 30 30 30 31 37 37 37
12 5f 50 6f 77 65 72 53 65 6e 73 6f 72
found matching service: PowerSensor
4 5f 74 63 70
5 6c 6f 63 61 6c
type: 0021 rdlength: 28
14 6c 69 6e 65 7a 2d 30 30 30 30 31 37 37 37
linez-00001777
14 6c 69 6e 65 7a 2d 30 30 30 30 31 37 37 37
5 6c 6f 63 61 6c
type: 0001 rdlength: 4
All answers parsed, adding to _answers list..
Reading answers RX: REQ, ID:0, Q:0, A:4, NS:0, ADD:0
12 5f 50 6f 77 65 72 53 65 6e 73 6f 72
found matching service: PowerSensor
4 5f 74 63 70
5 6c 6f 63 61 6c
type: 000c rdlength: 40
0e 4c 69 6e 65 7a 2d 30 30 31 32 31 33 33 38 0c 5f 50 6f 77 65 72 53 65 6e 73 6f 72 04 5f 74 63 70 05 6c 6f 63 61 6c 00
14 4c 69 6e 65 7a 2d 30 30 31 32 31 33 33 38
12 5f 50 6f 77 65 72 53 65 6e 73 6f 72
found matching service: PowerSensor
4 5f 74 63 70
5 6c 6f 63 61 6c
type: 0010 rdlength: 0
14 4c 69 6e 65 7a 2d 30 30 31 32 31 33 33 38
12 5f 50 6f 77 65 72 53 65 6e 73 6f 72
found matching service: PowerSensor
4 5f 74 63 70
5 6c 6f 63 61 6c
type: 0021 rdlength: 28
14 6c 69 6e 65 7a 2d 30 30 31 32 31 33 33 38
linez-00121338
14 6c 69 6e 65 7a 2d 30 30 31 32 31 33 33 38
5 6c 6f 63 61 6c
type: 0001 rdlength: 4
All answers parsed, adding to _answers list..
Reading answers RX: REQ, ID:0, Q:0, A:4, NS:0, ADD:0
12 5f 50 6f 77 65 72 53 65 6e 73 6f 72
found matching service: PowerSensor
4 5f 74 63 70
5 6c 6f 63 61 6c
type: 000c rdlength: 40
0e 4c 69 6e 65 7a 2d 30 30 30 30 31 36 34 34 0c 5f 50 6f 77 65 72 53 65 6e 73 6f 72 04 5f 74 63 70 05 6c 6f 63 61 6c 00
14 4c 69 6e 65 7a 2d 30 30 30 30 31 36 34 34
12 5f 50 6f 77 65 72 53 65 6e 73 6f 72
found matching service: PowerSensor
4 5f 74 63 70
5 6c 6f 63 61 6c
type: 0010 rdlength: 0
14 4c 69 6e 65 7a 2d 30 30 30 30 31 36 34 34
12 5f 50 6f 77 65 72 53 65 6e 73 6f 72
found matching service: PowerSensor
4 5f 74 63 70
5 6c 6f 63 61 6c
type: 0021 rdlength: 28
14 6c 69 6e 65 7a 2d 30 30 30 30 31 36 34 34
linez-00001644
14 6c 69 6e 65 7a 2d 30 30 30 30 31 36 34 34
5 6c 6f 63 61 6c
type: 0001 rdlength: 4
All answers parsed, adding to _answers list..
If it helps, the scenario here is 5 of my devices running, and one of them ran this discovery request to find the others.
Can you guys test this PR? Let me know if you still get resets
mDNS query _arduino._tcp
2 service(s) found
1: (192.168.254.182:8266) esp-test
2: (192.168.254.156:22) piduino1
mDNS query _http._tcp
2 service(s) found
1: (192.168.254.182:80) esp-test
2: (192.168.254.194:80) HP LaserJet CP1025nw
mDNS query _ipp._tcp
1 service(s) found
1: (192.168.254.194:631) HP LaserJet CP1025nw
mDNS query _afpovertcp._tcp
1 service(s) found
1: (192.168.254.49:548) Hristo's Time Capsule
mDNS query _smb._tcp
1 service(s) found
1: (192.168.254.49:445) Hristo's Time Capsule
mDNS query _ftp._tcp
0 service(s) found
@liquidfalcon is this issue still valid with latest git?
The referenced PR was merged. Closing due to no feedback in over 2 months.
I am having frequent restarts when I am using MDNS. Although my code is quiet long, so I am unable to paste entire code (I am using https://github.com/xoseperez/espurna ). But I am sure there is some issue with MDNS in 2.4.2 and also latest git, which is causing frequent WDT Reset. If I turn off mdns, its working fine.
This is part of my code -
...
...
MDNS.addService("http", "tcp", getSetting("webPort", WEB_PORT).toInt());
…
…
// THIS PART IS CALLED After wifi is connected in the main loop.
// getSetting is a function which returns String.
if (MDNS.begin((char *) getSetting("hostname").c_str())) {
success = true;
Serial.println("[DEBUG] MDNS OK"); // THIS LINE IS NOT CALLED
} else {
Serial.println("[DEBUG] MDNS FAIL"); // Neigther this one
}
Its happening for 3-4 times after restarting esp. But after 3-4 times it gets settled. Something is wrong with MDNS I can confirm.
Is it not valid to call addService() method before calling .begin() ? Because in my case I am adding Service only once but wifi reconnections are handled in my main loop. So WiFi.onStationModeGotIP
will be called many times.
yes, the current mdns is broken. A rewrite was done in #5370 and it's integration into our core as an experimental replacement is WIP.
Ohh... @devyte Really Thank you for confirming. Is there any temporary solution or workaround ? We are sipping our products, and mdns is an essential component ?
Only to try the new implementation to check if it works for you. The current code is broken in several dimensions simultaneously.
Basic Infos
Hardware
Hardware: ESP-12E Core Version: Git
Description
MDNSResponder::_parsePacket hits an infinite loop at the following code:
If I throw a counter in there and log it, it hits ~5500 iterations before the WDT fires. Additionally, putting in a simple if (iterations > 32) break; seems to stave off the crash, but a memory leak occurs each time I use MDNS. This happens the first time and every time I query services using MDNS.
Settings in IDE
Module: ESP-12E - Built with
Core Development Module
and open source LWIP Flash Size: 4M CPU Frequency: 80MHz Flash Mode: qio Flash Frequency: 40Mhz Upload Using: Serial Reset Method: N/ASketch
Simply calling
MDNS.queryService(F("$MY_SERVICE"), "tcp");
exhibits this behaviour. Additionally, I have approximately 10 other ESP-12 modules and other devices running similar code on this network, all implementing $MY_SERVICE.Debug
Stack trace:
Decoded:
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.