BLE and WiFi Tasks Memory Allocation Failed

czuvich
Posts: 36
Joined: Tue Sep 04, 2018 1:58 am

BLE and WiFi Tasks Memory Allocation Failed

Postby czuvich » Sat Dec 15, 2018 7:02 pm

I have 2 FreeRTOS tasks where task 1 executes BLEDevice::init() and task 2 uses HttpClient to send a request to an HTTPS backend. I am running on a ESP WROVER DEV Kit v4.1.

I run the first BLE task and it executes fine; however, once the WiFi task executes (after the BLE task), it throws the following exception:

Code: Select all

12:59:27.684 -> [E][ssl_client.cpp:33] handle_error(): SSL - Memory allocation failed
Full log below:

Code: Select all

2:59:27.190 -> [V][ssl_client.cpp:53] start_ssl_client(): Free heap before TLS 4182376
12:59:27.190 -> [V][ssl_client.cpp:55] start_ssl_client(): Starting socket
[V][ssl_client.cpp:88] start_ssl_client(): Seeding the random number generator
12:59:27.684 -> [V][ssl_client.cpp:97] start_ssl_client(): Setting up the SSL/TLS structure...
12:59:27.684 -> [I][ssl_client.cpp:121] start_ssl_client(): WARNING: Use certificates for a more secure communication!
12:59:27.684 -> [V][ssl_client.cpp:145] start_ssl_client(): Setting hostname for TLS session...
12:59:27.684 -> [E][ssl_client.cpp:33] handle_error(): SSL - Memory allocation failed
12:59:27.684 -> [E][ssl_client.cpp:35] handle_error(): MbedTLS message code: -32512
12:59:27.717 -> [E][WiFiClientSecure.cpp:109] connect(): start_ssl_client: -32512
12:59:27.717 -> [V][ssl_client.cpp:211] stop_ssl_socket(): Cleaning SSL connection.
12:59:27.717 -> [D][HTTPClient.cpp:846] connect(): failed connect to [my backend server]:443
12:59:27.717 -> [W][HTTPClient.cpp:1124] returnError(): error(-1): connection refused
12:59:27.717 -> [I][HTTPAdapter.cpp:135] sync(): Received HTTP response [-1].
12:59:27.750 -> [W][HTTPClient.cpp:1124] returnError(): error(-4): not connected
I bought the WROVER module since I figured the extra heap would work well with both WiFi and BLE; however, I can't get a simple use-case to execute over HTTPS. I can run the WiFi task by itself (without BLEDevice::init() from the other task), and I can run the BLE task independently. It's when I try to BLEDevice::init() and then run WiFi is when it fails. Any help is greatly appreciated.

czuvich
Posts: 36
Joined: Tue Sep 04, 2018 1:58 am

Re: BLE and WiFi Tasks Memory Allocation Failed

Postby czuvich » Wed Dec 19, 2018 12:19 am

Anyone?

boarchuz
Posts: 605
Joined: Tue Aug 21, 2018 5:28 am

Re: BLE and WiFi Tasks Memory Allocation Failed

Postby boarchuz » Wed Dec 19, 2018 5:45 am

Well it looks like you're running out of memory. What usStackDepth are you creating the WiFi task with?

czuvich
Posts: 36
Joined: Tue Sep 04, 2018 1:58 am

Re: BLE and WiFi Tasks Memory Allocation Failed

Postby czuvich » Wed Dec 19, 2018 3:28 pm

I’ve tried 10K to 40K, but I get the same result. The log output says there’s 4182376 free heap before TLS. TLS requires that much heap?

Who is online

Users browsing this forum: No registered users and 71 guests