esp8266 / esp8266/Arduino

HTTPClient::Get leads to exception 9

Open
#8,557 15 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
16.7k
Forks
13.1k
PR merge metrics
No merged PRs in 30d

Description

### Basic Infos

- [ x] This issue complies with the [issue POLICY doc](https://github.com/esp8266/Arduino/blob/master/POLICY.md).
- [ x I have read the documentation at [readthedocs](https://arduino-esp8266.readthedocs.io/en/latest) 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: Node MCU 1.0
- Core Version: Refreshed 5 days ago
- Development Env: [Arduino IDE]
- Operating System: [Windows]

### Settings in IDE

- Module: [ESP12-E]
- Flash Mode: [qio]
- Flash Size: [4MB]
- lwip Variant: [v2 Lower Memory]
- Reset Method: [ck|nodemcu]
- Flash Frequency: [40Mhz probably
- CPU Frequency: [80Mhz]
- Upload Using: [SERIAL]
- Upload Speed: [115200|other])

### Problem Description

HTTPClient GET leads to exception 9

### [MCVE](https://stackoverflow.com/help/mcve) Sketch
Not yet available. This occurred in full application - fairly large. Current MCVE has not shown this error. For now I've included the corresponding function
```
bool OtaUpdate::RlyOnOff(bool OnOff, uint8_t relNo){
//relNo is for future expansion, requires multiple swtichIPs
Serial.println("RlyOnOFf1");
int pass = 0;
int httpCode = 0;
httpSW.setReuse(true);
sprintf_P(MTemp, "%s%s:%d%s" ,string_urlBase,switchIP,HTTPport,string_switchCmd);
strcat(MTemp,"_");
if(OnOff){
strcat_P(MTemp, string_on);
} else {
strcat_P(MTemp,string_off);
}
Serial.println(MTemp);
httpSW.begin(client, MTemp);
httpCode = httpSW.GET();
if ((httpCode > 0)){
httpSW.writeToStream(&Serial);
Serial.println(" ");
Debug.print(DBG_INFO, F("HTTP %d"), httpCode);
httpSW.end();
return true;
} else {
Debug.print(DBG_ERROR, F("HTTP GET invalid response http code %d %s"),httpCode, httpSW.errorToString(httpCode).c_str());
// something wrong with connection, try to reconnect
httpSW.end();
return false;
}
}
```

### Debug Messages

```
12:55:11.134 -> [hostByName] request IP for: us.pool.ntp.org
12:55:11.134 -> [hostByName] Host: us.pool.ntp.org IP: 45.33.68.112
12:55:11.228 -> Hum OnOff 1
12:55:11.228 -> Hum Relay test ota.SWconn 1
12:55:11.228 -> RlyOnOFf1
```
Next line corresponds to the code: Serial.println(MTemp);
```
12:55:11.228 -> http://192.168.0.28:80/cm?cmnd=Power_On
12:55:11.228 -> [HTTP-Client][begin] url: http://192.168.0.28:80/cm?cmnd=Power_On
12:55:11.228 -> [HTTP-Client][begin] host: 192.168.0.28 port: 80 url: /cm?cmnd=Power_On
12:55:11.274 -> [HTTP-Client][sendRequest] type: 'GET' redirCount: 0
12:55:11.274 -> [hostByName] Host: 192.168.0.28 is a IP!
12:55:11.274 -> :ref 1
12:55:11.274 -> Fatal exception 9(LoadStoreAlignmentCause):
12:55:11.274 -> epc1=0x4010652c, epc2=0x00000000, epc3=0x00000000, excvaddr=0x00000003, depc=0x00000000
12:55:11.274 ->
12:55:11.274 -> --------------- CUT HERE FOR EXCEPTION DECODER ---------------
```
The decoded exception
```
Exception 9: LoadStoreAlignmentCause: Load or store to an unaligned address
PC: 0x4010652c
EXCVADDR: 0x00000003

Decoding stack results
0x40100609: millis() at E:\Development\Arduino\hardware\esp8266com\esp8266\cores\esp8266\core_esp8266_wiring.cpp line 174
0x4022787c: __esp_delay(unsigned long) at E:\Development\Arduino\hardware\esp8266com\esp8266\cores\esp8266\core_esp8266_main.cpp line 152
0x402278cf: esp_try_delay(unsigned int, unsigned int, unsigned int) at E:\Development\Arduino\hardware\esp8266com\esp8266\cores\esp8266\core_esp8266_main.cpp line 171
0x40218fa9: WiFiClient::connect(IPAddress, unsigned short) at E:\Development\Arduino\hardware\esp8266com\esp8266\cores\esp8266/coredecls.h line 66
0x40101476: umm_free(void*) at E:\Development\Arduino\hardware\esp8266com\esp8266\cores\esp8266\umm_malloc\umm_malloc.cpp line 688
0x40218ec0: WiFiClient::connect(IPAddress, unsigned short) at E:\Development\Arduino\hardware\esp8266com\esp8266\libraries\ESP8266WiFi\src\WiFiClient.cpp line 149
0x40218500: WiFiClient::connect(char const*, unsigned short) at E:\Development\Arduino\hardware\esp8266com\esp8266\libraries\ESP8266WiFi\src\WiFiClient.cpp line 137
0x4021f362: HTTPClient::beginInternal(String const&, char const*) at E:\Development\Arduino\hardware\esp8266com\esp8266\cores\esp8266/WString.h line 115
0x4021e8d7: HTTPClient::connect() at E:\Development\Arduino\hardware\esp8266com\esp8266\cores\esp8266/WString.h line 348
0x4021f4cc: HTTPClient::sendRequest(char const*, unsigned char const*, unsigned int) at E:\Development\Arduino\hardware\esp8266com\esp8266\libraries\ESP8266HTTPClient\src\ESP8266HTTPClient.cpp line 459
0x401010e9: check_poison_neighbors(umm_heap_context_t*, uint16_t) at E:\Development\Arduino\hardware\esp8266com\esp8266\cores\esp8266\umm_malloc/umm_local.c line 72
0x40101138: umm_free_core(umm_heap_context_t*, void*) at E:\Development\Arduino\hardware\esp8266com\esp8266\cores\esp8266\umm_malloc\umm_malloc.cpp line 642
0x40101494: umm_poison_free_fl(void*, char const*, int) at E:\Development\Arduino\hardware\esp8266com\esp8266\cores\esp8266\umm_malloc/umm_local.c line 157
0x4021f666: HTTPClient::GET() at E:\Development\Arduino\hardware\esp8266com\esp8266\libraries\ESP8266HTTPClient\src\ESP8266HTTPClient.cpp line 370
0x4020e053: OtaUpdate::RlyOnOff(bool, unsigned char) at C:\Users\ddueh\AppData\Local\Temp\arduino_build_6196\sketch\otaUpdate.cpp line 77
0x4020b49d: humOnOff(unsigned char) at C:\Users\ddueh\AppData\Local\Temp\arduino_build_6196\sketch\boardconfig.cpp line 48
```
The above starts with the the previous stack push and corresponds to the debug output at 12:55:11:228 Hum OnOff1
```
0x402090ac: std::_Function_handler >::_M_invoke(const std::_Any_data &, AsyncWebServerRequest *&&) at C:\Users\ddueh\AppData\Local\Temp\arduino_build_6196\sketch\WebUI.cpp line 211
0x4022652a: String::operator=(String&&) at E:\Development\Arduino\hardware\esp8266com\esp8266\cores\esp8266\WString.cpp line 296
0x40214644: AsyncWebServerRequest::_parsePlainPostChar(unsigned char) at E:\Development\Arduino\hardware\esp8266com\esp8266\cores\esp8266/WString.h line 115
0x40216e80: AsyncCallbackWebHandler::handleRequest(AsyncWebServerRequest*) at e:\development\arduino\hardware\esp8266com\esp8266\tools\xtensa-lx106-elf\xtensa-lx106-elf\include\c++\10.3.0\bits/std_function.h line 617
0x40226d3e: String::startsWith(char const*) const at E:\Development\Arduino\hardware\esp8266com\esp8266\cores\esp8266/WString.h line 115
0x40214e80: AsyncWebServerRequest::_onData(void*, unsigned int) at E:\Development\Arduino\libraries\ESPAsyncWebServer-master\src\WebRequest.cpp line 173
0x40100609: millis() at E:\Development\Arduino\hardware\esp8266com\esp8266\cores\esp8266\core_esp8266_wiring.cpp line 174
0x40214ed4: std::_Function_handler >::_M_invoke(const std::_Any_data &, void *&&, AsyncClient *&&, void *&&, unsigned int &&) at E:\Development\Arduino\libraries\ESPAsyncWebServer-master\src\WebRequest.cpp line 76
0x40211c84: AsyncClient::_recv(std::shared_ptr &, tcp_pcb*, pbuf*, long) at E:\Development\Arduino\libraries\ESPAsyncTCP-master\src/ESPAsyncTCP.h line 103
0x40211ce8: AsyncClient::_s_recv(void*, tcp_pcb*, pbuf*, long) at e:\development\arduino\hardware\esp8266com\esp8266\tools\xtensa-lx106-elf\xtensa-lx106-elf\include\c++\10.3.0\bits/shared_ptr_base.h line 1324
0x4023aacd: tcp_input at core/tcp_in.c line 501
0x40101054: check_poison_block(umm_block*) at E:\Development\Arduino\hardware\esp8266com\esp8266\cores\esp8266\umm_malloc/umm_poison.c line 99
0x40240701: ip4_input at core/ipv4/ip4.c line 1467
0x40101476: umm_free(void*) at E:\Development\Arduino\hardware\esp8266com\esp8266\cores\esp8266\umm_malloc\umm_malloc.cpp line 688
0x40237091: ethernet_input_LWIP2 at netif/ethernet.c line 188
0x40236e90: esp2glue_ethernet_input at glue-lwip/lwip-git.c line 118
0x4025fa11: ethernet_input at glue-esp/lwip-esp.c line 365
0x4025fa23: ethernet_input at glue-esp/lwip-esp.c line 373
0x40100c58: mmu_wrap_irom_fn(void (*)()) at E:\Development\Arduino\hardware\esp8266com\esp8266\cores\esp8266\mmu_iram.cpp line 205
0x401000b3: app_entry_redefinable() at E:\Development\Arduino\hardware\esp8266com\esp8266\cores\esp8266\core_esp8266_main.cpp line 375
0x4010023c: ets_post(uint8, ETSSignal, ETSParam) at E:\Development\Arduino\hardware\esp8266com\esp8266\cores\esp8266\core_esp8266_main.cpp line 227
0x4010023c: ets_post(uint8, ETSSignal, ETSParam) at E:\Development\Arduino\hardware\esp8266com\esp8266\cores\esp8266\core_esp8266_main.cpp line 227
0x4010023c: ets_post(uint8, ETSSignal, ETSParam) at E:\Development\Arduino\hardware\esp8266com\esp8266\cores\esp8266\core_esp8266_main.cpp line 227
0x4022403c: EspClass::flashRead(unsigned int, unsigned int*, unsigned int) at E:\Development\Arduino\hardware\esp8266com\esp8266\cores\esp8266\Esp.cpp line 956
0x402240c9: EspClass::flashRead(unsigned int, unsigned char*, unsigned int) at E:\Development\Arduino\hardware\esp8266com\esp8266\cores\esp8266\Esp.cpp line 935
0x401002a2: __wrap_spi_flash_read(uint32_t, uint32_t*, size_t) at E:\Development\Arduino\hardware\esp8266com\esp8266\cores\esp8266\core_esp8266_phy.cpp line 309
0x4022403c: EspClass::flashRead(unsigned int, unsigned int*, unsigned int) at E:\Development\Arduino\hardware\esp8266com\esp8266\cores\esp8266\Esp.cpp line 956
0x402240c9: EspClass::flashRead(unsigned int, unsigned char*, unsigned int) at E:\Development\Arduino\hardware\esp8266com\esp8266\cores\esp8266\Esp.cpp line 935
0x401002a2: __wrap_spi_flash_read(uint32_t, uint32_t*, size_t) at E:\Development\Arduino\hardware\esp8266com\esp8266\cores\esp8266\core_esp8266_phy.cpp line 309
0x4022403c: EspClass::flashRead(unsigned int, unsigned int*, unsigned int) at E:\Development\Arduino\hardware\esp8266com\esp8266\cores\esp8266\Esp.cpp line 956
0x402240c9: EspClass::flashRead(unsigned int, unsigned char*, unsigned int) at E:\Development\Arduino\hardware\esp8266com\esp8266\cores\esp8266\Esp.cpp line 935
0x401002a2: __wrap_spi_flash_read(uint32_t, uint32_t*, size_t) at E:\Development\Arduino\hardware\esp8266com\esp8266\cores\esp8266\core_esp8266_phy.cpp line 309
0x4022403c: EspClass::flashRead(unsigned int, unsigned int*, unsigned int) at E:\Development\Arduino\hardware\esp8266com\esp8266\cores\esp8266\Esp.cpp line 956
0x401002a2: __wrap_spi_flash_read(uint32_t, uint32_t*, size_t) at E:\Development\Arduino\hardware\esp8266com\esp8266\cores\esp8266\core_esp8266_phy.cpp line 309
0x402240c9: EspClass::flashRead(unsigned int, unsigned char*, unsigned int) at E:\Development\Arduino\hardware\esp8266com\esp8266\cores\esp8266\Esp.cpp line 935
0x4010023c: ets_post(uint8, ETSSignal, ETSParam) at E:\Development\Arduino\hardware\esp8266com\esp8266\cores\esp8266\core_esp8266_main.cpp line 227
0x4010023c: ets_post(uint8, ETSSignal, ETSParam) at E:\Development\Arduino\hardware\esp8266com\esp8266\cores\esp8266\core_esp8266_main.cpp line 227
0x401002a2: __wrap_spi_flash_read(uint32_t, uint32_t*, size_t) at E:\Development\Arduino\hardware\esp8266com\esp8266\cores\esp8266\core_esp8266_phy.cpp line 309
0x4022403c: EspClass::flashRead(unsigned int, unsigned int*, unsigned int) at E:\Development\Arduino\hardware\esp8266com\esp8266\cores\esp8266\Esp.cpp line 956
0x401002a2: __wrap_spi_flash_read(uint32_t, uint32_t*, size_t) at E:\Development\Arduino\hardware\esp8266com\esp8266\cores\esp8266\core_esp8266_phy.cpp line 309
0x402240c9: EspClass::flashRead(unsigned int, unsigned char*, unsigned int) at E:\Development\Arduino\hardware\esp8266com\esp8266\cores\esp8266\Esp.cpp line 935
0x4022403c: EspClass::flashRead(unsigned int, unsigned int*, unsigned int) at E:\Development\Arduino\hardware\esp8266com\esp8266\cores\esp8266\Esp.cpp line 956
0x402240c9: EspClass::flashRead(unsigned int, unsigned char*, unsigned int) at E:\Development\Arduino\hardware\esp8266com\esp8266\cores\esp8266\Esp.cpp line 935
0x40223e50: EspClass::flashWrite(unsigned int, unsigned int const*, unsigned int) at E:\Development\Arduino\hardware\esp8266com\esp8266\cores\esp8266\Esp.cpp line 833
0x40223e50: EspClass::flashWrite(unsigned int, unsigned int const*, unsigned int) at E:\Development\Arduino\hardware\esp8266com\esp8266\cores\esp8266\Esp.cpp line 833
0x40234238: __ssputs_r at /workdir/repo/newlib/newlib/libc/stdio/nano-vfprintf.c line 232
0x4010023c: ets_post(uint8, ETSSignal, ETSParam) at E:\Development\Arduino\hardware\esp8266com\esp8266\cores\esp8266\core_esp8266_main.cpp line 227
0x40234238: __ssputs_r at /workdir/repo/newlib/newlib/libc/stdio/nano-vfprintf.c line 232
0x40234439: _svfprintf_r at /workdir/repo/newlib/newlib/libc/stdio/nano-vfprintf.c line 528
0x4010023c: ets_post(uint8, ETSSignal, ETSParam) at E:\Development\Arduino\hardware\esp8266com\esp8266\cores\esp8266\core_esp8266_main.cpp line 227
0x402314f1: _vsnprintf_r at /workdir/repo/newlib/newlib/libc/stdio/vsnprintf.c line 71
0x40236a85: glue2esp_linkoutput at glue-esp/lwip-esp.c line 301
0x401014b8: umm_malloc(size_t) at E:\Development\Arduino\hardware\esp8266com\esp8266\cores\esp8266\umm_malloc\umm_malloc.cpp line 912
0x40236cb3: new_linkoutput at glue-lwip/lwip-git.c line 272
0x4023711e: ethernet_output at netif/ethernet.c line 312
0x4023ef6c: etharp_output_to_arp_index at core/ipv4/etharp.c line 769
0x4022937c: uart_write(uart_t*, char const*, size_t) at E:\Development\Arduino\hardware\esp8266com\esp8266\cores\esp8266\uart.cpp line 547
0x4023f040: etharp_output_LWIP2 at core/ipv4/etharp.c line 885
0x40101054: check_poison_block(umm_block*) at E:\Development\Arduino\hardware\esp8266com\esp8266\cores\esp8266\umm_malloc/umm_poison.c line 99
0x40240920: ip4_output_if_opt_src at core/ipv4/ip4.c line 1764
0x40101279: umm_malloc_core(umm_heap_context_t*, size_t) at E:\Development\Arduino\hardware\esp8266com\esp8266\cores\esp8266\umm_malloc/umm_local.c line 47
0x40240952: ip4_output_if_src at core/ipv4/ip4.c line 1589
0x4023720b: ip_chksum_pseudo at core/inet_chksum.c line 392
0x4023b9fc: udp_sendto_if_src at core/udp.c line 893
0x40101054: check_poison_block(umm_block*) at E:\Development\Arduino\hardware\esp8266com\esp8266\cores\esp8266\umm_malloc/umm_poison.c line 99
0x401010e9: check_poison_neighbors(umm_heap_context_t*, uint16_t) at E:\Development\Arduino\hardware\esp8266com\esp8266\cores\esp8266\umm_malloc/umm_local.c line 72
0x40101138: umm_free_core(umm_heap_context_t*, void*) at E:\Development\Arduino\hardware\esp8266com\esp8266\cores\esp8266\umm_malloc\umm_malloc.cpp line 642
0x40227747: __esp_suspend() at E:\Development\Arduino\hardware\esp8266com\esp8266\cores\esp8266/core_esp8266_features.h line 65
0x4022788a: __esp_delay(unsigned long) at E:\Development\Arduino\hardware\esp8266com\esp8266\cores\esp8266\core_esp8266_main.cpp line 158
0x402285b4: __delay(unsigned long) at E:\Development\Arduino\hardware\esp8266com\esp8266\cores\esp8266\core_esp8266_wiring.cpp line 37
0x40219abe: NTPClient::forceUpdate() at E:\Development\Arduino\libraries\NTPClient\NTPClient.cpp line 75
0x40219b62: NTPClient::update() at E:\Development\Arduino\libraries\NTPClient\NTPClient.cpp line 99
0x4020582f: sec30Update() at C:\Users\ddueh\AppData\Local\Temp\arduino_modified_sketch_629138/MushBox.ino line 249
0x402058e2: loop() at C:\Users\ddueh\AppData\Local\Temp\arduino_modified_sketch_629138/MushBox.ino line 157
0x4022794c: loop_wrapper() at E:\Development\Arduino\hardware\esp8266com\esp8266\cores\esp8266\core_esp8266_main.cpp line 247
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.