-
Notifications
You must be signed in to change notification settings - Fork 13.3k
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
Comments
The stack trace is not decoded, but there is |
@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. |
So why not dump free memory available especially around |
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. |
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. 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. 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.
And then it fails
Finally there is the exception/soft WDT timeout capture.
|
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 |
Here is what the output looks like under 2.7.4 from the MVCE
|
I created a much smaller MVCE shown here. It produces slightly different behavior on 3.0.2. Other params are the same as above. I plan on getting gdb running as I have time this week.
The serial output:
The decoded exception
|
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 |
I will do that next but my time during the week is limited. |
What is the target date for the next release? |
All I have time for tonight is to try to follow the instructions for installing the latest version and I'm stuck.
|
Last problem resolved. Also found bug in program. But now have maybe bigger problem. I'm getting 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.
|
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.
|
Ping is also failing now and worked before. |
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. My code:
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.
|
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.
|
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... ;-) |
Basic Infos
Platform
Settings in IDE
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
Debug Messages
The text was updated successfully, but these errors were encountered: