Skip to content

MDNS.end() exception 28 #6982

@philbowles

Description

@philbowles

Basic Infos

  • [x ] This issue complies with the issue POLICY doc.
  • [x ] I have read the documentation at readthedocs and the issue is not addressed there.
  • [x ] I have tested that the issue is present in current master branch (aka latest git).
  • [x ] I have searched the issue tracker for a similar issue.
  • [x ] If there is a stack dump, I have decoded it.
  • [x ] I have filled out all fields below.

Platform

  • Hardware: any ESP8266
  • Core Version: 2.6.3
  • Development Env: Arduino IDE 1.8.10
  • Operating System: Windows7

Settings in IDE not relevant, occurs on many boards

Problem Description

Calling MDNS.end() when already closed causes exception 28. Yes, I know it's not a normal thing to do, but if your code gets "out of step" for some other reason, an exception is a heavy punishment! Can we change it to just silently do nothing, as most other APIs do? For example calling WiFi.disconnect() when already disconnected causes no ill effects

MCVE Sketch

#include <Arduino.h> #include <ESP8266WiFi.h> #include <ESP8266mDNS.h> #include <ArduinoOTA.h> void setup() { Serial.begin(115200); Serial.println("Booting"); WiFi.mode(WIFI_STA); WiFi.begin("XXXXXXXX", "XXXXXXXX"); WiFi.waitForConnectResult(); ArduinoOTA.begin(); Serial.println("Ready"); Serial.print("IP address: "); Serial.println(WiFi.localIP()); Serial.print("Close MDNS OK\n"); MDNS.end(); Serial.print("Close Again\n"); MDNS.end(); Serial.print("You will never see this message\n"); } void loop() { ArduinoOTA.handle(); }

Debug Messages

Booting Ready IP address: 192.168.1.106 Close MDNS OK Close Again Exception (28): epc1=0x40207a2b epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000000 depc=0x00000000 >>>stack>>> ctx: cont sp: 3ffffd30 end: 3fffffc0 offset: 01a0 3ffffed0: 3ffe86b7 0000204a 00000000 00000000 3ffffee0: 4020c438 00000000 0000019d 401009a0 3ffffef0: 000008a0 00000000 3ffee48c 40207ac2 3fffff00: 00000ca0 00000194 00000194 3ffee708 3fffff10: 3fffdad0 3ffee48c 3ffee48c 40206341 3fffff20: 3ffe866b 00000000 3ffee48c 40203650 3fffff30: 3ffe0000 00000000 01010003 40010001 3fffff40: 40200000 00000000 3ffee48c 40202fd0 3fffff50: 00000000 00000000 3ffe865f 3ffee708 3fffff60: 3fffdad0 3ffee48c 3ffee48c 40202ff6 3fffff70: 3fffdad0 3ffee48c 3ffee5c0 40203020 3fffff80: 3fffdad0 3ffee470 3ffee5c0 402010d4 3fffff90: 4020c438 6a01a8c0 feefeffe feefeffe 3fffffa0: feefeffe 00000000 3ffee6c8 4020a634 3fffffb0: feefeffe feefeffe 3ffe84f8 40100eed <<<stack<<< 

Decoded Stack Trace

Exception 28: LoadProhibited: A load referenced a page mapped with an attribute that does not permit loads PC: 0x40207a2b: esp8266::MDNSImplementation::MDNSResponder::_sendMDNSMessage_Multicast(esp8266::MDNSImplementation::MDNSResponder::stcMDNSSendParameter&) at C:\Users\phil\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.6.3\libraries\ESP8266mDNS\src\LEAmDNS_Transfer.cpp line 125 EXCVADDR: 0x00000000 Decoding stack results 0x401009a0: umm_free_core(void*) at C:\Users\phil\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.6.3\cores\esp8266\umm_malloc\umm_malloc.cpp line 316 0x40207ac2: esp8266::MDNSImplementation::MDNSResponder::_sendMDNSMessage(esp8266::MDNSImplementation::MDNSResponder::stcMDNSSendParameter&) at C:\Users\phil\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.6.3\libraries\ESP8266mDNS\src\LEAmDNS_Transfer.cpp line 96 0x40206341: esp8266::MDNSImplementation::MDNSResponder::stcMDNSSendParameter::stcMDNSSendParameter() at C:\Users\phil\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.6.3\libraries\ESP8266mDNS\src\LEAmDNS_Structs.cpp line 2375 0x40203650: esp8266::MDNSImplementation::MDNSResponder::_announce(bool, bool) at C:\Users\phil\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.6.3\libraries\ESP8266mDNS\src\LEAmDNS_Control.cpp line 1607 0x40202fd0: std::__shared_ptr ::reset() at c:\users\phil\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\2.5.0-4-b40a506\xtensa-lx106-elf\include\c++\4.8.2\bits/shared_ptr_base.h line 882 0x40202ff6: esp8266::MDNSImplementation::MDNSResponder::close() at C:\Users\phil\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.6.3\libraries\ESP8266mDNS\src\LEAmDNS.cpp line 223 0x40203020: esp8266::MDNSImplementation::MDNSResponder::end() at C:\Users\phil\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.6.3\libraries\ESP8266mDNS\src\LEAmDNS.cpp line 243 0x402010d4: setup() at C:\Users\phil\Documents\Arduino\mdnsbug/mdnsbug.ino line 21 0x4020a634: loop_wrapper() at C:\Users\phil\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.6.3\cores\esp8266\core_esp8266_main.cpp line 177 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions