Closed avillacis closed 2 years ago
msdn-capture-esp32-crashme-with-crash.zip This is a zipped PCAP file taken with Wireshark, showing MDNS traffic between the Android phone and the ESP32 device. The IPs are 172.16.238.40 for the ESP32 and 172.16.238.189 for the Android phone. I believe some of these MDNS queries are the cause of the crash.
The previously-mentioned Android App still causes a crash in the ESP32 firmware when compiled under v2.0.3-rc1.
This espressif/esp-idf issue is marked as "resolved" but apparently the change is still not present in -rc1.
Its resolved in idf master, not sure if already backported to v4.4, and most likely not included in v2.0.3-rc1.
Adding this to roadmap and when we have time we will test this.
I can confirm this problem using the above sketch and also my ESP32 app. I'm using platformio with configuration
[env:esp32dev] upload_speed = 921600 monitor_speed = 115200 monitor_filters = esp32_exception_decoder platform = https://github.com/platformio/platform-espressif32.git board = esp32dev framework = arduino platform_packages = framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32#master lib_deps =
Also, the Android Service Browser by Andriy Druk shows the IP and DNS name "esp32-crashme", but a browser (Vivaldi or Opera) will not open the page using http://esp32-crashme.local, while it will open using http://[ip address]
Also a Windows 10 browser does not open the page http://esp32-crashme.local and cannot ping esp32-crashme.local. I have bonjour 64 bit installed. Also checked for zeroconf services using python
>>> from zeroconf import ZeroconfServiceTypes
>>> ZeroconfServiceTypes.find()
()
Still crashing in the same way when sketch compiled with 2.0.3 stable.
Thanks for testing, we will investigate this in next milestone.
I think I got what is going on. Can you please try to add MDNS. addServiceTxt("http", "tcp","hello","world");
after MDNS.addService("http", "tcp", 80);
I think I got what is going on. Can you please try to add
MDNS. addServiceTxt("http", "tcp","hello","world");
afterMDNS.addService("http", "tcp", 80);
I just performed this test, not exactly with those strings, but two other ones. Device STILL crashes:
Guru Meditation Error: Core 0 panic'ed (LoadProhibited). Exception was unhandled.
Core 0 register dump:
PC : 0x40007b47 PS : 0x00060c30 A0 : 0x800eb7eb A1 : 0x3ffe2190
A2 : 0x3ffe2558 A3 : 0x00000000 A4 : 0x0000005f A5 : 0x3ffe3264
A6 : 0x00000000 A7 : 0x00000000 A8 : 0x80007b41 A9 : 0x00000010
A10 : 0x3ffac7cb A11 : 0x00000044 A12 : 0x00000006 A13 : 0x00000000
A14 : 0x0000006c A15 : 0x00000000 SAR : 0x00000019 EXCCAUSE: 0x0000001c
EXCVADDR: 0x00000000 LBEG : 0x00000006 LEND : 0x00000000 LCOUNT : 0x40028031
Backtrace:0x40007b44:0x3ffe21900x400eb7e8:0x3ffe21b0 0x400ef1e9:0x3ffe21e0 0x400efdc1:0x3ffe22b0
PC: 0x40007b47
EXCVADDR: 0x00000000
Decoding stack results
0x400eb7e8: _mdns_get_service_item_instance at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/mdns/mdns.c line 265
0x400ef1e9: mdns_parse_packet at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/mdns/mdns.c line 1482
0x400efdc1: _mdns_service_task at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/mdns/mdns.c line 4473
In the Android app, the phone managed to retrieve the strings I added as part of the test.
With this:
if (!MDNS.begin(hostname))
{
Serial.println("Error starting mDNS");
return;
}
MDNS.addService("http", "tcp", 80);
MDNS.addServiceTxt("http", "tcp", "hello", "world");
I do not see the crash any more from Druk Service Browser. Also dns.local is working on Windows 10 browser and ping. YAY! Thanks!
Android (LG G8 phone with Vivaldi and Opera) still works only with IP address but not with dns lookup, even though Service Browser shows mDNS name.
With this:
if (!MDNS.begin(hostname)) { Serial.println("Error starting mDNS"); return; } MDNS.addService("http", "tcp", 80); MDNS.addServiceTxt("http", "tcp", "hello", "world");
I do not see the crash any more from Druk Service Browser. Also dns.local is working on Windows 10 browser and ping. YAY! Thanks!
Android (LG G8 phone with Vivaldi and Opera) still works only with IP address but not with dns lookup, even though Service Browser shows mDNS name.
Your experience does not match mine.
I am still experiencing crashes. I used the strings "YUBOX", "xyzxy" instead of "hello", "world". I am using an ESP32S2 with PSRAM enabled and compiled under Arduino-ESP32 v2.3.0. What is your setup?
Your experience does not match mine.
I am still experiencing crashes. I used the strings "YUBOX", "xyzxy" instead of "hello", "world". I am using an ESP32S2 with PSRAM enabled and compiled under Arduino-ESP32 v2.3.0. What is your setup?
My apology, I was not thorough enough in my test. I thought maybe it was because I had "_http" and not "http" but now I see a crash with either one.
--- Miniterm on COM6 115200,8,N,1 ---
--- Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
ets Jun 8 2016 00:22:57
rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT) configsip: 0, SPIWP:0xee clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00 mode:DIO, clock div:2 load:0x3fff0030,len:1184 load:0x40078000,len:12784 load:0x40080400,len:3032 entry 0x400805e4
Connected to IP address: 192.168.4.1 ENTERING initRadSocket() ENTERING initChannel() ENTERING setRelayAddress()
Input channel: 4 set. Guru Meditation Error: Core 0 panic'ed (LoadProhibited). Exception was unhandled.
Core 0 register dump:
PC : 0x400894b7 PS : 0x00060830 A0 : 0x8010a41b A1 : 0x3ffcd8f0
A2 : 0x3ffcc9e8 A3 : 0x00000000 A4 : 0x8008e99c A5 : 0x3ffcd820
A6 : 0x00000003 A7 : 0x00060023 A8 : 0x0000005f A9 : 0x00000000
A10 : 0x00000000 A11 : 0x003fffff A12 : 0x3ff96355 A13 : 0x3ffcd7f0
A14 : 0x00000001 A15 : 0x3ffccae0 SAR : 0x0000001c EXCCAUSE: 0x0000001c
EXCVADDR: 0x00000000 LBEG : 0x4008904c LEND : 0x40089062 LCOUNT : 0x00000000
Backtrace:0x400894b4:0x3ffcd8f00x4010a418:0x3ffcd910 0x4010e20d:0x3ffcd940 0x4010eead:0x3ffcda10
ELF file SHA256: 0000000000000000
Rebooting... ets Jun 8 2016 00:22:57
yup... my fault misreading the request. It does not contain service name at all and that is what is crashing mdns. It never expected such TXT query. Fix was merged in IDF master here waiting to be backported to 4.4 so that we can pick it up :)
Hi there, I also encountered this problem! I don't really know what the correct way of fixing this issue here on github is (the backporting to 4.4 thing).
To get something that works in the meantime I downloaded arduino-esp32 v2.0.3 and esp-idf v4.4.1 and replaced the mdns folder in components with the one the latest one on the master branch of the esp-idf repo. I used that to generated the necessary libmdns.a file for my project.
If someone else wants to use this in the mean time until a proper fix drops here are the necessary mdns files: https://github.com/Seref/temporary_libmdns_fix_for_arduino-esp32
There are some instructions on how to use it, I only tested this with an ESP32, I used Windows and PlattformIO to test this out, so your mileage may vary.
Note: I will remove the repository when the proper fix is here, also be aware that updates to the package that are loaded automatically may break things since this is just a drag&drop solution, you have to apply this whenever the package gets replaced which can be prevented (atleast as far as I know in PlattformIO) by just specifying the version of the package you want.
Hope this helps 😁
Please try 2.0.4
I can confirm this bug was FIXED when building under 2.0.4 on both ESP32 and ESP32-S2. Thanks!
Board
ESP32, ESP32-S2
Device Description
Issue reproduced on both YUBOX Node (ESP32) and YUBOX One (ESP32-S2)
Hardware Configuration
ESP32 board has inbuilt I2C sensors, otherwise plain ESP32-S2 board has buzzer and I2C sensors on different pins
Version
v2.0.2
IDE Name
Arduino IDE 1.8.19
Operating System
Android 8.x, Android 9
Flash frequency
80 MHz
PSRAM enabled
no
Upload speed
115200
Description
I downloaded an Android App to perform MDNS discovery of various ESP32 and ESP32-S2 devices connected to a local network. The Android App is Service Browser by Andriy Druk. This is the link to the Google Play Store.
My YUBOX Framework projects enable MDNS and expose _http._tcp as a MDNS service in order to be discoverable. With other OS such as Fedora Linux and Windows, all runs OK. However, when using the app, and choosing the _http._tcp section, then the specific ESP32 name exposed by the device, the device itself crashes and reboots.
The below sketch also reproduces this bug. It is a straightforward copy of the MDNS HTTP server example provided by Arduino-ESP32, except with my WiFi credentials, and the MDNS name changed to
esp32-crashme
.The expected behavior is, obviously, no crash.
Sketch
Debug Message
Other Steps to Reproduce
No response
I have checked existing issues, online documentation and the Troubleshooting Guide