Skip to content

HTTPClient mystery crash after http.end(), why? #7613

@aldoaldoaldo

Description

@aldoaldoaldo

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: [ESP-12S|
  • Core Version: [2.7.4]
  • Development Env: [Arduino IDE]
  • Operating System: [Windows]

Settings in IDE

  • Module: [Nodemcu]
  • Flash Mode: [qio|dio|other]
  • Flash Size: [4MB]
  • lwip Variant: [v1.4 Higher Bandwidth]
  • Reset Method: [ck|nodemcu]
  • Flash Frequency: [40Mhz]
  • CPU Frequency: [80Mhz]
  • Upload Using: [OTA|SERIAL]
  • Upload Speed: [115200|other] (serial upload only)

Problem Description

This is within a biggest project were I am running the standard sync webserver.
To exclude cross-errors, anyway, I wrote this simple test procedure that is called at a certain time from loop()
The ESP is 192.168.1.11 and it's connected to my wifi router, while 192.168.1.12 is another ESP connected to the same wifi.
The GET call is a success (I see it OK on the receiver), but as you see the "logg" after http.end is not called and instead there is a restart (this implies a crash...).
Heap space is good and >40K you see is logged; logg() is a my years old log procedure.
I see no reasons for crash ???!???!?!???!

NOTICE:1: The mother of that procedure used to work (months ago while I used 2.4.2 or so on all my projects) - so this may be caused by the web response of the other ESP (maybe at tcp level this is changed from 2.4.2 to 2.7.4) but in any case a http client proc is expected to NOT crash depending on server reply.

NOTICE2: With surl="http://termoeasy.com/1.txt" no crashes, this would prove true NOTICE1.

NOTICE3: I have another similar proc that uses a Stream instead a string, and I noticed it is SLOWED DOWN terribly when I download a series of (very short) files from web, after I upgraded to 2.7.2 (today 2.7.4 and recompiled before doing this report).

MCVE Sketch

void testsend()
{
      HTTPClient http;
      String surl="http://192.168.1.12/x?&id=1046&n=TS46&w=1&b=26&dm=15&pw=pippo&r=CE6400&t=-12700&h=0";
      logg(surl+"<< TEST");
      http.begin(surl);
      logg("after begin");
      int httpcode= http.GET();
      logg("after GET");
      String s=http.getString();
      logg(s+"<< s - after getString");
      http.end();
      logg(String(httpcode)+"; (after end) s="+s);
}

loop()
{
  deledc(50);  //somewhat like delay but calls dns/web service
  ....
  switch (azione)
  {
    case AZ_TESTSEND:
      {
        deledc(2000);
        testsend();
        azione=AZ_DO_NOTHING;
        break;
      }
    //AZ_DO_NOTHING;
    default:
  }

}

Debug Messages

this is the log:
[2020-09-26 22:22.02] G 18az >42608
http://192.168.1.12/x?&id=1046&n=TS46&w=1&b=26&dm=15&pw=pippo&r=CE6400&t=-12700&h=0<< TEST
[2020-09-26 22:22.02] G 18az >42672
after begin
[2020-09-26 22:22.02] G 18az >42360
after GET
[2020-09-26 22:22.02] G 18az >42200
RXOK<< s - after getString
[1970-00-00 00:00.00] G 99az >44824
(setup)WiFi.scanNetworks started
[1970-00-00 00:00.00] G 99az >44840
##############################

  START START START START
##############################
[2020-09-26 22:22.07] G -1az >43736
(wifiEndScanAction)

Metadata

Metadata

Assignees

No one assigned

    Labels

    waiting for feedbackWaiting on additional info. If it's not received, the issue may be closed.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions