-
Notifications
You must be signed in to change notification settings - Fork 7.6k
WifiClientSecure - Connection error after 3600 seconds #9924
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “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? Sign in to your account
Comments
Maybe @me-no-dev can quickly spot something in the code... |
Please simplify the code to reproduce and make sure that we can run it. There is nothing i the client source to cause any such thing.
|
I think that the problem may related to forcing a long time connection with Why don't just close it and open it again every 10 seconds, instead of keeping it open forever? |
try with 3.0.2 |
It might be the same issue as in #9712, where the hostname couldn't be resolved anymore after automatically switching to IPv6. I experienced a similar problem with connections dropping after about half an hour to two hours, leading to a loop that required a reset. For more details, see my comment in #9712 (comment)_ |
That seems to be the case. Meanwhile I was able to identify the problem in the DNS area, too. I started a different sample code by using the WifiClientSecure exapmle. First notice: It does not use "WifiClientSecure"-class, but "NetworkClientScure"-class instead. Using this shortened code, the errors came much earlier and the debug messages pointed directly to a problem with resolving the DNS name. Then, I changed the host name to the assigned IP address and voila, code ran in an endless loop without any problems. Changed my main code to the same approach and it worked flawless. I'll try to enable IPv6 and see what happens. |
@me-no-dev - Please take a look into the previous 2 comments. It may be something to test. |
I'm experiencing an issue which may be related to this. I have smarthome infrastructure built on top of esp8266 and esp32 in my parents house and one esp32s3 in my home. When I disable my router/FFTH device, remote devices based on esp8266 are able to instantly reconnect, just after populating DNS record, while for ESP32 device it takes few hours. |
It seems that "WiFi.enableIPv6(true);" did the trick: Running for two hours now, without any loss of connection. |
Basically, it just circumvents the actual problem. Maybe the underlying error will be found in the next time. It’s also possible, of course, that manufacturers are slowly pushing for IPv6, because IPv4 addresses run out faster with such products. ;) Well, for me, this interim solution is workable. I don't plan to produce my project in large quantities, and I’m less worried about potential device failures only because customers might have IPv6 enabled in their network |
Running for 26 hours now without any issue. Thanks for your help mates! |
Board
DOIT ESP32 DEVKIT V1
Device Description
Plain module
Hardware Configuration
External wifi antenna connected
Version
v3.0.0
IDE Name
Arduino IDE
Operating System
Windows 10
Flash frequency
80MHz
PSRAM enabled
no
Upload speed
921600
Description
When the code is running for exactly one hour (3600 sec.) the code is not able to connect to the server anymore.
I've noticed that at the last print out of the received data a single not readable char is added and the heap in that moment jumps from somewhere around 210kB up to 260kB.
The error is reproducable each time the code is running. No exceptions from faulty behaviour.
Sketch
Debug Message
Other Steps to Reproduce
Ported the code to Visual Studio 2022 C Code using libcurl for https connection and it runs flawless for days.
Changed from domain name "https://calendar.google.com/" to IP-address "172.217.16.206" without any change.
Also tried to create the "WifiClientSecure" object new on each refresh didn't do any change.
I have checked existing issues, online documentation and the Troubleshooting Guide
The text was updated successfully, but these errors were encountered: