Skip to content

Crash and reboot when reaching getString() method #6688

Closed
@MateuszManaj

Description

@MateuszManaj

Basic Infos

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

Platform

  • Hardware: [nodeMCU dev board rev3]
  • Core Version: 2.5.2 (from added logs)
  • Development Env: [Arduino IDE]
  • Operating System: [MacOS]

Settings in IDE

  • Module: [Nodemcu]
  • Flash Mode: [don't know]
  • Flash Size: [4MB]
  • lwip Variant: [v2 Lower Memory]
  • Reset Method: [nodemcu]
  • Flash Frequency: [40Mhz]
  • CPU Frequency: [80Mhz]
  • Upload Using: [SERIAL]
  • Upload Speed: [115200] (serial upload only)

Problem Description

Board crashed when code reaching

String payload = http.getString();

Problem occurs when requesting GET from this host: http://192.168.8.218 - this is my stove webserver. For 1 month it was ok but now i cannot getting response. Other host working properly. I tried to change IP of webserver - nothing changed.

Tell me, what needs to happen for getString() method to crash and reboot board ?
In addtion, response from webserver is correct. All packets and whole response is ok.

MCVE Sketch

#include <Arduino.h>

#include <ESP8266WiFi.h>
#include <ESP8266WiFiMulti.h>

#include <ESP8266HTTPClient.h>

#include <WiFiClient.h>

ESP8266WiFiMulti WiFiMulti;

void setup() {

  Serial.begin(115200);
  // Serial.setDebugOutput(true);

  Serial.println();
  Serial.println();
  Serial.println();

  for (uint8_t t = 4; t > 0; t--) {
    Serial.printf("[SETUP] WAIT %d...\n", t);
    Serial.flush();
    delay(1000);
  }

  WiFi.mode(WIFI_STA);
  WiFiMulti.addAP("ABC", "DEF");

}

void loop() {
  // wait for WiFi connection
  if ((WiFiMulti.run() == WL_CONNECTED)) {

    WiFiClient client;

    HTTPClient http;

    Serial.print("[HTTP] begin...\n");
    if (http.begin(client, "http://192.168.8.218")) {  // HTTP


      Serial.print("[HTTP] GET...\n");
      // start connection and send HTTP header
      int httpCode = http.GET();

      // httpCode will be negative on error
      if (httpCode > 0) {
        // HTTP header has been send and Server response header has been handled
        Serial.printf("[HTTP] GET... code: %d\n", httpCode);

        // file found at server
        if (httpCode == HTTP_CODE_OK || httpCode == HTTP_CODE_MOVED_PERMANENTLY) {
          String payload = http.getString();
          Serial.println(payload);
        }
      } else {
        Serial.printf("[HTTP] GET... failed, error: %s\n", http.errorToString(httpCode).c_str());
      }

      http.end();
    } else {
      Serial.printf("[HTTP} Unable to connect\n");
    }
  }

  delay(10000);
}

Debug Messages

Decoding stack results
0x4021850c: mem_malloc at core/mem.c line 210
0x40206e3c: malloc(size_t) at /Users/mateuszmanaj/Library/Arduino15/packages/esp8266/hardware/esp8266/2.5.2/cores/esp8266/umm_malloc/umm_malloc.cpp line 1677
0x40210fac: lwip_cyclic_timer at core/timeouts.c line 233
0x4021850c: mem_malloc at core/mem.c line 210
0x4020f8e8: do_memp_malloc_pool at core/memp.c line 254
0x4020f924: memp_malloc at core/memp.c line 356
0x40210f51: sys_timeout_abs at core/timeouts.c line 189
0x40210fac: lwip_cyclic_timer at core/timeouts.c line 233
0x40210fdf: lwip_cyclic_timer at core/timeouts.c line 261
0x4020f94e: memp_free at core/memp.c line 447
0x40211154: sys_check_timeouts at core/timeouts.c line 390
0x4020551f: loop_task(ETSEvent*) at /Users/mateuszmanaj/Library/Arduino15/packages/esp8266/hardware/esp8266/2.5.2/cores/esp8266/core_esp8266_main.cpp line 133
0x4020f221: glue2esp_linkoutput at glue-esp/lwip-esp.c line 299
0x4020f4a3: new_linkoutput at glue-lwip/lwip-git.c line 235
0x4020f894: ethernet_output at netif/ethernet.c line 312
0x4021702c: etharp_output_LWIP2 at core/ipv4/etharp.c line 885
0x4020555a: esp_yield() at /Users/mateuszmanaj/Library/Arduino15/packages/esp8266/hardware/esp8266/2.5.2/cores/esp8266/core_esp8266_main.cpp line 88
0x40213dfd: tcp_output_alloc_header at core/tcp_out.c line 1863
0x40214750: tcp_send_empty_ack at core/tcp_out.c line 2057
0x4021483e: tcp_output at core/tcp_out.c line 1319
0x402046c4: String::copy(char const*, unsigned int) at /Users/mateuszmanaj/Library/Arduino15/packages/esp8266/hardware/esp8266/2.5.2/cores/esp8266/WString.cpp line 211
0x40205564: esp_yield() at /Users/mateuszmanaj/Library/Arduino15/packages/esp8266/hardware/esp8266/2.5.2/cores/esp8266/core_esp8266_main.cpp line 91
0x40205564: esp_yield() at /Users/mateuszmanaj/Library/Arduino15/packages/esp8266/hardware/esp8266/2.5.2/cores/esp8266/core_esp8266_main.cpp line 91
0x40205646: __yield() at /Users/mateuszmanaj/Library/Arduino15/packages/esp8266/hardware/esp8266/2.5.2/cores/esp8266/core_esp8266_main.cpp line 100
0x4020430d: Stream::timedRead() at /Users/mateuszmanaj/Library/Arduino15/packages/esp8266/hardware/esp8266/2.5.2/cores/esp8266/Stream.cpp line 37
0x4020434b: Stream::readBytes(char*, unsigned int) at /Users/mateuszmanaj/Library/Arduino15/packages/esp8266/hardware/esp8266/2.5.2/cores/esp8266/Stream.cpp line 211
0x40207380: Stream::readBytes(unsigned char*, unsigned int) at /Users/mateuszmanaj/Library/Arduino15/packages/esp8266/hardware/esp8266/2.5.2/cores/esp8266/Stream.h line 92
0x40203528: HTTPClient::writeToStreamDataBlock(Stream*, int) at /Users/mateuszmanaj/Library/Arduino15/packages/esp8266/hardware/esp8266/2.5.2/libraries/ESP8266HTTPClient/src/ESP8266HTTPClient.cpp line 1376
0x402035b0: HTTPClient::writeToStream(Stream*) at /Users/mateuszmanaj/Library/Arduino15/packages/esp8266/hardware/esp8266/2.5.2/libraries/ESP8266HTTPClient/src/ESP8266HTTPClient.cpp line 925
0x40204704: String::String(char const*) at /Users/mateuszmanaj/Library/Arduino15/packages/esp8266/hardware/esp8266/2.5.2/cores/esp8266/WString.cpp line 36
0x40203d7e: HTTPClient::getString() at /Users/mateuszmanaj/Library/Arduino15/packages/esp8266/hardware/esp8266/2.5.2/libraries/ESP8266HTTPClient/src/ESP8266HTTPClient.cpp line 1010
0x4020117f: loop() at /Users/mateuszmanaj/Documents/Arduino/BasicHttpClient/BasicHttpClient.ino line 62
0x402018ac: ESP8266WiFiMulti::addAP(char const*, char const*) at /Users/mateuszmanaj/Library/Arduino15/packages/esp8266/hardware/esp8266/2.5.2/libraries/ESP8266WiFi/src/ESP8266WiFiMulti.cpp line 39
0x40205614: loop_wrapper() at /Users/mateuszmanaj/Library/Arduino15/packages/esp8266/hardware/esp8266/2.5.2/cores/esp8266/core_esp8266_main.cpp line 125

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