These are chat archives for esp8266/Arduino

8th
Jun 2017
Lars Englund
@larsenglund
Jun 08 2017 10:54
Hmm, I'm getting this stackdump:
https://pasteboard.co/g2nmn9aYz.png
Should I dig for the problem in ESP8266mDNS.cpp?
(line 261 contains the closing bracket for the addServiceTxt method so I'm guessing the line numbers are incorrect or refering to some other file?)
Lars Englund
@larsenglund
Jun 08 2017 11:00
The code for sending out querys has worked fine before so I'm thinking something in my network might cause it?
Myles Eftos
@madpilot
Jun 08 2017 11:05
I found wireshark pretty handy for debugging this stuff as mDNS packets are broadcast. You might find a massive packet is locking up the parsing and causing the watchdog to trigger. What CPU speed have you set?
Lars Englund
@larsenglund
Jun 08 2017 11:13
160mhz
Lars Englund
@larsenglund
Jun 08 2017 11:22
Hmm, after some debugging in ESP8266mDNS.cpp::_parsePacket() I found that it enters an infinite loop trying to add a new answer to answer list (around line 644)
It adds the three first answers to the list without any problem but when the fourth is parsed and ready to be added while (answer->next != 0) { never exits..
Could answer->next have been corruptedhow?
Since every new answer gets intialized to answer->next = 0;...
Myles Eftos
@madpilot
Jun 08 2017 11:37
Could be a bad packet that is causing a buffer overflow, stopping the traversal from terminating. Hard to say with out looking at the packet
Lars Englund
@larsenglund
Jun 08 2017 11:44
Reading answers RX: REQ, ID:0, Q:0, A:4, NS:0, ADD:0
 4 5f 65 73 70 
found matching service: esp
 4 5f 74 63 70 
 5 6c 6f 63 61 6c 
type: 000c rdlength: 28
0a 65 73 70 5f 44 41 33 35 45 41 04 5f 65 73 70 04 5f 74 63 70 05 6c 6f 63 61 6c 00 
 10 65 73 70 5f 44 41 33 35 45 41 
 4 5f 65 73 70 
found matching service: esp
 4 5f 74 63 70 
 5 6c 6f 63 61 6c 
type: 0010 rdlength: 0

 10 65 73 70 5f 44 41 33 35 45 41 
 4 5f 65 73 70 
found matching service: esp
 4 5f 74 63 70 
 5 6c 6f 63 61 6c 
type: 0021 rdlength: 24
 10 65 73 70 5f 64 61 33 35 65 61 
esp_da35ea
 10 65 73 70 5f 64 61 33 35 65 61 
 5 6c 6f 63 61 6c 
type: 0001 rdlength: 4
All answers parsed, adding to _answers list..
else
It's after this packet the loop starts so it does not look like a buffer overflow
Also I have checked that I have lots of heap space left (>28K)
Lars Englund
@larsenglund
Jun 08 2017 11:56
I see now that the problem occurs when _parsePacket has returned after parsing the first three packets and is then called again in MDNSResponder::update() and continues to add a fourth answer to the same answer list.. if that has any significance.. also the next-pointer of the last element in the answer list has changed from 0 to pointing to the last item itself when entering parsePacket the second time (thus causing the infinite loop)
Boggle.. what could be causing the next-pointer to be overwritten between two calls to _parsePacket
I've pasted a sample serial output and the parsePacket that generates it there
Lars Englund
@larsenglund
Jun 08 2017 12:18
Crap, It has already been fixed esp8266/Arduino#2347
I really need to switch to using the latest github code.. sorry for spamming with already answered questions..
Lars Englund
@larsenglund
Jun 08 2017 12:48
Hmm, after following the instuctions to use the git version on https://github.com/esp8266/Arduino#using-git-version i get fatal error: SoftwareSerial.h: No such file or directory when compiling my code..
Lars Englund
@larsenglund
Jun 08 2017 12:58