Skip to content

Memory leak in WiFiClientSecure on repeated WiFiServerSecure connections #4302

Closed
@stefaandesmet2003

Description

@stefaandesmet2003

Basic Infos

Hardware

Hardware: wemos D1 mini
Core Version: 2.4.0 + WebServerSecure + WiFiServerSecure manually added in (or latest github)

Description

While testing pull request #3001 I ran into a couple of problems, see conversation @ #3001 .
Source code, serial output and stack trace in attached files.

Hi @earlephilhower ,
I did some more testing. The WiFiHTTPSServer example works consistently without resets. But every first request from the browser is not correctly decrypted : the 'req' string is empty, serial prints 'invalid request', and client.print (http 404) never arrives at the browser. Every second request (probably a retry from the browser) is correctly decrypted : req : GET /gpio/1 HTTP/1.1. In the output log i added a ESP.getFreeHeap() printout every 5 seconds. Heap is ok here.

The HelloServerSecure example now works without reset for 1 browser request (i used lwip v2 lower memory variant), but then esp8266 resets systematically on the 2nd request. From the same ESP.getFreeHeap() printout every 5s, you see initial heap size of 35k is reduced to 5k after the first browser request, and is not restored. Then the 2nd request (reload page) fails with a reset.
Main difference between the 2 examples is the ESP8266WebServerSecure library.
Could you please check if you have the same behavior on your hardware?
Cheers,

Settings in IDE

Module: wemos D1 mini
Flash Size: 4MB
CPU Frequency: 80Mhz & 160MHz same behavior

HelloServerSecure_StacktraceOnReset.txt
WiFiHTTPSServer_HelloServerSecure_CodeAndSerialOutput.zip

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions