Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash with invalid DNS server #688

Closed
lopsided98 opened this issue Mar 17, 2018 · 9 comments
Closed

Crash with invalid DNS server #688

lopsided98 opened this issue Mar 17, 2018 · 9 comments
Milestone

Comments

@lopsided98
Copy link

Espurna crashes when an non-functioning DNS server is specified. I run a DNS server on my local network, which is used by Espurna. Espurna is using a static IP, not DHCP. I took the DNS server down for maintenance and I noticed that my device stopped working (Tonbux Powerstrip02, running the latest dev branch). The crash seems to be triggered by loading the web interface.

Here is the crash dump:

Exception (9):
epc1=0x40104a34 epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000003 depc=0x00000000

ctx: sys 
sp: 3ffff9c0 end: 3fffffb0 offset: 01a0

>>>stack>>>
3ffffb60:  40210138 00000000 3fff71a4 00000001  
3ffffb70:  40104c60 0080d7d4 3fff22d0 00000000  
3ffffb80:  3ffef620 3fff22d0 3fff71a4 40256ca8  
3ffffb90:  00000000 005128cc 40201c74 00002710  
3ffffba0:  3fff22d0 00000000 00002710 00002710  
3ffffbb0:  00000000 3fff0ea1 3ffffc40 402103b9  
3ffffbc0:  3fff6414 0000000c 3ffffc10 402226c7  
3ffffbd0:  00000001 00000007 3ffffc10 402226f9  
3ffffbe0:  000003e7 3fff1038 3ffffc10 00000000  
3ffffbf0:  000003e7 3fff1038 3fff1050 402103e8  
3ffffc00:  000003e7 3fff1038 3fff1050 4021ea4e  
3ffffc10:  3fff71a4 0000000f 0000000c 00000000  
3ffffc20:  00000005 00000005 00000000 4025d0e0  
3ffffc30:  00003300 3fff0678 00000000 40202160  
3ffffc40:  3ffea510 00000000 06600660 06600660  
3ffffc50:  000003e7 3fff1038 3fff1040 4021eb18  
3ffffc60:  4025e240 00000020 3fff1040 4021e34f  
3ffffc70:  00000de8 3ffe8ff7 3fff79f8 4021e415  
3ffffc80:  00000000 00000000 3ffe8feb 40203cb0  
3ffffc90:  3ffe8cea 3fff1170 3fff79f8 4020ac40  
3ffffca0:  00000064 3fff1170 3ffe90e9 4020ab8e  
3ffffcb0:  3ffe8cea 3fff1170 3fff79f8 4020b707  
3ffffcc0:  000000cd 00000061 000000d4 00000000  
3ffffcd0:  383a4335 30453a46 3a44433a 443a3136  
3ffffce0:  3fff0034 00035000 00000000 00000000  
3ffffcf0:  00000000 00000000 00000000 3fff71bc  
3ffffd00:  0000000f 00000006 43313441 40004145  
3ffffd10:  00000100 00000025 3ffffd40 4020be46  
3ffffd20:  3fff24a4 000009a8 000009a8 00000000  
3ffffd30:  3ffffd90 00000001 3fff79f8 40223e30  
3ffffd40:  00000001 3fff71a4 3ffffd70 40209ac2  
3ffffd50:  64252e64 00000001 00000002 4020d550  
3ffffd60:  3ffe9308 00000000 3fff848c 00000400  
3ffffd70:  00000000 00000000 00000000 3fff7e00  
3ffffd80:  00000001 3fff0acc 00000002 4020d5ad  
3ffffd90:  4020b544 0000005f 40223e38 40223e24  
3ffffda0:  3fff348c 00000000 3fff0adc 4020f2b4  
3ffffdb0:  3fff3edc 0000019f 0000019f 4010020c  
3ffffdc0:  00000001 3fff348c 3ffffe10 40100690  
3ffffdd0:  3ffea510 5f01a8c0 3ffffe10 402231b8  
3ffffde0:  00000000 0000095e 0000095e 4010020c  
3ffffdf0:  00000001 00000000 3ffffe40 3fff336c  
3ffffe00:  00000001 3fff348c 00000000 40223f52  
3ffffe10:  3fff39a4 3ffe900d 40218c8c 40224785  
3ffffe20:  00000000 00000000 3fff348c 40217445  
3ffffe30:  3fff24a4 00000000 3fff348c 40217cdc  
3ffffe40:  3fff348c 3ffe900d 40217194 402187e0  
3ffffe50:  3fff38a4 00000003 3fff7cb4 401004d8  
3ffffe60:  3fff24a4 00000a1d 00000a1d 3fff2a98  
3ffffe70:  00000096 00000003 3fff7cb4 40217d15  
3ffffe80:  3fff336c 00e5d4af 00002200 401069b4  
3ffffe90:  3fff7d94 3fff2aa4 3fff336c 402247e4  
3ffffea0:  3fff336c 00000096 3fff38a4 40218de9  
3ffffeb0:  00000001 3fff2c98 3fff38a4 40211a94  
3ffffec0:  3fff76bc 3fff2aa0 3fff2a9c 40211ab4  
3ffffed0:  3fff76bc 3fff2aa0 3fff2a9c 4025c875  
3ffffee0:  00000000 0701a8c0 00000010 00000000  
3ffffef0:  00000000 00000010 3ffeb2b8 401069a4  
3fffff00:  40100000 00517be1 3ffebbba 3fff2c90  
3fffff10:  3ffecdd2 3fff2c98 3fff7774 4025acd5  
3fffff20:  3fff2994 3fff351c 3fff351c 3fff02c8  
3fffff30:  00000000 3fff7774 0000001c 3fff351c  
3fffff40:  3ffecdc4 00000000 3fff7774 4025a0d9  
3fffff50:  5f01a8c0 00000064 00000000 0000002b  
3fffff60:  00000002 0000001a 40248277 3ffeec40  
3fffff70:  3ffecd9c 3fffdcc0 3ffeb2c0 3ffeb2c0  
3fffff80:  402481ea 3ffeec40 00000000 3fff357c  
3fffff90:  3fffdc80 00000000 3fff7774 40251f6b  
3fffffa0:  40000f49 3fffdab0 3fffdab0 40000f49  
<<<stack<<<

 ets Jan  8 2013,rst cause:2, boot mode:(3,6)

load 0x4010f000, len 1384, room 16 
tail 8
chksum 0x2d
csum 0x2d
v4ceabea9
~ld

and the decoded stack trace:

0x40210138: wifi_dns_found_callback(char const*, ip_addr*, void*) at /home/ben/.platformio/packages/toolchain-xtensa/xtensa-lx106-elf/include/c++/4.8.2/functional line 1954
0x40104c60: ets_timer_arm_new at ?? line ?
0x40256ca8: dns_enqueue at core/dns.c line 931
:  (inlined by) dns_gethostbyname at core/dns.c line 985
0x40201c74: delay at /home/ben/.platformio/packages/framework-arduinoespressif8266/cores/esp8266/core_esp8266_wiring.c line 46
0x402103b9: ESP8266WiFiGenericClass::hostByName(char const*, IPAddress&, unsigned int) at /home/ben/.platformio/packages/toolchain-xtensa/xtensa-lx106-elf/include/c++/4.8.2/functional line 1954
0x402226c7: String::reserve(unsigned int) at /home/ben/.platformio/packages/framework-arduinoespressif8266/cores/esp8266/WString.cpp line 746
0x402226f9: String::copy(char const*, unsigned int) at /home/ben/.platformio/packages/framework-arduinoespressif8266/cores/esp8266/WString.cpp line 746
0x402103e8: ESP8266WiFiGenericClass::hostByName(char const*, IPAddress&) at /home/ben/.platformio/packages/toolchain-xtensa/xtensa-lx106-elf/include/c++/4.8.2/functional line 1954
0x4021ea4e: NTPClient::getTime() at /home/ben/Documents/Projects/WifiOutlet/espurna/code/.piolibdeps/NtpClientLib/src/NTPClientLib.cpp line 430
0x4025d0e0: readvdd33 at ?? line ?
0x40202160: xPortGetFreeHeapSize at /home/ben/.platformio/packages/framework-arduinoespressif8266/cores/esp8266/heap.c line 73
0x4021eb18: NTPClient::s_getTime() at /home/ben/Documents/Projects/WifiOutlet/espurna/code/.piolibdeps/NtpClientLib/src/NTPClientLib.cpp line 430
0x4025e240: phy_get_vdd33 at ?? line ?
0x4021e34f: now() at /home/ben/Documents/Projects/WifiOutlet/espurna/code/.piolibdeps/Time/Time.cpp line 303
0x4021e415: year() at /home/ben/Documents/Projects/WifiOutlet/espurna/code/.piolibdeps/Time/Time.cpp line 303
0x40203cb0: ntpSynced() at /home/ben/Documents/Projects/WifiOutlet/espurna/code/espurna/mqtt.ino line 654
0x4020ac40: _wsUpdate(ArduinoJson::JsonObject&) at /home/ben/Documents/Projects/WifiOutlet/espurna/code/espurna/ws.ino line 226
0x4020ab8e: set_impl  at /home/ben/Documents/Projects/WifiOutlet/espurna/code/.piolibdeps/ArduinoJson_ID64/src/ArduinoJson/JsonObject.hpp line 292
:  (inlined by) bool ArduinoJson::JsonObject::set (char const*, unsigned int const&) at /home/ben/Documents/Projects/WifiOutlet/espurna/code/.piolibdeps/ArduinoJson_ID64/src/ArduinoJson/JsonObject.hpp line 114
0x4020b707: _wsOnStart(ArduinoJson::JsonObject&) at /home/ben/Documents/Projects/WifiOutlet/espurna/code/espurna/ws.ino line 273
0x4020be46: ArduinoJson::Internals::JsonWriter   >::writeRaw(char) at /home/ben/Documents/Projects/WifiOutlet/espurna/code/.piolibdeps/ArduinoJson_ID64/src/ArduinoJson/Deserialization/../Serialization/JsonWriter.hpp line 144
0x40223e30: std::_Function_handler ::_M_invoke(std::_Any_data const&, ArduinoJson::JsonObject&) at /home/ben/.platformio/packages/toolchain-xtensa/xtensa-lx106-elf/include/c++/4.8.2/functional line 2073
0x40209ac2: std::function ::operator()(ArduinoJson::JsonObject&) const at /home/ben/.platformio/packages/toolchain-xtensa/xtensa-lx106-elf/include/c++/4.8.2/functional line 2465
0x4020d550: wsSend(unsigned int, std::function ) at /home/ben/Documents/Projects/WifiOutlet/espurna/code/espurna/ws.ino line 378
0x4020d5ad: ~function at /home/ben/.platformio/packages/toolchain-xtensa/xtensa-lx106-elf/include/c++/4.8.2/functional line 2174 (discriminator 2)
:  (inlined by) _wsStart(unsigned int) at /home/ben/Documents/Projects/WifiOutlet/espurna/code/espurna/ws.ino line 284 (discriminator 2)
0x4020b544: _wsOnStart(ArduinoJson::JsonObject&) at /home/ben/Documents/Projects/WifiOutlet/espurna/code/espurna/ws.ino line 230
0x40223e38: std::_Function_base::_Base_manager ::_M_manager(std::_Any_data&, std::_Any_data const&, std::_Manager_operation) at /home/ben/.platformio/packages/toolchain-xtensa/xtensa-lx106-elf/include/c++/4.8.2/functional line 1934
0x40223e24: std::_Function_handler ::_M_invoke(std::_Any_data const&, ArduinoJson::JsonObject&) at /home/ben/.platformio/packages/toolchain-xtensa/xtensa-lx106-elf/include/c++/4.8.2/functional line 2069
0x4020f2b4: std::_Function_base::_Base_manager ::_M_init_functor(std::_Any_data&, void (*&&)(AsyncWebSocketClient*, unsigned char*, unsigned int), std::integral_constant ) at /home/ben/.platformio/packages/toolchain-xtensa/xtensa-lx106-elf/include/c++/4.8.2/functional line 1983
:  (inlined by) std::_Function_base::_Base_manager ::_M_init_functor(std::_Any_data&, void (*&&)(AsyncWebSocketClient*, unsigned char*, unsigned int)) at /home/ben/.platformio/packages/toolchain-xtensa/xtensa-lx106-elf/include/c++/4.8.2/functional line 1958
:  (inlined by) function  at /home/ben/.platformio/packages/toolchain-xtensa/xtensa-lx106-elf/include/c++/4.8.2/functional line 2451
:  (inlined by) _wsEvent(AsyncWebSocket*, AsyncWebSocketClient*, AwsEventType, void*, unsigned char*, unsigned int) at /home/ben/Documents/Projects/WifiOutlet/espurna/code/espurna/ws.ino line 294
0x4010020c: _umm_free at /home/ben/.platformio/packages/framework-arduinoespressif8266/cores/esp8266/umm_malloc/umm_malloc.c line 1291
0x40100690: free at /home/ben/.platformio/packages/framework-arduinoespressif8266/cores/esp8266/umm_malloc/umm_malloc.c line 1737
0x402231b8: operator delete(void*) at /home/ben/.platformio/packages/framework-arduinoespressif8266/cores/esp8266/abi.cpp line 57
0x4010020c: _umm_free at /home/ben/.platformio/packages/framework-arduinoespressif8266/cores/esp8266/umm_malloc/umm_malloc.c line 1291
0x40223f52: std::_Function_handler ::_M_invoke(std::_Any_data const&, AsyncWebSocket*, AsyncWebSocketClient*, AwsEventType, void*, unsigned char*, unsigned int) at /home/ben/.platformio/packages/toolchain-xtensa/xtensa-lx106-elf/include/c++/4.8.2/functional line 2073
0x40218c8c: _M_manager at /home/ben/Documents/Projects/WifiOutlet/espurna/code/.piolibdeps/ESP Async WebServer/src/WebRequest.cpp line 792
0x40224785: AsyncWebSocket::_handleEvent(AsyncWebSocketClient*, AwsEventType, void*, unsigned char*, unsigned int) at /home/ben/Documents/Projects/WifiOutlet/espurna/code/.piolibdeps/ESP Async WebServer/src/AsyncWebSocket.cpp line 815
0x40217445: LinkedList ::add(AsyncWebSocketClient* const&) at /home/ben/Documents/Projects/WifiOutlet/espurna/code/.piolibdeps/ESP Async WebServer/src/AsyncWebSocket.cpp line 815
0x40217cdc: AsyncWebSocketClient::AsyncWebSocketClient(AsyncWebServerRequest*, AsyncWebSocket*) at /home/ben/Documents/Projects/WifiOutlet/espurna/code/.piolibdeps/ESP Async WebServer/src/AsyncWebSocket.cpp line 815
0x40217194: _M_manager at /home/ben/Documents/Projects/WifiOutlet/espurna/code/.piolibdeps/ESP Async WebServer/src/AsyncWebSocket.cpp line 815
0x402187e0: _M_invoke at /home/ben/Documents/Projects/WifiOutlet/espurna/code/.piolibdeps/ESP Async WebServer/src/AsyncWebSocket.cpp line 815
0x401004d8: malloc at /home/ben/.platformio/packages/framework-arduinoespressif8266/cores/esp8266/umm_malloc/umm_malloc.c line 1668
0x40217d15: AsyncWebSocketResponse::_ack(AsyncWebServerRequest*, unsigned int, unsigned int) at /home/ben/Documents/Projects/WifiOutlet/espurna/code/.piolibdeps/ESP Async WebServer/src/AsyncWebSocket.cpp line 815
0x401069b4: vPortFree at /home/ben/.platformio/packages/framework-arduinoespressif8266/cores/esp8266/heap.c line 47
0x402247e4: AsyncWebServerRequest::_onAck(unsigned int, unsigned int) at /home/ben/Documents/Projects/WifiOutlet/espurna/code/.piolibdeps/ESP Async WebServer/src/WebRequest.cpp line 792
0x40218de9: _M_invoke at /home/ben/Documents/Projects/WifiOutlet/espurna/code/.piolibdeps/ESP Async WebServer/src/WebRequest.cpp line 792
0x40211a94: AsyncClient::_sent(tcp_pcb*, unsigned short) at /home/ben/Documents/Projects/WifiOutlet/espurna/code/.piolibdeps/ESPAsyncTCP/src/ESPAsyncTCP.cpp line 665
0x40211ab4: AsyncClient::_s_sent(void*, tcp_pcb*, unsigned short) at /home/ben/Documents/Projects/WifiOutlet/espurna/code/.piolibdeps/ESPAsyncTCP/src/ESPAsyncTCP.cpp line 665
0x4025c875: tcp_input at core/tcp_in.c line 370 (discriminator 1)
0x401069a4: pvPortMalloc at /home/ben/.platformio/packages/framework-arduinoespressif8266/cores/esp8266/heap.c line 40
0x40100000: _stext at ?? line ?
0x4025acd5: ip_input at core/ipv4/ip.c line 559
0x4025a0d9: ethernet_input at netif/etharp.c line 1379
0x40248277: pp_tx_idle_timeout at ?? line ?
0x402481ea: pp_tx_idle_timeout at ?? line ?
0x40251f6b: system_get_sdk_version at ?? line ?

It looks like this might not be an Espurna specific problem, but I'm not sure how to debug it further.

@xoseperez xoseperez added the bug label Mar 19, 2018
@mcspr
Copy link
Collaborator

mcspr commented Mar 23, 2018

@lopsided98 It might be caused by NtpClient library used in espurna, which periodicaly checks ntp server availability. Does your build use ntp and is ntp server stored as domain name (not as ip)? This can be related to #682 (comment)

@lopsided98
Copy link
Author

I am using a NTP server with a domain name. I just got a chance to update to the official build of 1.12.6, and the problem still exists.

@lopsided98
Copy link
Author

The problem goes away if I use an IP address of an NTP server.

@mcspr I tried the commit you suggested (which seems to be a different branch that requires async UDP), and it had the same problem. I also tried the develop and master versions of NtpClient, as well as different versions of the Arduino core, and they all exhibited the bug.

@xoseperez
Copy link
Owner

xoseperez commented May 15, 2018

May I know what NTP server you are using (the domain name)? In general, using the ntp pool (pool.ntp.org) should be enough.

@xoseperez xoseperez added the ntp label May 15, 2018
@lopsided98
Copy link
Author

I was using pool.ntp.org until I switched to using an IP address to work around this bug.

@xoseperez
Copy link
Owner

You said you are using static IP, then you have defined an static DNS too, right? Is that pointing to your local server?

@lopsided98
Copy link
Author

Yes, normally I use a local DNS server (and everything works fine unless the DNS server isn't running). For a while I was using Google's DNS as another workaround, which also works.

@xoseperez
Copy link
Owner

So the problem is that it crashes when the DNS server is not available. It should just fail to not using NTP at all...

@xoseperez xoseperez added this to the 1.13.0 milestone May 18, 2018
@xoseperez xoseperez modified the milestones: 1.13.0, 1.14.0 Jun 4, 2018
@mcspr
Copy link
Collaborator

mcspr commented Dec 31, 2019

Duplicate of #1617

@mcspr mcspr marked this as a duplicate of #1617 Dec 31, 2019
@mcspr mcspr closed this as completed Dec 31, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants