Skip to content

HTTPS failure with low free heap memory? #2175

@fabianoriccardi

Description

@fabianoriccardi

Hardware:

Board: Lolin D32
Core Installation/update date: commit: 884e417 06/dec/2018
IDE name: Arduino IDE
Flash Frequency: 40Mhz
PSRAM enabled: no
Upload Speed: 921600
Computer OS: Windows 10

Description:

I was testing the HTTPS functionality and it works perfectly. Last week I've added the BLE library, but it cause the failure of HTTPS calls. Actually Bluetooth is just instantiated BLEDevice::init(""); and never used, but it seems enough to make fail https calls. I think that the problem is the huge amount of ram stole by BLE library, but I'm not so confident about that.

This is what I get on serial port and it represent the common behaviour, everything works fine (even if there is that socket error) , you can see the huge (normal) amount of free heap:

[HTTPS] sending POST to myUrlAddress ...
Free Heap: 169876
[D][HTTPClient.cpp:265] beginInternal(): host: myHostAddress port: 443 url: myUrl
[E][WiFiClient.cpp:236] setSocketOption(): 1006 : 9
[I][ssl_client.cpp:151] start_ssl_client(): WARNING: Use certificates for a more secure communication!
[D][HTTPClient.cpp:977] connect():  connected to myHostAddress:443
[D][HTTPClient.cpp:1102] handleHeaderResponse(): code: 200
[D][HTTPClient.cpp:1105] handleHeaderResponse(): size: 45
[HTTPS] POST... code: 200
[D][HTTPClient.cpp:1239] writeToStreamDataBlock(): connection closed or file end (written: 45).
[D][HTTPClient.cpp:358] disconnect(): tcp stop

===========
{"content":null,"message":null,"result":"OK"}
===========
[HTTPS] end
[D][HTTPClient.cpp:369] disconnect(): tcp is closed

This is what I get when BLE is initialized (NOTE low free heap quantity):

[HTTPS] sending POST to myUrlAddress ...
Free Heap: 44952
[D][HTTPClient.cpp:265] beginInternal(): host: myHostAddress port: 443 url: myUrl
[E][WiFiClient.cpp:236] setSocketOption(): 1006 : 9
[I][ssl_client.cpp:151] start_ssl_client(): WARNING: Use certificates for a more secure communication!
[E][ssl_client.cpp:33] handle_error(): SSL - Memory allocation failed
[E][ssl_client.cpp:35] handle_error(): MbedTLS message code: -32512
[E][WiFiClientSecure.cpp:118] connect(): start_ssl_client: -32512
[D][HTTPClient.cpp:973] connect(): failed connect to myHostAddress:443
[W][HTTPClient.cpp:1262] returnError(): error(-1): connection refused
[HTTPS] POST... failed, error: connection refused
[HTTPS] end
[D][HTTPClient.cpp:369] disconnect(): tcp is closed

My questions are:

  • are there tricks to save RAM memory taken by ble library?
  • how many bytes takes an HTTPS call? Does it depends on message size?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Status: StaleIssue is stale stage (outdated/stuck)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions