Skip to content

ESP8266 crashes while HTTPClient fails to connect #8513

New issue

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

By clicking “No 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? No Sign in to your account

Open
6 tasks done
BrotherV opened this issue Mar 16, 2022 · 19 comments
Open
6 tasks done

ESP8266 crashes while HTTPClient fails to connect #8513

BrotherV opened this issue Mar 16, 2022 · 19 comments

Comments

@BrotherV
Copy link

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: ESP-12E
  • Core Version: 3.2.0
  • Development Env: Platformio
  • Operating System: Windows

Settings in IDE

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

Problem Description

I wrote a program to send data with AWS4 protocol to AWS and I have to use WiFiClientSecure since AWS accept SSL connection. The ESP8266 works fine and it creates signature based the JSON packet, however, after sending data to the server, HTTPClient fails to connect to the server and after that when system attempts to send data again, the ESP8266 crashes.

MCVE Sketch

#include <Arduino.h>
#include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>
#include <ArduinoJson.h>
#include "AWSClient4.h"

#define Log_M(s) Serial.println(F(s))

HTTPClient httpClient;
WiFiClientSecure client;

AWSClient4 aws4;
DateTimeProvider dateTimeProvider;

const char *ssid = "SSID1234";
const char *password = "@Password$";
const char *awsAccessKey = "awsAccessKey ";
const char *awsSecretKey = "awsSecretKey ";
const char *awsDomain = "awsDomain ";
const char *awsPath = "awsPath ";
const char *awsEndpoint = "amazonaws.com";
const char *awsRegion = "ca-central-1";
const char *url = "https://*********************.amazonaws.com/***********";
char *json;

void connectToWiFi()
{
            Serial.print("Connecting to ");
            Serial.println(ssid);
            WiFi.begin(ssid, password);

            while (WiFi.status() != WL_CONNECTED)
            {
                        delay(500);
                        Serial.print(".");
            }
            Log_M("");
            Log_M("WiFi connected");
            Log_M("IP address: ");
            Serial.println(WiFi.localIP());
}

void sendPacket()
{
            Log_M("Send Packet called");
            httpClient.setTimeout(6000);
            // Your Domain name with URL path or IP address with path
            httpClient.begin(client, url);
            httpClient.addHeader("Content-Type", "application/json");
            httpClient.addHeader("x-amz-content-sha256", aws4.getPayloadHash());
            httpClient.addHeader("x-amz-date", aws4.getDateTime());
            httpClient.addHeader("Authorization", aws4.getAuthorization());

            Log_M("Sending data to the server");
            int httpResponseCode = httpClient.POST(json);
            if (httpResponseCode > 0)
            {
                        // HTTP header has been send and Server response header has been handled
                        Serial.printf("[HTTP] POST... code: %d\n", httpResponseCode);

                        // file found at server
                        if (httpResponseCode == HTTP_CODE_OK)
                        {
                                    const String &payload = httpClient.getString();
                                    Log_M("received payload:\n<<");
                                    Serial.println(payload);
                                    Log_M(">>");
                        }
                        else if (httpResponseCode == HTTP_CODE_FORBIDDEN)
                        {
                                    Log_M("Access denied");
                        }
                        else if (httpResponseCode == HTTP_CODE_BAD_REQUEST)
                        {
                                    Log_M("Bad request");
                        }
                        else
                        {
                                    Serial.printf("[HTTP] POST... failed, error: %s\n", httpClient.errorToString(httpResponseCode).c_str());
                        }
            }
            else
            {
                        Log_M("Failed to connect");
            }

            // Free resources
            httpClient.end();
            Log_M("HTTP closed");
}

void setup() {
            Serial.begin(115200);
            delay(100);

            aws4.setQuery("");
            aws4.setMethod("POST");
            aws4.setContentType("application/json");
            aws4.setSignedHeaders("content-length;content-type;host;x-amz-content-sha256;x-amz-date");
            aws4.setAWSRegion(awsRegion);
            aws4.setAWSEndpoint(awsEndpoint);
            aws4.setAWSDomain(awsDomain);
            aws4.setAWSPath(awsPath_intro);
            aws4.setAWSService("*********");
            aws4.setAWSKeyID(awsAccessKey);
            aws4.setAWSSecretKey(awsSecretKey);
            aws4.setDateTimeProvider(&dateTimeProvider);
            // Connect to WAP
            connectToWiFi();

            //
            client.setInsecure();

            json = new char[196]();
            DynamicJsonDocument doc(196);
            doc["cid"] = 1989;
            doc["stationId"] = 10;
            doc["deviceType"] = 0;
            doc["mac"] = WiFi.macAddress();

            // Generate the minified JSON and send it to the Serial port.
            serializeJson(doc, json, 196);
            Serial.printf("\n\nJSON Command: %s", json);
}

void loop() {
            Log_M("\n\nMain loop called");
            ///**************************************************************
            aws4.createSignature(json);
            Serial.println(aws4.getSignature());

            sendPacket();
            aws4.clearCach();
            Log_M("AWS cash cleared");

            delay(30000);
}

Debug Messages

Main loop called
Send Packet called
Sending data to the server
[HTTP] POST... code: 200
received payload:
<<
{"Blocked": false, "Date": "2022:03:16:15:13:57"}
>>
HTTP closed
AWS cash cleared


Main loop called
Send Packet called
Sending data to the server
[HTTP] POST... code: 200
received payload:
<<
{"Blocked": false, "Date": "2022:03:16:15:14:29"}
>>
HTTP closed
AWS cash cleared


Main loop called
Send Packet called
Sending data to the server
[HTTP] POST... code: 200
received payload:
<<
{"Blocked": false, "Date": "2022:03:16:15:15:01"}
>>
HTTP closed
AWS cash cleared


Main loop called
Send Packet called
Sending data to the server
[HTTP] POST... code: 200
received payload:
<<
{"Blocked": false, "Date": "2022:03:16:15:15:33"}
>>
HTTP closed
AWS cash cleared


Main loop called
Send Packet called
Sending data to the server
[HTTP] POST... code: 200
received payload:
<<
{"Blocked": false, "Date": "2022:03:16:15:16:05"}
>>
HTTP closed
AWS cash cleared


Main loop called
Send Packet called
Sending data to the server
[HTTP] POST... code: 200
received payload:
<<
{"Blocked": false, "Date": "2022:03:16:15:16:37"}
>>
HTTP closed
AWS cash cleared


Main loop called
Send Packet called
Sending data to the server
Failed to connect
HTTP closed
AWS cash cleared


Main loop called
Send Packet called
Sending data to the server


User exception (panic/abort/assert)
--------------- CUT HERE FOR EXCEPTION DECODER ---------------

Unhandled C++ exception: OOM

>>>stack>>>

ctx: cont
sp: 3ffffc90 end: 3fffffc0 offset: 0000
3ffffc90:  402658a0 0000010d 000001bb 00000030  
3ffffca0:  000000fe 00000000 00000000 00000000  
3ffffcb0:  00000000 00000000 00000000 00000001  
3ffffcc0:  00007fff 00000000 c030c02c 00000000  
3ffffcd0:  00000000 40210717 000005d8 402170de  
3ffffce0:  00000000 40210717 00000020 402170fd  
3ffffcf0:  c02ac026 c00ec004 000005d8 40216874  
3ffffd00:  c09dc09c 00000001 3fff14bc 40210717  
3ffffd10:  00000000 c00dc003 3fff000a 40210384  
3ffffd20:  00000000 00000000 00000d60 3fff47ec  
3ffffd30:  00000000 3fff4d2c 3fff14bc 40210bb9  
3ffffd40:  0000010d 3fff0714 00000001 40216af0  
3ffffd50:  00000000 00000000 000001bb 40217786  
3ffffd60:  00000000 3fffbd04 3fff14bc 4020fc02  
3ffffd70:  3fffb5c4 00000000 3ffffe24 3ffe9782  
3ffffd80:  000001bb 3fff47ec 3fff14bc 3ffe9782  
3ffffd90:  000001bb 3fff47ec 3fff14bc 40210d45  
3ffffda0:  4021aca4 095f3c34 4021aca4 095f3c34  
3ffffdb0:  3fff4838 00000000 3ffeff40 402191ea  
3ffffdc0:  00000000 00000000 3ffeff40 40213311  
3ffffdd0:  00000000 00000084 3ffeff40 40213d5a  
3ffffde0:  00000000 00000002 3ffe9154 3ffefc88  
3ffffdf0:  3fff454c 00000090 3ffffe60 40215bc5  
3ffffe00:  00000000 00000020 3fff4834 3ffefc88  
3ffffe10:  3fffbab4 3ffe9153 00000001 00000000  
3ffffe20:  3fff454c 00000084 3ffffe60 3ffefc88  
3ffffe30:  3ffefce4 3ffeff40 3fffbab4 40213e9a  
3ffffe40:  3ffefce4 3fff454c 3ffffe60 40213eca  
3ffffe50:  3ffefce4 3ffeff40 3fff0474 402085b3  
3ffffe60:  3fffbab4 0084008f 80000000 4020b6ab  
3ffffe70:  646e6553 74614420 61632061 33323100  
3ffffe80:  37363534 00003038 00000000 00000000  
3ffffe90:  00000000 00000000 3fffff10 3ffffe86  
3ffffea0:  00000000 00000000 00000009 0000000a  
3ffffeb0:  3fffff00 00000011 3fffff60 3fff0600  
3ffffec0:  3ffe97fa 3fff4164 00000000 000d000f  
3ffffed0:  00000000 00000011 3fffff60 3fff0600  
3ffffee0:  3ffe97fa 3fff4164 3fffff10 4020b8cc  
3ffffef0:  0000009f 00000089 3fff4244 3fff0600  
3fffff00:  00000180 00000000 3fff454c 4020b9ac  
3fffff10:  3fff46cc 3fff45d0 00000084 3fff0600  
3fffff20:  3fffdad0 3fff32ac 3ffefc88 4020bbc7  
3fffff30:  40217f28 d02cfa9c 3fff40c4 3fff40d6  
3fffff40:  3fff4164 3fff4244 00000000 40214280  
3fffff50:  3fff4234 3fff4164 00000020 401015b4  
3fffff60:  3fff4214 3fffff38 00000000 3fff4224  
3fffff70:  3fffff38 00000000 3fff0474 40201c84  
3fffff80:  3fff1094 00000000 3fff0474 4020bc0f  
3fffff90:  3fffdad0 00000000 00000001 4020be01  
3fffffa0:  3fffdad0 00000000 3fff05ec 40216c10  
3fffffb0:  feefeffe feefeffe 3ffe85fc 40101409  
<<<stack<<<

last failed alloc call: 40210717(1496)

--------------- CUT HERE FOR EXCEPTION DECODER ---------------

last failed alloc caller: 0x40210717

@Pablo2048
Copy link

The stack trace is not decoded, but there is Unhandled C++ exception: OOM so I guess that there is not enough memory for SSL for some reason.

@BrotherV
Copy link
Author

@Pablo2048 Definitely yes, It crashes due to lack of memory. I use ESP exceptional decoder, however, it does not show anything, which is so wired. I enabled HTTPClient debugger in platformio.ini file, however, when it wants to POST the data it crashes and I can't see the logs.
When I use the local object of HTTPClient in the sendPacket() method, after 5 times sending data to the server, "WDT" reset the ESP because the HTTPClient goes to an infinite loop for the next time, while when I define HTTPClient as a global object, the ESP crashes after 5 or 7 times sending data. It only happens on WiFiClientSecure and WiFiClient does not have such a problem.

@Pablo2048
Copy link

Pablo2048 commented Mar 17, 2022

So why not dump free memory available especially around aws4.createSignature and aws.clearCach (probably some sort of clear cache?) so you can get the picture where the memory goes?
PS: You've write that the exception decoder "does not show anything" and it seems like you are using PIO - do you have debug build enabled?

@dduehren
Copy link

dduehren commented May 1, 2022

I just upgraded from 2.7.4 to 3.0.2 and working code now demonstrates very similar behavior. I get a lot of 00m(32)@WString.cpp in the serial port, then a soft WDT reset and a stack dump. Note this code ran just fine with 2.7.4 and I have not yet gone back in versions to find out when this was broken. Note, I'm using plain http so the idea that the secure stuff runs out of memory makes no sense.

I have to go right now, but I will provide more code when I return. I was building this MVCE to demonstrate another problem with httpClient not connecting to another 8266 in STA mode running a web server. In fact that's the failure to connect that caused this crash.

@dduehren
Copy link

dduehren commented May 2, 2022

This is probably just one of multiple problems with httpClient. My original goal was to have an 8266 send an http GET to a Tasmota switch without an intermediary like an MTTQ broker, an unworkable extra cost in the system I'm building. Tasmota is open source software for smart switches that run on 8266 and related platforms. But doing this over a common router platform, one STA configured 8266 trying to send a message to another STA configured 8266 that is running a web server. It always failed to connect. Then I built my own device running the ESP-Async Web Server code, and saw the same behavior. I could send commands from my browser to both of them, and they both responded properly. But if I tried to send the exact same information from the 8266 client , the connection always failed except for the very first time. Under 2.7.4 the main application that I have been building, the very first connection from the client 8266 to the server 8266 succeeded, but failed every time after that. No data could be captured on wireshark because there was no connection made.
Then I set up a Raspberry Pi web server and the same 8266 code that was failing against the 8266 based web server, worked.

I was in the process of preparing to open my own issue but had not run the code against the most recent 8266 code base. I first upgraded from 2.7.4 to 3.0.2 to see if possibly the issue had been resolved in a later release. Alas, 3.0.2 has a problem that doesn't exist under 2.7.4 that is very similar to the opening of this issue.
I have created a MVCE that can demonstrate all of the above behavior, except the initial success. The first version had a very simple wifi connection process, and it did not show the behavior of the httpClient succeeding to connect to my 8266 based web server the first time and failing after. At this point, the more complicated wifi connection is not showing the behavior of initial success , and leads to the the problem because it doesn't connect and leads to the crash/soft WDT.
I have uploaded two files files and pasted serial port output documents. Code will be uploaded in zip files because there are multiple files in each case. I plan on cutting and pasting the particular examples of connection and failure under different versions of the 8266, starting with 2.7.4 and then 3.0.2 and maybe later add other versions.
Platform, etc; NodeMCU1.0 (12-E), clock speed 80 MHz, 4MB Flash, SSL...HTTP_CLIENT....WIFI Running only HTTP
smartSwitch.zip
BasicHttpXfer.zip

The smartSwitch.zip is the target device running an simple web server. It will start in AP mode, allow you to enter ssid and password and the join the network.
The BasicHTTPXfer is the MVCE. It can be configured and run a couple of different ways. Look at the loop in the .ino file.
The ota.Register() function will reach out to a Digital Ocean based server (change settings in setup. h to point to the 147.182.231.246 address and set the server port to 80. This function should run successfully. This routine was chosen because it is close in functionality that is not working when targeting an 8266 based server. The otaUpdate classs in the MVCE has several fully functioning html and wifi.client modules that do ota update, upload log files, download html files, and register the devices with the server. All of that code works well under 2.7.4 and I have not tested failure modes with 3.0.2.
If you run BasicHTTPXfer against the SmartSwitch, it will fail and produce the behavior described in this and my previous post.
Next are some debug outputs under different conditions.

  1. The MVCE failing against the SmartSwitch running 2.7.4 followed by the register function succeeding.
10:56:38.798 -> Connecting to wifi
10:56:38.892 -> .Wifi Connected
10:56:39.408 -> Begin loop
10:56:39.408 -> RlyOnOff, Switch IP: 191.168.0.28
10:56:39.408 -> http://191.168.0.28:80/cm?cmnd=Power_On
10:56:39.408 -> [HTTP-Client][begin] url: http://191.168.0.28:80/cm?cmnd=Power_On
10:56:39.408 -> [HTTP-Client][begin] host: 191.168.0.28 port: 80 url: /cm?cmnd=Power_On
10:56:39.408 -> [HTTP-Client][sendRequest] type: 'GET' redirCount: 0
10:56:41.749 -> scandone
10:56:44.554 -> [HTTP-Client] failed connect to 191.168.0.28:80
10:56:44.554 -> [HTTP-Client][returnError] error(-1): connection failed
10:56:44.554 -> HTTP GET invalid response http code -1 connection failed
10:56:44.554 -> [HTTP-Client][end] tcp is closed
10:56:44.554 -> http://192.168.0.35:5000/register?dev=ND_01&mac=FC:F5:C4:AB:AD:E5
10:56:44.554 -> [HTTP-Client][begin] url: http://192.168.0.35:5000/register?dev=ND_01&mac=FC:F5:C4:AB:AD:E5
10:56:44.554 -> [HTTP-Client][begin] host: 192.168.0.35 port: 5000 url: /register?dev=ND_01&mac=FC:F5:C4:AB:AD:E5
10:56:44.601 -> [HTTP-Client][sendRequest] type: 'GET' redirCount: 0
10:56:44.695 -> [HTTP-Client] connected to 192.168.0.35:5000
10:56:44.695 -> [HTTP-Client] sending request header
10:56:44.695 -> -----
10:56:44.695 -> GET /register?dev=ND_01&mac=FC:F5:C4:AB:AD:E5 HTTP/1.1
10:56:44.695 -> Host: 192.168.0.35:5000
10:56:44.695 -> User-Agent: ESP8266HTTPClient
10:56:44.695 -> Accept-Encoding: identity;q=1,chunked;q=0.1,*;q=0
10:56:44.695 -> Connection: keep-alive
10:56:44.695 -> Content-Length: 0
10:56:44.695 -> 
10:56:44.695 -> -----
10:56:44.695 -> [HTTP-Client][handleHeaderResponse] RX: 'HTTP/1.1 304 NOT MODIFIED
10:56:44.743 -> [HTTP-Client][handleHeaderResponse] RX: 'Server: gunicorn
10:56:44.743 -> [HTTP-Client][handleHeaderResponse] RX: 'Date: Sun, 01 May 2022 17:56:44 GMT
10:56:44.743 -> [HTTP-Client][handleHeaderResponse] RX: 'Connection: close
10:56:44.743 -> [HTTP-Client][handleHeaderResponse] RX: '
10:56:44.743 -> [HTTP-Client][handleHeaderResponse] code: 304
10:56:44.743 -> [HTTP-Client][end] tcp stop
10:56:45.770 -> pm open,type:2 0
  1. My full application (version 2.7.4) where 8266 client successfully connects the first time to the 8266 Web Server - not reproduced with MVCE. - and then fails every time after that. In that code, for each command, I try 5 times, and you see it succeeding all 5 times to begin with and then failing all 5 times after that.
 11:07:12.356 -> RlyOnOFf1
11:07:12.356 -> http://192.168.0.28:80/cm?cmnd=Power_off
11:07:12.356 -> [HTTP-Client][begin] url: http://192.168.0.28:80/cm?cmnd=Power_off
11:07:12.402 -> [HTTP-Client][begin] host: 192.168.0.28 port: 80 url: /cm?cmnd=Power_off
11:07:12.402 -> [HTTP-Client][sendRequest] type: 'GET' redirCount: 0
11:07:12.402 -> [hostByName] Host: 192.168.0.28 is a IP!
11:07:12.402 -> :ref 1
11:07:12.450 -> [HTTP-Client] connected to 192.168.0.28:80
11:07:12.450 -> [HTTP-Client] sending request header
11:07:12.450 -> -----
11:07:12.450 -> GET /cm?cmnd=Power_off HTTP/1.1
11:07:12.450 -> Host: 192.168.0.28
11:07:12.450 -> User-Agent: ESP8266HTTPClient
11:07:12.497 -> Accept-Encoding: identity;q=1,chunked;q=0.1,*;q=0
11:07:12.497 -> Connection: keep-alive
11:07:12.497 -> Content-Length: 0
11:07:12.497 -> 
11:07:12.497 -> -----
11:07:12.497 -> :wr 180 0
11:07:12.497 -> :wrc 180 180 0
11:07:12.497 -> :ack 180
11:07:12.497 -> :rn 139
11:07:12.497 -> [HTTP-Client][handleHeaderResponse] RX: 'HTTP/1.1 200 OK'
11:07:12.497 -> [HTTP-Client][handleHeaderResponse] RX: 'Content-Length: 34'
11:07:12.545 -> [HTTP-Client][handleHeaderResponse] RX: 'Content-Type: text/plain'
11:07:12.545 -> [HTTP-Client][handleHeaderResponse] RX: 'Connection: close'
11:07:12.545 -> [HTTP-Client][handleHeaderResponse] RX: 'Accept-Ranges: none'
11:07:12.545 -> [HTTP-Client][handleHeaderResponse] RX: ''
11:07:12.545 -> [HTTP-Client][handleHeaderResponse] code: 200
11:07:12.545 -> [HTTP-Client][handleHeaderResponse] size: 34
11:07:12.545 -> :c0 1, 139
11:07:12.545 -> Has param cmnd and value Power_off[HTTP-Client][writeToStreamDataBlock] end of chunk or data (transferred: 34).
11:07:12.593 -> [HTTP-Client][end] tcp stop
11:07:12.593 -> :close
11:07:12.593 ->  
11:07:12.593 -> HTTP 200
11:07:12.593 -> pass 1
11:07:12.593 -> [HTTP-Client][sendRequest] type: 'GET' redirCount: 0
11:07:12.593 -> [hostByName] Host: 192.168.0.28 is a IP!
11:07:12.593 -> :ur 1
11:07:12.593 -> :dsrcv 0
11:07:12.593 -> :del
11:07:12.593 -> :ref 1
11:07:12.826 -> [HTTP-Client] connected to 192.168.0.28:80
11:07:12.826 -> [HTTP-Client] sending request header
11:07:12.826 -> -----
11:07:12.826 -> GET /cm?cmnd=Power_off HTTP/1.1
11:07:12.826 -> Host: 192.168.0.28
11:07:12.826 -> User-Agent: ESP8266HTTPClient
11:07:12.826 -> Accept-Encoding: identity;q=1,chunked;q=0.1,*;q=0
11:07:12.826 -> Connection: keep-alive
11:07:12.826 -> Content-Length: 0
11:07:12.826 -> 
11:07:12.826 -> -----
11:07:12.826 -> :wr 180 0
11:07:12.826 -> :wrc 180 180 0
11:07:12.920 -> :ack 180
11:07:12.920 -> :rn 139
11:07:12.920 -> [HTTP-Client][handleHeaderResponse] RX: 'HTTP/1.1 200 OK'
11:07:12.920 -> [HTTP-Client][handleHeaderResponse] RX: 'Content-Length: 34'
11:07:12.920 -> [HTTP-Client][handleHeaderResponse] RX: 'Content-Type: text/plain'
11:07:12.920 -> [HTTP-Client][handleHeaderResponse] RX: 'Connection: close'
11:07:12.967 -> [HTTP-Client][handleHeaderResponse] RX: 'Accept-Ranges: none'
11:07:12.967 -> [HTTP-Client][handleHeaderResponse] RX: ''
11:07:12.967 -> [HTTP-Client][handleHeaderResponse] code: 200
11:07:12.967 -> [HTTP-Client][handleHeaderResponse] size: 34
11:07:12.967 -> :c0 1, 139
11:07:12.967 -> Has param cmnd and value Power_off[HTTP-Client][writeToStreamDataBlock] end of chunk or data (transferred: 34).
11:07:13.014 -> [HTTP-Client][end] tcp stop
11:07:13.014 -> :close
11:07:13.014 ->  
11:07:13.014 -> HTTP 200
11:07:13.014 -> pass 2
11:07:13.014 -> [HTTP-Client][sendRequest] type: 'GET' redirCount: 0
11:07:13.014 -> [hostByName] Host: 192.168.0.28 is a IP!
11:07:13.014 -> :ur 1
11:07:13.014 -> :dsrcv 0
11:07:13.014 -> :del
11:07:13.014 -> :ref 1
11:07:13.014 -> [HTTP-Client] connected to 192.168.0.28:80
11:07:13.014 -> [HTTP-Client] sending request header
11:07:13.060 -> -----
11:07:13.060 -> GET /cm?cmnd=Power_off HTTP/1.1
11:07:13.060 -> Host: 192.168.0.28
11:07:13.060 -> User-Agent: ESP8266HTTPClient
11:07:13.060 -> Accept-Encoding: identity;q=1,chunked;q=0.1,*;q=0
11:07:13.060 -> Connection: keep-alive
11:07:13.060 -> Content-Length: 0
11:07:13.060 -> 
11:07:13.060 -> -----
11:07:13.060 -> :wr 180 0
11:07:13.060 -> :wrc 180 180 0
11:07:13.107 -> :ack 180
11:07:13.107 -> :rn 139
11:07:13.107 -> [HTTP-Client][handleHeaderResponse] RX: 'HTTP/1.1 200 OK'
11:07:13.107 -> [HTTP-Client][handleHeaderResponse] RX: 'Content-Length: 34'
11:07:13.107 -> [HTTP-Client][handleHeaderResponse] RX: 'Content-Type: text/plain'
11:07:13.107 -> [HTTP-Client][handleHeaderResponse] RX: 'Connection: close'
11:07:13.107 -> [HTTP-Client][handleHeaderResponse] RX: 'Accept-Ranges: none'
11:07:13.155 -> [HTTP-Client][handleHeaderResponse] RX: ''
11:07:13.155 -> [HTTP-Client][handleHeaderResponse] code: 200
11:07:13.155 -> [HTTP-Client][handleHeaderResponse] size: 34
11:07:13.155 -> :c0 1, 139
11:07:13.155 -> Has param cmnd and value Power_off[HTTP-Client][writeToStreamDataBlock] end of chunk or data (transferred: 34).
11:07:13.155 -> [HTTP-Client][end] tcp stop
11:07:13.155 -> :close
11:07:13.155 ->  
11:07:13.155 -> HTTP 200
11:07:13.155 -> pass 3
11:07:13.155 -> [HTTP-Client][sendRequest] type: 'GET' redirCount: 0
11:07:13.200 -> [hostByName] Host: 192.168.0.28 is a IP!
11:07:13.200 -> :ur 1
11:07:13.200 -> :dsrcv 0
11:07:13.200 -> :del
11:07:13.200 -> :ref 1
11:07:13.200 -> [HTTP-Client] connected to 192.168.0.28:80
11:07:13.247 -> [HTTP-Client] sending request header
11:07:13.247 -> -----
11:07:13.247 -> GET /cm?cmnd=Power_off HTTP/1.1
11:07:13.247 -> Host: 192.168.0.28
11:07:13.247 -> User-Agent: ESP8266HTTPClient
11:07:13.247 -> Accept-Encoding: identity;q=1,chunked;q=0.1,*;q=0
11:07:13.247 -> Connection: keep-alive
11:07:13.247 -> Content-Length: 0
11:07:13.247 -> 
11:07:13.247 -> -----
11:07:13.247 -> :wr 180 0
11:07:13.247 -> :wrc 180 180 0
11:07:13.247 -> :ack 180
11:07:13.247 -> :rn 139
11:07:13.294 -> [HTTP-Client][handleHeaderResponse] RX: 'HTTP/1.1 200 OK'
11:07:13.294 -> [HTTP-Client][handleHeaderResponse] RX: 'Content-Length: 34'
11:07:13.294 -> [HTTP-Client][handleHeaderResponse] RX: 'Content-Type: text/plain'
11:07:13.294 -> [HTTP-Client][handleHeaderResponse] RX: 'Connection: close'
11:07:13.294 -> [HTTP-Client][handleHeaderResponse] RX: 'Accept-Ranges: none'
11:07:13.294 -> [HTTP-Client][handleHeaderResponse] RX: ''
11:07:13.342 -> [HTTP-Client][handleHeaderResponse] code: 200
11:07:13.342 -> [HTTP-Client][handleHeaderResponse] size: 34
11:07:13.342 -> :c0 1, 139
11:07:13.342 -> Has param cmnd and value Power_off[HTTP-Client][writeToStreamDataBlock] end of chunk or data (transferred: 34).
11:07:13.342 -> [HTTP-Client][end] tcp stop
11:07:13.342 -> :close
11:07:13.342 -> HTTP 200
11:07:13.342 -> pass 4
11:07:13.342 -> [HTTP-Client][sendRequest] type: 'GET' redirCount: 0
11:07:13.342 -> [hostByName] Host: 192.168.0.28 is a IP!
11:07:13.389 -> :ur 1
11:07:13.389 -> :dsrcv 0
11:07:13.389 -> :del
11:07:13.389 -> :ref 1
11:07:13.436 -> [HTTP-Client] connected to 192.168.0.28:80
11:07:13.436 -> [HTTP-Client] sending request header
11:07:13.436 -> -----
11:07:13.436 -> GET /cm?cmnd=Power_off HTTP/1.1
11:07:13.436 -> Host: 192.168.0.28
11:07:13.436 -> User-Agent: ESP8266HTTPClient
11:07:13.436 -> Accept-Encoding: identity;q=1,chunked;q=0.1,*;q=0
11:07:13.436 -> Connection: keep-alive
11:07:13.436 -> Content-Length: 0
11:07:13.483 -> 
11:07:13.483 -> -----
11:07:13.483 -> :wr 180 0
11:07:13.483 -> :wrc 180 180 0
11:07:13.483 -> :ack 180
11:07:13.483 -> :rn 139
11:07:13.483 -> [HTTP-Client][handleHeaderResponse] RX: 'HTTP/1.1 200 OK'
11:07:13.483 -> [HTTP-Client][handleHeaderResponse] RX: 'Content-Length: 34'
11:07:13.483 -> [HTTP-Client][handleHeaderResponse] RX: 'Content-Type: text/plain'
11:07:13.483 -> [HTTP-Client][handleHeaderResponse] RX: 'Connection: close'
11:07:13.530 -> [HTTP-Client][handleHeaderResponse] RX: 'Accept-Ranges: none'
11:07:13.530 -> [HTTP-Client][handleHeaderResponse] RX: ''
11:07:13.530 -> [HTTP-Client][handleHeaderResponse] code: 200
11:07:13.530 -> [HTTP-Client][handleHeaderResponse] size: 34
11:07:13.530 -> :c0 1, 139
11:07:13.530 -> Has param cmnd and value Power_off[HTTP-Client][writeToStreamDataBlock] end of chunk or data (transferred: 34).
11:07:13.530 -> [HTTP-Client][end] tcp stop
11:07:13.578 -> :close
11:07:13.578 ->  
11:07:13.578 -> HTTP 200
11:07:13.578 -> pass 5
11:07:13.578 -> [HTTP-Client][end] tcp is closed

And then it fails

 RlyOnOFf1
11:08:50.368 -> http://192.168.0.28:80/cm?cmnd=Power_On
11:08:50.368 -> [HTTP-Client][begin] url: http://192.168.0.28:80/cm?cmnd=Power_On
11:08:50.415 -> [HTTP-Client][begin] host: 192.168.0.28 port: 80 url: /cm?cmnd=Power_On
11:08:50.415 -> [HTTP-Client][sendRequest] type: 'GET' redirCount: 0
11:08:50.415 -> [hostByName] Host: 192.168.0.28 is a IP!
11:08:50.415 -> :ur 1
11:08:50.415 -> :dsrcv 0
11:08:50.415 -> :del
11:08:50.415 -> :ref 1
11:08:50.462 -> :ctmo
11:08:50.462 -> :abort
11:08:50.462 -> :ur 1
11:08:50.462 -> :dsrcv 0
11:08:50.462 -> :del
11:08:50.462 -> [HTTP-Client] failed connect to 192.168.0.28:80
11:08:50.462 -> [HTTP-Client][returnError] error(-1): connection failed
11:08:50.462 -> HTTP GET invalid response http code -1 connection failed
11:08:50.509 -> [HTTP-Client][end] tcp is closed
11:08:50.509 -> [HTTP-Client][begin] url: http://192.168.0.28:80/cm?cmnd=Power_On
11:08:50.509 -> [HTTP-Client][begin] host: 192.168.0.28 port: 80 url: /cm?cmnd=Power_On
11:08:50.509 -> pass 1
11:08:50.509 -> [HTTP-Client][sendRequest] type: 'GET' redirCount: 0
11:08:50.509 -> [hostByName] Host: 192.168.0.28 is a IP!
11:08:50.509 -> :ref 1
11:08:50.555 -> :ctmo
11:08:50.555 -> :abort
11:08:50.555 -> :ur 1
11:08:50.555 -> :dsrcv 0
11:08:50.555 -> :del
11:08:50.555 -> [HTTP-Client] failed connect to 192.168.0.28:80
11:08:50.555 -> [HTTP-Client][returnError] error(-1): connection failed
11:08:50.603 -> HTTP GET invalid response http code -1 connection failed
11:08:50.603 -> [HTTP-Client][end] tcp is closed
11:08:50.603 -> [HTTP-Client][begin] url: http://192.168.0.28:80/cm?cmnd=Power_On
11:08:50.603 -> [HTTP-Client][begin] host: 192.168.0.28 port: 80 url: /cm?cmnd=Power_On
11:08:50.603 -> pass 2
11:08:50.603 -> [HTTP-Client][sendRequest] type: 'GET' redirCount: 0
11:08:50.603 -> [hostByName] Host: 192.168.0.28 is a IP!
11:08:50.652 -> :ref 1
11:08:50.652 -> :ctmo
11:08:50.652 -> :abort
11:08:50.652 -> :ur 1
11:08:50.698 -> :dsrcv 0
11:08:50.698 -> :del
11:08:50.698 -> [HTTP-Client] failed connect to 192.168.0.28:80
11:08:50.698 -> [HTTP-Client][returnError] error(-1): connection failed
11:08:50.698 -> HTTP GET invalid response http code -1 connection failed
11:08:50.698 -> [HTTP-Client][end] tcp is closed
11:08:50.698 -> [HTTP-Client][begin] url: http://192.168.0.28:80/cm?cmnd=Power_On
11:08:50.698 -> [HTTP-Client][begin] host: 192.168.0.28 port: 80 url: /cm?cmnd=Power_On
11:08:50.746 -> pass 3
11:08:50.746 -> [HTTP-Client][sendRequest] type: 'GET' redirCount: 0
11:08:50.746 -> [hostByName] Host: 192.168.0.28 is a IP!
11:08:50.746 -> :ref 1
11:08:50.795 -> :ctmo
11:08:50.795 -> :abort
11:08:50.795 -> :ur 1
11:08:50.795 -> :dsrcv 0
11:08:50.795 -> :del
11:08:50.795 -> [HTTP-Client] failed connect to 192.168.0.28:80
11:08:50.795 -> [HTTP-Client][returnError] error(-1): connection failed
11:08:50.795 -> HTTP GET invalid response http code -1 connection failed
11:08:50.795 -> [HTTP-Client][end] tcp is closed
11:08:50.795 -> [HTTP-Client][begin] url: http://192.168.0.28:80/cm?cmnd=Power_On
11:08:50.842 -> [HTTP-Client][begin] host: 192.168.0.28 port: 80 url: /cm?cmnd=Power_On
11:08:50.842 -> pass 4
11:08:50.842 -> [HTTP-Client][sendRequest] type: 'GET' redirCount: 0
11:08:50.842 -> [hostByName] Host: 192.168.0.28 is a IP!
11:08:50.842 -> :ref 1
11:08:50.889 -> :ctmo
11:08:50.889 -> :abort
11:08:50.889 -> :ur 1
11:08:50.889 -> :dsrcv 0
11:08:50.889 -> :del
11:08:50.889 -> [HTTP-Client] failed connect to 192.168.0.28:80
11:08:50.889 -> [HTTP-Client][returnError] error(-1): connection failed
11:08:50.889 -> HTTP GET invalid response http code -1 connection failed
11:08:50.889 -> [HTTP-Client][end] tcp is closed
11:08:50.937 -> [HTTP-Client][begin] url: http://192.168.0.28:80/cm?cmnd=Power_On
11:08:50.937 -> [HTTP-Client][begin] host: 192.168.0.28 port: 80 url: /cm?cmnd=Power_On
11:08:50.937 -> pass 5
11:08:50.937 -> [HTTP-Client][end] tcp is closed
11:08:50.937 -> msg_buf: RLH:ON
11:08:50.937 -> Entry to sensors::handle.  SensorInit: 5 Hex, logBits a001, logNow 1, avgPtr 1 
11:08:50.937 -> LogNow
11:08:50.937 -> msg_buf: SN1:19.0,SN2:33.31
11:08:50.937 -> msg_buf: TMP:18.51,HUM:35.58,CO2:644,A0I:10
11:08:51.172 -> lfs_file_close: fd=0x3fff66a4
11:08:51.220 -> lfs_file_close: fd=0x3fff64c4
11:08:51.220 -> 02 11:08:50,18.51,35.58,644,10,19.0,33.31,ECH,CLOS,OFF,0,OFF,ON,DRV,DIF,FST,HST,LCO,HPK,IF1,IF2,28848,IF4
11:08:51.266 -> Route to system.html file
11:08:51.357 -> lfs_file_close: fd=0x3fff6414
11:08:53.363 -> lfs_file_close: fd=0x3fff1eac
11:08:56.360 -> Hum OnOff 0
11:08:56.360 -> Hum Relay test ota.SWconn 1
11:08:56.360 -> RlyOnOFf1
11:08:56.360 -> http://192.168.0.28:80/cm?cmnd=Power_off
11:08:56.360 -> [HTTP-Client][begin] url: http://192.168.0.28:80/cm?cmnd=Power_off
11:08:56.360 -> [HTTP-Client][begin] host: 192.168.0.28 port: 80 url: /cm?cmnd=Power_off
11:08:56.406 -> [HTTP-Client][sendRequest] type: 'GET' redirCount: 0
11:08:56.406 -> [hostByName] Host: 192.168.0.28 is a IP!
11:08:56.406 -> :ref 1
11:08:56.453 -> :ctmo
11:08:56.453 -> :abort
11:08:56.453 -> :ur 1
11:08:56.453 -> :dsrcv 0
11:08:56.453 -> :del
11:08:56.453 -> [HTTP-Client] failed connect to 192.168.0.28:80
11:08:56.453 -> [HTTP-Client][returnError] error(-1): connection failed
11:08:56.453 -> HTTP GET invalid response http code -1 connection failed
11:08:56.453 -> [HTTP-Client][end] tcp is closed
11:08:56.453 -> [HTTP-Client][begin] url: http://192.168.0.28:80/cm?cmnd=Power_off
11:08:56.500 -> [HTTP-Client][begin] host: 192.168.0.28 port: 80 url: /cm?cmnd=Power_off
11:08:56.500 -> pass 1
11:08:56.500 -> [HTTP-Client][sendRequest] type: 'GET' redirCount: 0
11:08:56.500 -> [hostByName] Host: 192.168.0.28 is a IP!
11:08:56.500 -> :ref 1
11:08:56.547 -> :ctmo
11:08:56.547 -> :abort
11:08:56.547 -> :ur 1
11:08:56.547 -> :dsrcv 0
11:08:56.547 -> :del
11:08:56.547 -> [HTTP-Client] failed connect to 192.168.0.28:80
11:08:56.547 -> [HTTP-Client][returnError] error(-1): connection failed
11:08:56.547 -> HTTP GET invalid response http code -1 connection failed
11:08:56.594 -> [HTTP-Client][end] tcp is closed
11:08:56.594 -> [HTTP-Client][begin] url: http://192.168.0.28:80/cm?cmnd=Power_off
11:08:56.594 -> [HTTP-Client][begin] host: 192.168.0.28 port: 80 url: /cm?cmnd=Power_off
11:08:56.594 -> pass 2
11:08:56.594 -> [HTTP-Client][sendRequest] type: 'GET' redirCount: 0
11:08:56.594 -> [hostByName] Host: 192.168.0.28 is a IP!
11:08:56.594 -> :ref 1
11:08:56.641 -> :ctmo
11:08:56.641 -> :abort
11:08:56.641 -> :ur 1
11:08:56.641 -> :dsrcv 0
11:08:56.641 -> :del
11:08:56.641 -> [HTTP-Client] failed connect to 192.168.0.28:80
11:08:56.687 -> [HTTP-Client][returnError] error(-1): connection failed
11:08:56.687 -> HTTP GET invalid response http code -1 connection failed
11:08:56.687 -> [HTTP-Client][end] tcp is closed
11:08:56.687 -> [HTTP-Client][begin] url: http://192.168.0.28:80/cm?cmnd=Power_off
11:08:56.687 -> [HTTP-Client][begin] host: 192.168.0.28 port: 80 url: /cm?cmnd=Power_off
11:08:56.687 -> pass 3
11:08:56.687 -> [HTTP-Client][sendRequest] type: 'GET' redirCount: 0
11:08:56.734 -> [hostByName] Host: 192.168.0.28 is a IP!
11:08:56.734 -> :ref 1
11:08:56.780 -> :ctmo
11:08:56.780 -> :abort
11:08:56.780 -> :ur 1
11:08:56.780 -> :dsrcv 0
11:08:56.780 -> :del
11:08:56.780 -> [HTTP-Client] failed connect to 192.168.0.28:80
11:08:56.780 -> [HTTP-Client][returnError] error(-1): connection failed
11:08:56.780 -> HTTP GET invalid response http code -1 connection failed
11:08:56.780 -> [HTTP-Client][end] tcp is closed
11:08:56.780 -> [HTTP-Client][begin] url: http://192.168.0.28:80/cm?cmnd=Power_off
11:08:56.828 -> [HTTP-Client][begin] host: 192.168.0.28 port: 80 url: /cm?cmnd=Power_off
11:08:56.828 -> pass 4
11:08:56.828 -> [HTTP-Client][sendRequest] type: 'GET' redirCount: 0
11:08:56.828 -> [hostByName] Host: 192.168.0.28 is a IP!
11:08:56.828 -> :ref 1
11:08:56.875 -> :ctmo
11:08:56.875 -> :abort
11:08:56.875 -> :ur 1
11:08:56.875 -> :dsrcv 0
11:08:56.875 -> :del
11:08:56.875 -> [HTTP-Client] failed connect to 192.168.0.28:80
11:08:56.875 -> [HTTP-Client][returnError] error(-1): connection failed
11:08:56.875 -> HTTP GET invalid response http code -1 connection failed
11:08:56.922 -> [HTTP-Client][end] tcp is closed
11:08:56.922 -> [HTTP-Client][begin] url: http://192.168.0.28:80/cm?cmnd=Power_off
11:08:56.922 -> [HTTP-Client][begin] host: 192.168.0.28 port: 80 url: /cm?cmnd=Power_off
11:08:56.922 -> pass 5
11:08:56.922 -> [HTTP-Client][end] tcp is closed

Finally there is the exception/soft WDT timeout capture.

ping succeeded
13:34:08.475 -> RlyOnOff, Switch IP: 191.168.0.28
13:34:08.475 -> http://191.168.0.28:80/cm?cmnd=Power_On
13:34:08.475 -> [HTTP-Client][begin] url: http://191.168.0.28:80/cm?cmnd=Power_On
13:34:08.475 -> [HTTP-Client][begin] host: 191.168.0.28 port: 80 url: /cm?cmnd=Power_On
13:34:08.521 -> [HTTP-Client][sendRequest] type: 'GET' redirCount: 0
13:34:08.521 -> [hostByName] Host: 191.168.0.28 is a IP!
13:34:08.521 -> :ref 1
13:34:09.456 -> ping 5, timeout 0, total payload 160 bytes, 5076 ms
13:34:13.699 -> :ctmo
13:34:13.699 -> :abort
13:34:13.699 -> :ur 1
13:34:13.699 -> :dsrcv 0
13:34:13.699 -> :del
13:34:13.699 -> [HTTP-Client] failed connect to 191.168.0.28:80
13:34:13.746 -> [HTTP-Client][returnError] error(-1): connection failed
13:34:13.746 -> HTTP GET invalid response http code -1 connection failed
13:34:13.746 -> [HTTP-Client][end] tcp is closed
13:34:13.746 -> :oom(32)@WString.cpp:195
13:34:13.746 -> :oom(32)@WString.cpp:195
13:34:13.746 -> :oom(32)@WString.cpp:195
13:34:13.746 -> :oom(32)@WString.cpp:195
/////repeating 00m(32)@WString.cpp:195 ////////////
13:34:16.148 -> :oom(32)@WString.cpp:195
13:34:16.148 -> :oom(32)@WString.cpp:195
13:34:16.148 -> :oom(32)@WString.cpp:195
13:34:16.148 -> :oom(32)@WString.cpp:195
13:34:16.148 -> :oom(32)@WString.cpp:195
13:34:16.148 -> :oom(32)@WString.cpp:195
13:34:16.148 -> :oom(32)@WString.cpp:195
13:34:16.148 -> :oom(32)@WString.cpp:195
13:34:16.148 -> :oom(32)@WString.cpp:195
13:34:16.148 -> :
13:34:16.148 -> --------------- CUT HERE FOR EXCEPTION DECODER ---------------
13:34:16.148 -> 
13:34:16.148 -> Soft WDT reset
13:34:16.195 -> 
13:34:16.195 -> >>>stack>>>
13:34:16.195 -> 
13:34:16.195 -> ctx: cont
13:34:16.195 -> sp: 3ffffbe0 end: 3fffffc0 offset: 01a0
13:34:16.195 -> 3ffffd80:  40001dcc 00000064 00000000 0000000a  
13:34:16.195 -> 3ffffd90:  40001f46 3ffeecc3 00000000 3fff144c  
13:34:16.195 -> 3ffffda0:  00353931 000000c3 00000000 00000030  
13:34:16.195 -> 3ffffdb0:  3ffe9430 401056e3 3ffecce0 3ffeee44  
13:34:16.195 -> 3ffffdc0:  00000001 401048be 3ffed5b0 402157e1  
13:34:16.195 -> 3ffffdd0:  00000000 3ffffe30 3ffffe30 3ffffe5b  
13:34:16.195 -> 3ffffde0:  00000000 3ffffe40 3ffffe40 3ffe8cbd  
13:34:16.195 -> 3ffffdf0:  40002570 40248880 000000c3 00000020  
13:34:16.195 -> 3ffffe00:  3ffffe60 00000003 00000004 00000000  
13:34:16.243 -> 3ffffe10:  00000000 00000000 00000000 3ffffda0  
13:34:16.243 -> 3ffffe20:  00000000 0000002c 00000020 40100fbc  
13:34:16.243 -> 3ffffe30:  3ffffe40 3ffffe40 00000004 4010034a  
13:34:16.243 -> 3ffffe40:  3ffe8cbb 00000020 000000c3 3ffef740  
13:34:16.243 -> 3ffffe50:  4020dd33 00000001 00707063 40100381  
13:34:16.243 -> 3ffffe60:  3ffffe60 00000021 00000021 00000000  
13:34:16.243 -> 3ffffe70:  000000c3 40248880 0000002c 00000000  
13:34:16.243 -> 3ffffe80:  000000c3 40248880 00000020 40100474  
13:34:16.243 -> 3ffffe90:  4020dd33 3ffeebe4 3ffeed6c 00000030  
13:34:16.243 -> 3ffffea0:  5454485b 6c432d50 746e6569 00000000  
13:34:16.243 -> 3ffffeb0:  00000011 00000020 3ffeec34 4020dd33  
13:34:16.290 -> 3ffffec0:  00000000 4bc6a7f0 6f1a9fbe 00c36d20  
13:34:16.290 -> 3ffffed0:  00000000 00000000 4bc6a7f0 3ffeed6c  
13:34:16.290 -> 3ffffee0:  4024c078 00000011 3ffeec34 4020ddc7  
13:34:16.290 -> 3ffffef0:  0000a904 00000011 3ffeec34 4020de95  
13:34:16.290 -> 3fffff00:  3ffeebe4 4024c078 3ffeec34 4020e044  
13:34:16.290 -> 3fffff10:  3ffeebe4 00000000 3ffeebf8 4020e06d  
13:34:16.290 -> 3fffff20:  3ffeebe4 ffffffff 3ffeebe4 4020a590  
13:34:16.290 -> 3fffff30:  00000000 ffffffff 3ffeebe4 40206f7b  
13:34:16.290 -> 3fffff40:  3ffeebe4 ffffffff 3ffeec7c 4020718a  
13:34:16.290 -> 3fffff50:  3ffeebe4 ffffffff 3ffeec7c 40207168  
13:34:16.336 -> 3fffff60:  00000000 0011001f 00000000 3ffeefc0  
13:34:16.336 -> 3fffff70:  00000001 3ffeebe4 3ffeed20 4020705c  
13:34:16.336 -> 3fffff80:  40211bb4 4700a8c0 00000001 3ffeefc0  
13:34:16.336 -> 3fffff90:  3fffdad0 3ffeebe4 3ffe85c8 40205405  
13:34:16.336 -> 3fffffa0:  feefeffe 00000000 3ffeefac 4020ec40  
13:34:16.336 -> 3fffffb0:  feefeffe feefeffe 3ffe85dc 401012bd  
13:34:16.336 -> <<<stack<<<
13:34:16.336 -> 
13:34:16.336 -> last failed alloc call: 4020DD33(32)@WString.cpp:195
13:34:16.336 -> 
13:34:16.336 -> --------------- CUT HERE FOR EXCEPTION DECODER ---------------

@dduehren
Copy link

dduehren commented May 2, 2022

Just tested this under 3.0.0 which displays the same behavior. Something was badly broken in the move from 2.7.4 to 3.0.9
Please fix this. I have to go back to 2.7.4 for now because that's the last stable release for HTTPClient and it doesn't work in the scenario I'd like it to.

@dduehren
Copy link

dduehren commented May 2, 2022

Here is what the output looks like under 2.7.4 from the MVCE

18:15:18.907 -> 
18:15:18.907 -> connected with TigerScout, channel 7
18:15:18.907 -> dhcp client start...
18:15:18.907 -> wifi evt: 0
18:15:19.235 -> ip:192.168.0.39,mask:255.255.255.0,gw:192.168.0.1
18:15:19.235 -> wifi evt: 3
18:15:21.716 -> 0,0,0
18:15:24.711 -> 
18:15:24.758 -> 
18:15:24.758 -> Connecting to wifi
18:15:24.758 -> WifiSetup
18:15:24.758 -> Wifi hostname Oyster112
18:15:24.758 -> lfs_file_close: fd=0x3fff02dc
18:15:24.804 -> lfs_file_close: fd=0x3ffeffcc
18:15:24.804 -> Wifi Credentials via json: _ssid TigerScout, _pass 5415492012, ssid TigerScout, password 5415492012
18:15:24.804 -> Got WiFi credentials
18:15:24.804 -> state: 5 -> 0 (0)
18:15:24.804 -> rm 0
18:15:24.897 -> del if0
18:15:24.897 -> usl
18:15:24.897 -> mode : null
18:15:24.990 -> wifi evt: 1
18:15:24.990 -> STA disconnect: 8
18:15:24.990 -> wifi evt: 8
18:15:25.973 -> WiFi.hostname(Oyster11251173): wifi_station_set_hostname() failed
18:15:25.973 -> mode : sta(fc:f5:c4:ab:ad:e5)
18:15:25.973 -> add if0
18:15:26.066 -> Wifi STA config NOT successful
18:15:26.066 -> WiFi STA begin
18:15:26.160 -> wifi evt: 8
18:15:26.394 -> .!.!.!.!.!.!.!.!.!.!.!.!.!.!scandone
18:15:29.998 -> state: 0 -> 2 (b0)
18:15:29.998 -> .!state: 2 -> 3 (0)
18:15:29.998 -> state: 3 -> 5 (10)
18:15:29.998 -> add 0
18:15:29.998 -> aid 8
18:15:29.998 -> cnt 
18:15:29.998 -> 
18:15:29.998 -> connected with TigerScout, channel 7
18:15:30.045 -> dhcp client start...
18:15:30.045 -> wifi evt: 0
18:15:30.186 -> .!.!ip:192.168.0.39,mask:255.255.255.0,gw:192.168.0.1
18:15:30.418 -> wifi evt: 3
18:15:30.604 -> .!WiFi STA Conn.  Millis 4420,  TryCnt 3
18:15:30.604 -> ******* WIFI INFO ****************
18:15:30.604 -> Mode: STA
18:15:30.604 -> PHY mode: G
18:15:30.604 -> Channel: 7
18:15:30.604 -> AP id: 0
18:15:30.604 -> Status: 5
18:15:30.604 -> Auto connect: 1
18:15:30.604 -> SSID (10): TigerScout
18:15:30.604 -> Passphrase (10): 5415492012
18:15:30.604 -> BSSID set: 0
18:15:30.604 -> IP Address: 192.168.0.39 Signal: -71 Channel No: 7
18:15:30.604 -> GATEway IP: 192.168.0.1
18:15:30.604 -> AP SSID : (IP unset)
18:15:30.604 -> ******* WIFI INFO ****************
18:15:30.604 -> Begin loop
18:15:40.012 -> pm open,type:2 0
18:15:40.619 -> Begin loop
18:15:50.629 -> Begin loop
18:15:54.700 -> ping succeeded
18:15:54.700 -> RlyOnOff, Switch IP: 191.168.0.28
18:15:54.700 -> http://191.168.0.28:80/cm?cmnd=Power_On
18:15:54.700 -> [HTTP-Client][begin] url: http://191.168.0.28:80/cm?cmnd=Power_On
18:15:54.700 -> [HTTP-Client][begin] host: 191.168.0.28 port: 80 url: /cm?cmnd=Power_On
18:15:54.700 -> [HTTP-Client][sendRequest] type: 'GET' redirCount: 0
18:15:54.700 -> [hostByName] Host: 191.168.0.28 is a IP!
18:15:54.747 -> :ref 1
18:15:55.683 -> ping 5, timeout 0, total payload 160 bytes, 5075 ms
18:15:59.940 -> :ctmo
18:15:59.940 -> :abort
18:15:59.940 -> :ur 1
18:15:59.940 -> :dsrcv 0
18:15:59.940 -> :del
18:15:59.940 -> [HTTP-Client] failed connect to 191.168.0.28:80
18:15:59.940 -> [HTTP-Client][returnError] error(-1): connection failed
18:15:59.940 -> HTTP GET invalid response http code -1 connection failed
18:15:59.940 -> [HTTP-Client][end] tcp is closed
18:16:09.957 -> Begin loop
18:16:09.957 -> RlyOnOff, Switch IP: 191.168.0.28
18:16:09.957 -> http://191.168.0.28:80/cm?cmnd=Power_off
18:16:09.957 -> [HTTP-Client][begin] url: http://191.168.0.28:80/cm?cmnd=Power_off
18:16:09.957 -> [HTTP-Client][begin] host: 191.168.0.28 port: 80 url: /cm?cmnd=Power_off
18:16:09.957 -> [HTTP-Client][sendRequest] type: 'GET' redirCount: 0
18:16:09.957 -> [hostByName] Host: 191.168.0.28 is a IP!
18:16:09.957 -> :ref 1
18:16:15.155 -> :ctmo
18:16:15.201 -> :abort
18:16:15.201 -> :ur 1
18:16:15.201 -> :dsrcv 0
18:16:15.201 -> :del
18:16:15.201 -> [HTTP-Client] failed connect to 191.168.0.28:80
18:16:15.201 -> [HTTP-Client][returnError] error(-1): connection failed
18:16:15.201 -> HTTP GET invalid response http code -1 connection failed
18:16:15.201 -> [HTTP-Client][end] tcp is closed
18:16:25.168 -> Begin loop
18:16:29.284 -> ping succeeded
18:16:29.284 -> RlyOnOff, Switch IP: 191.168.0.28
18:16:29.284 -> http://191.168.0.28:80/cm?cmnd=Power_On
18:16:29.284 -> [HTTP-Client][begin] url: http://191.168.0.28:80/cm?cmnd=Power_On
18:16:29.284 -> [HTTP-Client][begin] host: 191.168.0.28 port: 80 url: /cm?cmnd=Power_On
18:16:29.331 -> [HTTP-Client][sendRequest] type: 'GET' redirCount: 0
18:16:29.331 -> [hostByName] Host: 191.168.0.28 is a IP!
18:16:29.331 -> :ref 1
18:16:30.312 -> ping 5, timeout 0, total payload 160 bytes, 5123 ms
18:16:34.519 -> :ctmo
18:16:34.519 -> :abort
18:16:34.519 -> :ur 1
18:16:34.519 -> :dsrcv 0
18:16:34.519 -> :del
18:16:34.519 -> [HTTP-Client] failed connect to 191.168.0.28:80
18:16:34.519 -> [HTTP-Client][returnError] error(-1): connection failed
18:16:34.519 -> HTTP GET invalid response http code -1 connection failed
18:16:34.519 -> [HTTP-Client][end] tcp is closed

@dduehren
Copy link

dduehren commented May 2, 2022

I created a much smaller MVCE shown here. It produces slightly different behavior on 3.0.2.
Fatal exception 0(IllegalInstructionCause): There's nothing in my code that's generating an illegal Instruction that I can see.
It's in the core httpClient code. I did tests where I commented out the debug.Print or the hpptSW.end() and the result was unchanged.

Other params are the same as above. I plan on getting gdb running as I have time this week.

/**
    RealBasicHttp.ino
    Created on: 24.05.2015
*/
#include <Arduino.h>
#include "Arduino_DebugUtils.h"
#include <ESP8266WiFi.h>
#include <WiFiUdp.h>
#include <WiFiClient.h>
#include <ESP8266HTTPClient.h>

const char string_BSQ[] PROGMEM = "\"";
const char string_Host[] PROGMEM ="Host: ";
const char string_GET[] PROGMEM ="GET ";
const char string_switchCmd[] PROGMEM = "/cm?cmnd=Power";
const char string_ContentLen[] PROGMEM ="Content-Length: ";
const char string_ContentTypeTxt[] PROGMEM ="Content-Type: text/plain";
const char string_HTTP1P1[] PROGMEM =" HTTP/1.1";
const char string_urlBase[] PROGMEM = "http://";
//const char string_ipBase[] PROGMEM = "192.168.0.35";
const char string_ipBase[] PROGMEM = "147.182.231.246";
const uint16_t serverPort = 80;  //5000 for Rasp Pi, 80 for Ubuntu server
const char string_off[] PROGMEM = "off";
const char string_on[] PROGMEM = "On";

#define ipLen 17
#define HTTPport 80
#define MTempSize 160
char MTemp[MTempSize];  //General purpose buffer for many operations
char workBuffer[21]; //General purpose buffer when two are needed

bool RlyOnOff(bool OnOff, uint8_t relNo);

HTTPClient httpSW;
WiFiClient client;
char switchIP[ipLen];

int httpCode;
void setup() {
Serial.begin(115200);

  establishContact();
  Serial.println();

  strcpy(switchIP, "191.168.0.28");  //ip address of the wireless switch 

  Serial.println("Connecting to wifi");
  wifi_set_phy_mode (PHY_MODE_11G);
  WiFi.mode(WIFI_STA);
  WiFi.begin("" ,"");   // Enter wifi credentials here
  // wait for WiFi connection
  if(WiFi.status() != WL_CONNECTED){
    Serial.print(".");
    delay(500);
  }
  Serial.println("Wifi Connected");   

}
bool ONoff = true;
void loop() {
    Serial.println("Begin loop");
      RlyOnOff(ONoff, 0);  
      ONoff = !ONoff;
    delay (10000);
}

void establishContact() {
  int counter = 0;
  while ((Serial.available()<= 0)&&(counter<2)) {
    Serial.println(F("0,0,0"));   // send an initial string
    delay(3000);
    counter++;
  }
}

bool RlyOnOff(bool OnOff, uint8_t relNo){
  //relNo is for future expansion, requires multiple swtichIPs
    int httpCode = 0;
    httpSW.setReuse(false);
    Debug.print(DBG_INFO, "RlyOnOff, Switch IP: %s", switchIP);
    sprintf_P(MTemp, "%s%s:%d%s" ,string_urlBase,switchIP,HTTPport,string_switchCmd);
//    sprintf_P(MTemp, "%s%s:%d%s" ,string_urlBase,srvIP,serverPort,string_switchCmd);
    strcat(MTemp,"_");  //"%20" for Tasmota devices
    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);
          } else {
            Debug.print(DBG_ERROR, F("HTTP GET invalid response http code %d %s"),httpCode, httpSW.errorToString(httpCode).c_str());
            // something wrong with connection
          }
    httpSW.end();
 }

The serial output:

 0,0,0
00:08:55.672 -> 
00:08:55.672 -> Connecting to wifi
00:08:55.672 -> fpm close 3 
00:08:55.672 -> mode : sta(fc:f5:c4:ab:ad:e5)
00:08:55.672 -> add if0
00:08:55.672 -> .wifi evt: 8
00:08:56.187 -> Wifi Connected
00:08:56.187 -> Begin loop
00:08:56.187 -> RlyOnOff, Switch IP: 191.168.0.28
00:08:56.187 -> http://191.168.0.28:80/cm?cmnd=Power_On
00:08:56.187 -> [HTTP-Client][begin] url: http://191.168.0.28:80/cm?cmnd=Power_On
00:08:56.187 -> [HTTP-Client][begin] host: 191.168.0.28 port: 80 url: /cm?cmnd=Power_On
00:08:56.187 -> [HTTP-Client][sendRequest] type: 'GET' redirCount: 0
00:08:56.235 -> [hostByName] Host: 191.168.0.28 is a IP!
00:08:56.235 -> :ref 1
00:08:56.235 -> :ur 1
00:08:56.235 -> :dsrcv 0
00:08:56.235 -> :close
00:08:56.235 -> :del
00:08:56.235 -> [HTTP-Client] failed connect to 191.168.0.28:80
00:08:56.235 -> [HTTP-Client][returnError] error(-1): connection failed
00:08:56.235 -> HTTP GET invalid response http code -1 connection failed
00:08:56.235 -> [HTTP-Client][end] tcp is closed
00:08:56.235 -> Fatal exception 0(IllegalInstructionCause):
00:08:56.235 -> epc1=0x40201134, epc2=0x00000000, epc3=0x00000000, excvaddr=0x00000000, depc=0x00000000
00:08:56.235 -> 
00:08:56.235 -> --------------- CUT HERE FOR EXCEPTION DECODER ---------------
00:08:56.235 -> 
00:08:56.235 -> Exception (0):
00:08:56.235 -> epc1=0x40201134 epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000000 depc=0x00000000
00:08:56.282 -> 
00:08:56.282 -> >>>stack>>>
00:08:56.282 -> 
00:08:56.282 -> ctx: cont
00:08:56.282 -> sp: 3ffffdc0 end: 3fffffc0 offset: 0190
00:08:56.282 -> 3fffff50:  3ffee7b8 3ffee694 ffffffff 40201134  
00:08:56.282 -> 3fffff60:  00000000 0011001f 00000000 40203fb4  
00:08:56.282 -> 3fffff70:  00000001 0000000a 3ffee800 40204164  
00:08:56.282 -> 3fffff80:  40205da9 000001f4 3ffee894 3ffee894  
00:08:56.282 -> 3fffff90:  3fffdad0 00000000 3ffee880 40201155  
00:08:56.282 -> 3fffffa0:  feefeffe 00000000 3ffee880 402057fc  
00:08:56.282 -> 3fffffb0:  feefeffe feefeffe 3ffe85dc 40101215  
00:08:56.282 -> <<<stack<<<
00:08:56.282 -> 
00:08:56.282 -> --------------- CUT HERE FOR EXCEPTION DECODER ---------------
00:08:56.329 -> 
00:08:56.329 ->  ets Jan  8 2013,rst cause:2, boot mode:(3,6)
00:08:56.329 -> 
00:08:56.329 -> load 0x4010f000, len 3460, room 16 
00:08:56.329 -> tail 4
00:08:56.329 -> chksum 0xcc
00:08:56.329 -> load 0x3fff20b8, len 40, room 4 
00:08:56.329 -> tail 4
00:08:56.329 -> chksum 0xc9
00:08:56.329 -> csum 0xc9
00:08:56.329 -> v00049980
00:08:56.329 -> ~ld
00:08:56.376 -> 
00:08:56.376 -> SDK:2.2.2-dev(38a443e)/Core:3.0.2=30002000/lwIP:STABLE-2_1_2_RELEASE/glue:1.2-48-g7421258/BearSSL:6105635

The decoded exception

Exception 0: Illegal instruction
PC: 0x40201134
EXCVADDR: 0x00000000

Decoding stack results
0x40203fb4: Print::write(char const*) at C:\Users\ddueh\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266/Print.h line 59
0x40204164: Print::println() at C:\Users\ddueh\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266/Print.h line 57
0x40205da9: __delay(unsigned long) at C:\Users\ddueh\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266\core_esp8266_wiring.cpp line 55
0x402057fc: loop_wrapper() at C:\Users\ddueh\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266\core_esp8266_main.cpp line 201

@mcspr
Copy link
Collaborator

mcspr commented May 2, 2022

Can the issue be reproduced with our current git version? See the instructions at https://arduino-esp8266.readthedocs.io/en/latest/installing.html#using-git-version

@dduehren
Copy link

dduehren commented May 2, 2022

I will do that next but my time during the week is limited.

@dduehren
Copy link

dduehren commented May 2, 2022

What is the target date for the next release?

@dduehren
Copy link

dduehren commented May 3, 2022

All I have time for tonight is to try to follow the instructions for installing the latest version and I'm stuck.

  1. It would be good if you also included instructions for GitHub Desktop. I think I have the right directory structure though it took a few tries.
  2. I don't know with Desktop how to do git submodule update --init. So I installed git for Windows, which is unnecessarily complex - unix style commits, etc. What for? Desktop makes it easy to do pulls, commits, etc.
  3. The instructions say nothing about whether the Preferences section where the https://arduino.esp8266.com/stable/package_esp8266com_index.json exists. Should this be removed?
  4. After all of that. when I compile I get ESP8266WiFi.h: No such file or directory Has this library been renamed, removed or is this some kind of error on my part?

@dduehren
Copy link

dduehren commented May 3, 2022

Last problem resolved. Also found bug in program. But now have maybe bigger problem. I'm getting
serial.serialutil.SerialException: could not open port 'COM4': PermissionError(13, 'Access is denied.', None, 5)
Some of this maybe due to the fact that I have my Arduino directory on the E drive, whereas the 8266 files installed by the board manager are in c:\Users<myname>AppData\etc.
Is there a way around this permission issue?

And here's the new code. I was not returning a bool from the function. Now I'd like to get this working since I've gone this far to see if a)that's the crashing/illegal instruction problem and b) get to the real debugging of connecting to another 8266 in STA mode that's running a web server.

/**
    RealBasicHttp.ino
    Created on: 24.05.2015
*/
#include <Arduino.h>
#include "Arduino_DebugUtils.h"
#include <ESP8266WiFi.h>
#include <WiFiUdp.h>
#include <WiFiClient.h>
#include <ESP8266HTTPClient.h>

const char string_BSQ[] PROGMEM = "\"";
const char string_Host[] PROGMEM ="Host: ";
const char string_GET[] PROGMEM ="GET ";
const char string_switchCmd[] PROGMEM = "/cm?cmnd=Power";
const char string_ContentLen[] PROGMEM ="Content-Length: ";
const char string_ContentTypeTxt[] PROGMEM ="Content-Type: text/plain";
const char string_HTTP1P1[] PROGMEM =" HTTP/1.1";
const char string_urlBase[] PROGMEM = "http://";
//const char string_ipBase[] PROGMEM = "192.168.0.35";
const char string_ipBase[] PROGMEM = "147.182.231.246";
const uint16_t serverPort = 80;  //5000 for Rasp Pi, 80 for Ubuntu server
const char string_off[] PROGMEM = "off";
const char string_on[] PROGMEM = "On";

#define ipLen 17
#define HTTPport 80
#define MTempSize 160
char MTemp[MTempSize];  //General purpose buffer for many operations
char workBuffer[21]; //General purpose buffer when two are needed

bool RlyOnOff(bool OnOff, uint8_t relNo);

HTTPClient httpSW;
WiFiClient client;
char switchIP[ipLen];

int httpCode;
void setup() {
Serial.begin(115200);

  establishContact();
  Serial.println();

  strcpy(switchIP, "191.168.0.28");  //ip address of the wireless switch 

  Serial.println("Connecting to wifi");
  wifi_set_phy_mode (PHY_MODE_11G);
  WiFi.mode(WIFI_STA);
  WiFi.begin("credentials go here");
  // wait for WiFi connection
  if(WiFi.status() != WL_CONNECTED){
    Serial.print(".");
    delay(500);
  }
  Serial.println("Wifi Connected");   

}
bool ONoff = true;
void loop() {
    Serial.println("Begin loop");
      RlyOnOff(ONoff, 0);  
      ONoff = !ONoff;
    delay (10000);
}

void establishContact() {
  int counter = 0;
  while ((Serial.available()<= 0)&&(counter<2)) {
    Serial.println(F("0,0,0"));   // send an initial string
    delay(3000);
    counter++;
  }
}

bool RlyOnOff(bool OnOff, uint8_t relNo){
  //relNo is for future expansion, requires multiple swtichIPs
    int httpCode = 0;
    httpSW.setReuse(false);
    Debug.print(DBG_INFO, "RlyOnOff, Switch IP: %s", switchIP);
    sprintf_P(MTemp, "%s%s:%d%s" ,string_urlBase,switchIP,HTTPport,string_switchCmd);
//    sprintf_P(MTemp, "%s%s:%d%s" ,string_urlBase,srvIP,serverPort,string_switchCmd);
    strcat(MTemp,"_");  //"%20" for Tasmota devices
    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
            httpSW.end();
            return false;
          }
 }

@dduehren
Copy link

dduehren commented May 3, 2022

Reset computer. The crashing/illegal instruction problem is gone (probably in my case due to not returning true/false out of the function), but the connection fail problem remains. Should I open this on a separate ticket? I am running with the latest git version. Apparently the preferences .... json can stay there. The compiles are coming out of hardware\esp8266com\8266.
Here's the latest output

23:15:29.596 -> Begin loop
23:15:29.596 -> RlyOnOff, Switch IP: 191.168.0.28
23:15:29.596 -> http://191.168.0.28:80/cm?cmnd=Power_off
23:15:34.620 -> HTTP GET invalid response http code -1 connection failed
23:15:44.597 -> Begin loop
23:15:44.597 -> RlyOnOff, Switch IP: 191.168.0.28
23:15:44.597 -> http://191.168.0.28:80/cm?cmnd=Power_On
23:15:49.620 -> HTTP GET invalid response http code -1 connection failed
23:15:59.632 -> Begin loop
23:15:59.632 -> RlyOnOff, Switch IP: 191.168.0.28
23:15:59.632 -> http://191.168.0.28:80/cm?cmnd=Power_off
23:16:04.637 -> HTTP GET invalid response http code -1 connection failed
23:16:14.630 -> Begin loop
23:16:14.630 -> RlyOnOff, Switch IP: 191.168.0.28
23:16:14.630 -> http://191.168.0.28:80/cm?cmnd=Power_On
23:16:19.636 -> HTTP GET invalid response http code -1 connection failed
23:16:29.652 -> Begin loop
23:16:29.652 -> RlyOnOff, Switch IP: 191.168.0.28
23:16:29.652 -> http://191.168.0.28:80/cm?cmnd=Power_off
23:16:34.647 -> HTTP GET invalid response http code -1 connection failed

Etc.

@dduehren
Copy link

dduehren commented May 3, 2022

Ping is also failing now and worked before.

@BrotherV
Copy link
Author

After struggling with this issue, I have found that HTTPClient uses too many resources of RAM when it wants to POST or GET, and if the memory goes lower than 23KB before the "POST" or "GET" method, the ESP chip definitely crashes.
The question is, why HTTPClient use too much RAM? And how we can manage it?

My code:

HTTPClient httpClient;

bool sendPacket(char *json, const char *url, const char *path) // const String &url
{
  packetSending = true;
  bool dst = false;
  Log_M("Send Packet called");
  char *dateTime;
  Serial.printf("\r\n1 -- Free heap: %d, Before getting time from AWS server\r\n", ESP.getFreeHeap());
  DateTimeProvider *dateTimeProvider = new DateTimeProvider;
  dateTime = dateTimeProvider->getDateTime();
  Serial.printf("Date and Time: %s\r\n", dateTime);

  Serial.printf("\r\n2 -- Free heap size: %d, Before creating AWS4 signature\r\n", ESP.getFreeHeap());

  AWSClient4 awsClient4;
  awsClient4.enableCashClear(true);
  // awsClient4.enablePrintLog(false);
  awsClient4.setQuery("");
  awsClient4.setMethod("POST");
  awsClient4.setContentType("application/json");
  awsClient4.setSignedHeaders("content-length;content-type;host;x-amz-content-sha256;x-amz-date");
  awsClient4.setAWSRegion(awsRegion);
  awsClient4.setAWSEndpoint(awsEndpoint);
  awsClient4.setAWSDomain(awsDomain);
  awsClient4.setAWSService("execute-api");
  awsClient4.setAWSKeyID(awsAccessKey);
  awsClient4.setAWSSecretKey(awsSecretKey);
  awsClient4.setDateTime(dateTime);
  awsClient4.setAWSPath(path);
  awsClient4.createSignature(json);

  Serial.printf("\r\n3 -- Free size: %d, After creating AWS4 signature\r\n", ESP.getFreeHeap());

  std::unique_ptr<BearSSL::WiFiClientSecure> client(new BearSSL::WiFiClientSecure);
  if (client)
  {
    client->setInsecure();

    httpClient.begin(*client, url);
    httpClient.addHeader("Content-Type", "application/json");
    httpClient.addHeader("x-amz-content-sha256", awsClient4.getPayloadHash());
    httpClient.addHeader("x-amz-date", awsClient4.getDateTime());
    httpClient.addHeader("Authorization", awsClient4.getAuthorization());
    httpClient.collectHeaders(headerKeys, numberOfHeaders);

    Serial.printf("\r\n4 -- Free heap: %d, Before calling POST method\r\n", ESP.getFreeHeap());

    Log_M("Sending data to the server");
    int httpResponseCode = httpClient.POST(json);

    Serial.printf("\r\n5 -- Free heap: %d, After calling POST method\r\n", ESP.getFreeHeap());
    t_led_main.setInterval(500);
    if (httpResponseCode > 0)
    {
      // HTTP header has been send and Server response header has been handled
      Serial.printf("[HTTP] POST... code: %d\n", httpResponseCode);

      // file found at server
      if (httpResponseCode == HTTP_CODE_OK)
      {
        const String &payload = httpClient.getString();
        Log_M("received payload:\n<<");
        Log_D(payload);
        Log_M(">>");

        dst = true;
        DynamicJsonDocument doc(196);
        DeserializationError error = deserializeJson(doc, payload);

        if (error)
        {
          Log_M("deserializeJson() failed: ");
          Log_D(error.f_str());
        }
        else
        {
          if (doc["Blocked"] != nullptr)
          {
            sbs = doc["Blocked"].as<bool>();
            if (sbs != isSystemBlock)
            {
              isSystemBlock = sbs;
              EEPROM.write(addr_esp_block_status, sbs ? 1 : 0);
              EEPROM.commit();
            }
          }

          if (doc["Date"] != nullptr)
          {
            const char *dt = doc["Date"].as<const char *>();
            Serial.printf("Date and Time: %s", dt);
            rtc.setDateTime(dt);
          }

          if (doc["Mode"] != nullptr)
          {
            deviceMode = doc["Mode"].as<unsigned int>();
            if (deviceMode == FPGA_UPDATE || deviceMode == OTA_UPDATE)
            {
              rtc.clearAlarms();
              shouldUpdate = true;
            }
            else
            {
              tModeUpdate.restart();
            }
          }
        }
        doc.clear();
      }
      else if (httpResponseCode == HTTP_CODE_FORBIDDEN)
      {
        Log_M("Access denied to server");
      }
      else if (httpResponseCode == HTTP_CODE_BAD_REQUEST)
      {
        Log_M("Bad request");
        String errorCode = "";
        if (httpClient.hasHeader("errorCode"))
        {
          errorCode = httpClient.header("errorCode");
          int ec = errorCode.toInt();
          Serial.printf("\nError code: %d\n", ec);

          switch (ec)
          {
          case ERROR_STRUCTURAL:
            /* code */
            ESP.restart();
            break;

          case ERROR_CUSTOMER_DOES_NOT_EXIST:
            /* code */
            Log_M("ERROR: Customer id does not exist in the system. The system will reboot in the factory setting after 5 seconds");
            break;

          case ERROR_STATION_DOES_NOT_EXIST:
            /* code */
            Log_M("ERROR: Station id does not exist in the system. The system will reboot in the factory setting after 5 seconds");
            break;

          case ERROR_DEVICE_ALREADY_EXISTS:
            /* code */
            Log_M("Device already exist");
            break;
          }
        }
      }
      else
      {
        Serial.printf("[HTTP] POST... failed, error: %s\n", httpClient.errorToString(httpResponseCode).c_str());
      }
    }
    else
    {
      Log_M("Failed to connect");
    }
    client->stop();
    httpClient.end();
    Log_M("HTTP closed");

  return dst;
}

This is the log file of the program. The application tries to send data to the server twice. Although the ESP has almost 23KB free Heap, however, it crashes when the Heap is less or equal to this amount.

Initializing...

0 -- Free heap: 30832, Initializing
WIFI NAME: LiNa
WIFI PASSWORD: MiliaMilia1818

Searching...
Scan done
5 Networks found
WiFi SSID: LiNa
SSID EXIST
Connecting to LiNa ...
......

Connection established!
IP address:	
192.168.1.4

OTR method called
Send Packet called

1 -- Free heap: 28280, Before getting time from AWS server
Date and Time: 20220713100114

2 -- Free heap size: 26912, Before creating AWS4 signature

3 -- Free size: 26344, After creating AWS4 signature

4 -- Free heap: 25128, Before calling POST method
Sending data to the server

5 -- Free heap: 4392, After calling POST method
[HTTP] POST... code: 400
Bad request

Error code: 3
Device already exist
HTTP closed
Send Data called
Making JSON data
Send Packet called

1 -- Free heap: 24744, Before getting time from AWS server
Date and Time: 20220713100122

2 -- Free heap size: 24296, Before creating AWS4 signature

3 -- Free size: 23728, After creating AWS4 signature

4 -- Free heap: 23096, Before calling POST method
Sending data to the server

--------------- CUT HERE FOR EXCEPTION DECODER ---------------

Exception (29):
epc1=0x4000df64 epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000000 depc=0x00000000

>>>stack>>>

ctx: sys
sp: 3fffec10 end: 3fffffb0 offset: 0190
3fffeda0:  00000005 3ffef9a0 00000002 40100a30  
3fffedb0:  40258017 3fff654c 00000005 40257fac  
3fffedc0:  00000002 40257f53 00000002 402570a8  
3fffedd0:  402570d1 3fffee80 3ffef9a0 0000001a  
3fffede0:  40254b38 3fffee80 3ffef848 3ffef1d4  
3fffedf0:  3ffed09c 3fffee80 3fffee80 40232b1a  
3fffee00:  614e694c 01461500 401038c6 00000100  
3fffee10:  3ffeb760 7fffffff 00002200 00000001  
3fffee20:  40250e9d 00000080 3ffe8624 40100edb  
3fffee30:  ffffffd9 3ffef35c 3ffed0ac 3ffef9a0  
3fffee40:  3ffee8a0 00000039 00000000 40255833  
3fffee50:  00000000 3fff2464 ffffffd9 00000000  
3fffee60:  00000000 3ffef9a0 00000017 0000000f  
3fffee70:  40000f58 00000000 588bf8c9 00000000  
3fffee80:  00000000 00110101 00640104 00000043  
3fffee90:  3ffed0c0 000000b6 3ffed0d3 3ffed0b4  
3fffeea0:  00000000 3ffed0c0 3ffed0c6 3ffed0f9  
3fffeeb0:  00000000 3ffed13e 3ffed0df 3ffed15c  
3fffeec0:  3ffed0ff 3ffed11b 00000000 00000000  
3fffeed0:  00000000 00000000 00000039 00000000  
3fffeee0:  3fff270c 402552a2 3ffee8a0 3fff2464  
3fffeef0:  00000000 3ffef9a0 3ffee8a0 3ffed09c  
3fffef00:  3ffed09c 000000de 00000000 00000039  
3fffef10:  00000000 3ffed0a6 40269163 3ffee8a0  
3fffef20:  3ffed090 3fffdcc0 3ffeaf48 3ffeaf48  
3fffef30:  00000080 3ffee8a0 00000000 3ffe8620  
3fffef40:  40268a27 3fffdab0 00000000 40220ef2  
3fffef50:  3ffeaf48 40000f49 3fffdab0 40000f49  
3fffef60:  40000e19 00082709 00000000 00000005  
3fffef70:  60000600 aa55aa55 000000ed 40105a3d  
3fffef80:  40105a43 00000000 00000005 40101094  
3fffef90:  4010000d 9fd7e99a 00082709 401000ac  
3fffefa0:  4025d928 3fffef3c 4025d8d9 3ffffbc8  
3fffefb0:  3fffffc0 00000000 00000000 feefeffe  
3fffefc0:  feefeffe feefeffe feefeffe feefeffe  
3fffefd0:  feefeffe feefeffe feefeffe feefeffe  
3fffefe0:  feefeffe feefeffe feefeffe feefeffe  
3fffeff0:  feefeffe feefeffe feefeffe feefeffe  
3ffff000:  feefeffe feefeffe feefeffe feefeffe  
3ffff010:  feefeffe feefeffe feefeffe feefeffe  
3ffff020:  feefeffe feefeffe feefeffe feefeffe  
3ffff030:  feefeffe feefeffe feefeffe feefeffe  
3ffff040:  feefeffe feefeffe feefeffe feefeffe  
3ffff050:  feefeffe feefeffe feefeffe feefeffe  
3ffff060:  feefeffe feefeffe feefeffe feefeffe  
3ffff070:  feefeffe feefeffe feefeffe feefeffe  
3ffff080:  feefeffe feefeffe feefeffe feefeffe  
3ffff090:  feefeffe feefeffe feefeffe feefeffe  
3ffff0a0:  feefeffe feefeffe feefeffe feefeffe  
3ffff0b0:  feefeffe feefeffe feefeffe feefeffe  
3ffff0c0:  feefeffe feefeffe feefeffe feefeffe  
3ffff0d0:  feefeffe feefeffe feefeffe feefeffe  
3ffff0e0:  feefeffe feefeffe feefeffe feefeffe  
3ffff0f0:  feefeffe feefeffe feefeffe feefeffe  
3ffff100:  feefeffe feefeffe feefeffe feefeffe  
3ffff110:  feefeffe feefeffe feefeffe feefeffe  
3ffff120:  feefeffe feefeffe feefeffe feefeffe  
3ffff130:  feefeffe feefeffe feefeffe feefeffe  
3ffff140:  feefeffe feefeffe feefeffe feefeffe  
3ffff150:  feefeffe feefeffe feefeffe feefeffe  
3ffff160:  feefeffe feefeffe feefeffe feefeffe  
3ffff170:  feefeffe feefeffe feefeffe feefeffe  
3ffff180:  feefeffe feefeffe feefeffe feefeffe  
3ffff190:  feefeffe feefeffe feefeffe feefeffe  
3ffff1a0:  feefeffe feefeffe feefeffe feefeffe  
3ffff1b0:  feefeffe feefeffe feefeffe feefeffe  
3ffff1c0:  feefeffe feefeffe feefeffe feefeffe  
3ffff1d0:  feefeffe feefeffe feefeffe feefeffe  
3ffff1e0:  feefeffe feefeffe feefeffe feefeffe  
3ffff1f0:  feefeffe feefeffe feefeffe feefeffe  
3ffff200:  feefeffe feefeffe feefeffe feefeffe  
3ffff210:  feefeffe feefeffe feefeffe feefeffe  
3ffff220:  feefeffe feefeffe feefeffe feefeffe  
3ffff230:  feefeffe feefeffe feefeffe feefeffe  
3ffff240:  feefeffe feefeffe feefeffe feefeffe  
3ffff250:  feefeffe feefeffe feefeffe feefeffe  
3ffff260:  feefeffe feefeffe feefeffe feefeffe  
3ffff270:  feefeffe feefeffe feefeffe feefeffe  
3ffff280:  feefeffe feefeffe feefeffe feefeffe  
3ffff290:  feefeffe feefeffe feefeffe feefeffe  
3ffff2a0:  feefeffe feefeffe feefeffe feefeffe  
3ffff2b0:  feefeffe feefeffe feefeffe feefeffe  
3ffff2c0:  feefeffe feefeffe feefeffe feefeffe  
3ffff2d0:  feefeffe feefeffe feefeffe feefeffe  
3ffff2e0:  feefeffe feefeffe feefeffe feefeffe  
3ffff2f0:  feefeffe feefeffe feefeffe feefeffe  
3ffff300:  feefeffe feefeffe feefeffe feefeffe  
3ffff310:  feefeffe feefeffe feefeffe feefeffe  
3ffff320:  feefeffe feefeffe feefeffe feefeffe  
3ffff330:  feefeffe feefeffe feefeffe feefeffe  
3ffff340:  feefeffe feefeffe feefeffe feefeffe  
3ffff350:  feefeffe feefeffe feefeffe feefeffe  
3ffff360:  feefeffe feefeffe feefeffe feefeffe  
3ffff370:  feefeffe feefeffe feefeffe feefeffe  
3ffff380:  feefeffe feefeffe feefeffe feefeffe  
3ffff390:  feefeffe feefeffe feefeffe feefeffe  
3ffff3a0:  feefeffe feefeffe feefeffe feefeffe  
3ffff3b0:  feefeffe feefeffe feefeffe feefeffe  
3ffff3c0:  feefeffe feefeffe feefeffe feefeffe  
3ffff3d0:  feefeffe feefeffe feefeffe feefeffe  
3ffff3e0:  feefeffe feefeffe feefeffe feefeffe  
3ffff3f0:  feefeffe feefeffe feefeffe feefeffe  
3ffff400:  feefeffe feefeffe feefeffe feefeffe  
3ffff410:  feefeffe feefeffe feefeffe feefeffe  
3ffff420:  feefeffe feefeffe feefeffe feefeffe  
3ffff430:  feefeffe feefeffe feefeffe feefeffe  
3ffff440:  feefeffe feefeffe feefeffe feefeffe  
3ffff450:  feefeffe feefeffe feefeffe feefeffe  
3ffff460:  feefeffe feefeffe feefeffe feefeffe  
3ffff470:  feefeffe feefeffe feefeffe feefeffe  
3ffff480:  feefeffe feefeffe feefeffe feefeffe  
3ffff490:  feefeffe feefeffe feefeffe feefeffe  
3ffff4a0:  feefeffe feefeffe feefeffe feefeffe  
3ffff4b0:  feefeffe feefeffe feefeffe feefeffe  
3ffff4c0:  feefeffe feefeffe feefeffe feefeffe  
3ffff4d0:  00000005 00000000 00000020 40100654  
3ffff4e0:  feefeffe feefeffe 00000005 401026a4  
3ffff4f0:  40104833 00040000 00000000 00040000  
3ffff500:  53002200 40104830 00040000 feefeffe  
3ffff510:  3ffef078 40103797 3ffef1d4 4010340c  
3ffff520:  3ffeb73c 00000000 00000000 00000001  
3ffff530:  00007fff 2c9f0300 4000050c 3fffc278  
3ffff540:  401035e8 3fffc200 00000022 00000001  
3ffff550:  4010280b 00000030 00000000 ffffffff  
3ffff560:  401027ae 3ffe809a 3ffe8090 65800000  
3ffff570:  00000001 3ffef2d0 00000000 00000000  
3ffff580:  ff000fff 00ffffff 00000044 3ffee5f8  
3ffff590:  3fff2464 00000001 3fff57a4 00000030  
3ffff5a0:  40251880 3fff270c 3fff530c 40105f68  
3ffff5b0:  00000036 3fff270c 00000020 00000003  
3ffff5c0:  9c989dd6 c7ca672b c991a13b 17474152  
3ffff5d0:  b323b007 d58b4f80 8415a836 18218994  
3ffff5e0:  5c5c5c5c 5c5c5c5c 5c5c5c5c 5c5c5c5c  
3ffff5f0:  5c5c5c5c 5c5c5c5c 5c5c5c5c 5c5c5c5c  
3ffff600:  7563d6bd d0c95b3a 2e152df8 ef757b81  
3ffff610:  0bc2edf3 5bfa0239 55088cdd 72f6fc77  
3ffff620:  292a1dc0 d03f9912 3d485738 4be2ac71  
3ffff630:  7deecdd1 592d8183 32c567f0 7857e711  
3ffff640:  9e242c15 dc66bdab 4e780ea0 52ceeff7  
3ffff650:  64cf0323 cc0db06e 8ef44ff7 812c0340  
3ffff660:  8d9a9f41 02bd5880 ed7a9b36 d634b94d  
3ffff670:  d6bab16b 739dd8ec 96dcb78f 91678170  
3ffff680:  8ee328fd 31f8f503 7ff0f958 badaa85a  
3ffff690:  bf30bdb9 8dcc1547 967a0030 d08b1683  
3ffff6a0:  80000000 00000000 00000000 00000000  
3ffff6b0:  00000000 00000000 00000000 00000300  
3ffff6c0:  cbff4c31 b530d628 d7d56b98 78ccc165  
3ffff6d0:  73af3bf4 7a3bc72e e922e07b 48f6ff5f  
3ffff6e0:  61399735 782bdc72 72311443 00000080  
3ffff6f0:  03030000 010000f5 551daa81 00004267  
3ffff700:  984955d0 10d1b9a4 74001266 d65876a2  
3ffff710:  7fd20000 05ff68c0 a8c02bc0 5acca9cc  
3ffff720:  30c0acc0 2fc02cc0 afc023c0 adc0aec0  
3ffff730:  28c009c0 27c024c0 14c02dc0 13c00ac0  
3ffff740:  32c025c0 31c02ec0 2ac004c0 29c026c0  
3ffff750:  0f009c00 0ec005c0 9dc0a0c0 9dc09cc0  
3ffff760:  3d002f00 a1003c00 12c003c0 35c008c0  
3ffff770:  0aaaa098 2526227c c0bd5dad b8c95fdb  
3ffff780:  00d592ab c49f43fd 437d8472 57269ef4  
3ffff790:  39fc596a 27062111 5730d041 dc43631f  
3ffff7a0:  a8b81f0f b016a100 b73db4fb a1d15248  
3ffff7b0:  c71ccb19 2bf26e9e 20455ae2 6ba44907  
3ffff7c0:  d986dfa5 23e0b8f1 43d8d43e 500a1f29  
3ffff7d0:  91c65b29 3ec859b5 5d6cc299 3ad1773d  
3ffff7e0:  90d897fc 5b6c9dd5 8c1b8af4 3ae2ce23  
3ffff7f0:  fa4cd450 ca6f3746 d8d83d3d cb4f9680  
3ffff800:  b190fa3c 38eda7a6 bc6a99fa 6ecf46ca  
3ffff810:  c47f998e e8e6192f 5f2b621c 3389b2ef  
3ffff820:  16e41141 cca6d5fd e4cc20a8 e985e34c  
3ffff830:  d2fc238b b2dcdaa3 7a1be32c a4c27f3a  
3ffff840:  f418138e ba01e1a1 957a0eef 47fd1140  
3ffff850:  f5685408 4710b275 36db840e 57fedf45  
3ffff860:  83186248 61499aea 8f30568c f0519f6d  
3ffff870:  e30051fe 50accf93 7c5ee1b6 312d807a  
3ffff880:  1779ef57 dcdab14a ff4f742b 06c893f4  
3ffff890:  5f8bca30 1ec15724 aa84ec58 13b4ac8b  
3ffff8a0:  9524a15b 2a28b494 c3f18c68 8e4c6fb8  
3ffff8b0:  b0c1edec 295d376e 1b1ab181 96438128  
3ffff8c0:  188bcfeb 84f24fae 624e51c0 787506dd  
3ffff8d0:  29ed825d dc499095 112959f8 02a099b3  
3ffff8e0:  e1ec6c47 3644611c dbcf7507 2e87b91f  
3ffff8f0:  9f8de72d d5290725 c0a79dcf 084f3b69  
3ffff900:  276469a3 14b7f00b b1b5b7e9 d437139f  
3ffff910:  a432d792 9c29b997 94b73594 2c78ab75  
3ffff920:  61e56e4e 41348aff b5b6eb36 e211305b  
3ffff930:  4afd0ec4 22b0c4e6 26568b76 a256bc9a  
3ffff940:  7722cd2b 0aafe02b bfcc664c 88313dd9  
3ffff950:  051c1b8f 0f0ac90d 8809fee1 efaedc1c  
3ffff960:  ab044f4e a3a1686a b21f2b7f 5938dd03  
3ffff970:  3ffff8f0 96e3710d 40273978 b942b80f  
3ffff980:  54e26c75 8a991382 6182a722 8f59c42d  
3ffff990:  22d5d0a2 b942b80f 55853587 21a3921f  
3ffff9a0:  e85bcb52 794e3854 3ffff970 dc3a2f7b  
3ffff9b0:  68100fe0 c0cad97c e5fd9d19 96e3710d  
3ffff9c0:  794e3854 a716d590 e5fd9d19 6182a722  
3ffff9d0:  21a3921f 3ffffb30 55853587 c0cad97c  
3ffff9e0:  8a991382 8f59c42d 00800302 cb3e42b6  
3ffff9f0:  4cc5d4be fc657e2a 597f299c 3ad6faec  
3ffffa00:  5fcb6fab 4a475817 6c44198c 3ffff970  
3ffffa10:  f3bcc908 84caa73b fe94f82b 5f1d36f1  
3ffffa20:  ade682d1 2b3e6c1f fb41bd6b 137e2179  
3ffffa30:  6a09e667 bb67ae85 3c6ef372 a54ff53a  
3ffffa40:  510e527f 9b05688c 1f83d9ab 5be0cd19  
3ffffa50:  3fff6d4c 00000020 3fff6d8c 00000000  
3ffffa60:  00000000 3fff7424 00000080 4023c3d4  
3ffffa70:  3ffffaa4 3ffffb30 0000001f 3ffffaa0  
3ffffa80:  00000000 00000000 3fffc228 3ffffaa0  
3ffffa90:  3fff7528 3fff74d4 00000006 4024ad60  
3ffffaa0:  4023f46c f5000001 00000303 67420000  
3ffffab0:  81aa1d55 a4b9d110 d0554998 a27658d6  
3ffffac0:  66120074 c068ff05 0000d27f cca9cc5a  
3ffffad0:  c02bc0a8 c02cc02f c0acc030 c0aec0ad  
3ffffae0:  c023c0af c024c027 c009c028 c00ac013  
3ffffaf0:  c02dc014 c02ec031 c025c032 c026c029  
3ffffb00:  c004c02a c005c00e 009c000f c09cc09d  
3ffffb10:  c0a0c09d 003c00a1 002f003d c008c035  
3ffffb20:  c003c012 0000002a 00000080 00000000  
3ffffb30:  489f357d 8cdfb70a 6104d6b6 0000005a  
3ffffb40:  00000000 00000218 00000020 401010e4  
3ffffb50:  44c9f3de 396a1dd2 00000274 40100a1c  
3ffffb60:  748ff5bf 058176c5 69035700 40237ea5  
3ffffb70:  000000fe 00000000 3ffffbb0 40231c2f  
3ffffb80:  00000020 00000030 3fff6894 4023e670  
3ffffb90:  40106095 0065be1d 3fff7078 00000000  
3ffffba0:  40106142 3fff0058 0065be1d 00000000  
3ffffbb0:  40106319 0065be1d 3fff1ae0 00000000  
3ffffbc0:  3fff0080 3fff1ae0 00000001 3fff1ae0  
3ffffbd0:  0000001d 00000002 40220f78 3fffefa0  
3ffffbe0:  3fff1ae0 0000001d 00000002 40221e72  
3ffffbf0:  00000000 00000000 3fff599c 402163e0  
3ffffc00:  000000fe 000000fe 40100769 00000000  
3ffffc10:  0000535e 00000000 3fff6304 00003a98  
3ffffc20:  00000000 3fffb73c 3fff6304 4021643c  
3ffffc30:  00000000 00000000 00003a98 402175e4  
3ffffc40:  000000fe 76ca98ba fa0f8cb8 a34b0e69  
3ffffc50:  00000008 00000001 0000535d 00000000  
3ffffc60:  4023f3f4 4023f444 3fff6894 4023ea32  
3ffffc70:  3fff6d94 3fff5a1c 3fff6894 3fff5a1c  
3ffffc80:  00000000 00000001 3fff6304 40217683  
3ffffc90:  00000000 00000001 3fff6304 40217873  
3ffffca0:  000000c8 3fff1ae0 00000001 40220f84  
3ffffcb0:  00000000 00000000 000001bb 40221e72  
3ffffcc0:  00000000 3fff599c 3fff6304 40216696  
3ffffcd0:  3fff6694 00000035 3ffffd54 3ffe9696  
3ffffce0:  000001bb 3fff5a1c 3fff6304 3ffe9696  
3ffffcf0:  000001bb 3fff5a1c 3fff6304 40217915  
3ffffd00:  40225af0 aa34b623 40225af0 aa34b623  
3ffffd10:  3fff5cb8 00000000 3fff127c 4022393a  
3ffffd20:  00000000 00000002 3fff127c 4021ad71  
3ffffd30:  3332203a 000000c4 3fff127c 4021b7ba  
3ffffd40:  00000000 00000002 3ffe8ade 00000001  
3ffffd50:  3fff617c 000000d0 3ffffdc0 4021fd99  
3ffffd60:  00000000 3ffffd70 00000008 00000001  
3ffffd70:  3fff65bc 3ffe8add 00000001 00000000  
3ffffd80:  3fff617c 000000c4 3ffffdc0 00000001  
3ffffd90:  3fff127c 3fff127c 3fff65bc 4021b8fa  
3ffffda0:  3fff127c 3fff617c 3ffffdc0 4021b92a  
3ffffdb0:  3fff127c 3fff680c 3fff1840 4020eba4  
3ffffdc0:  3fff65bc 00c400cf 80000000 3ffe8368  
3ffffdd0:  00000000 40100000 00000000 3ffffe48  
3ffffde0:  00000100 00000010 00000008 3ffffe45  
3ffffdf0:  00000000 00000000 00000000 00000000  
3ffffe00:  3b9aca00 00000004 00000000 00000000  
3ffffe10:  00000010 40277484 00000000 3fff2994  
3ffffe20:  3ffffed0 00000000 3fff5b74 3fff5d94  
3ffffe30:  3fff5cd4 3fff59ec 3fff5a04 3fff51e4  
3ffffe40:  3fff4dd4 3fff4e5c 3fff4e2c 3fff4e0c  
3ffffe50:  3fff51fc 32323032 33313730 30303100  
3ffffe60:  00323231 3fff617c 00000001 3fff67c4  
3ffffe70:  00000000 3fff6304 3fff6694 3fff6434  
3ffffe80:  3fff4e7c 00000000 00000000 000d000f  
3ffffe90:  00000000 00000011 3ffffed0 3fff2994  
3ffffea0:  3ffe9ec8 3fff6084 3ffffed0 40211ddc  
3ffffeb0:  4021d974 3ffe8add 3fff1840 3fff2994  
3ffffec0:  3ffea0ac 3ffe969b 3fff617c 40211eb8  
3ffffed0:  3fff637c 3fff6240 000000c4 3fff2994  
3ffffee0:  3fff2994 3fff1840 3fff617c 402121da  
3ffffef0:  00000000 3fffdad0 3fff5ff4 3fff5ff4  
3fffff00:  3fff6174 3fff6174 3fff1800 00000001  
3fffff10:  3fff6164 3fff6084 3fff1800 4021d874  
3fffff20:  3fff60b4 3ffffef8 00000000 3fff6154  
3fffff30:  3ffffef8 00000000 4bc6a7f0 00000000  
3fffff40:  00000000 00000000 40100769 3fff0ca8  
3fffff50:  3fff109c 00000000 00000001 40223a72  
3fffff60:  3fff109c 00000000 00000001 4010012d  
3fffff70:  3fff109c 00000000 00000001 40219e7a  
3fffff80:  00000000 00000000 00000001 3fff19cc  
3fffff90:  3fffdad0 00000000 3fff19b8 4020a6cc  
3fffffa0:  feefeffe 00000000 3fff19b8 402210a4  
<<<stack<<<

--------------- CUT HERE FOR EXCEPTION DECODER ---------------

@Pablo2048
Copy link

@BrotherV
Copy link
Author

The reason is obvious - SSL - https://arduino-esp8266.readthedocs.io/en/latest/esp8266wifi/bearssl-client-secure-class.html#memory-requirements . You can try MLFN...

Thanks for your help. I have read about MLFN and I added it to my program. Also, I have checked "amazonaws.com" and it supports TLS1.2. However, when I try to check whether it supports MLFN or not it returns false.

  const char *host = "www.amazonaws.com";

  std::unique_ptr<BearSSL::WiFiClientSecure> client(new BearSSL::WiFiClientSecure);
  bool mfln = client->probeMaxFragmentLength(host, 443, 1024);
  Serial.printf("\n\tConnecting to %s", host);
  Serial.printf("\n\tMaximum fragment Length negotiation supported: %s", mfln ? "yes" : "no");
  if (mfln)
  {
     client->setBufferSizes(1024, 1024);
  }

@Pablo2048
Copy link

Did you try bigger values instead of just 1024? You have to be creative and play with this a little... For example if your transmitted & received payload is small enough then... ;-)

No Sign up for free to join this conversation on GitHub. Already have an account? No Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants