Tool/software: TI-RTOS
EDIT: Using wolfSSL v3.9.11 fixes this.
Hi,
I’ve been having out of memory issues when load testing an HTTPS server built with WolfSSL v3.9.6 and TI-RTOS v2.16.01.14 running on a TM4C129 chip on my custom board.
To exclude any issues due to my implementation, and to narrow the problem scope, I set up and run the tcpEchoTLS example code provided in the TI-RTOS examples.
To test the SSL connection, I used the sslscan tool (available from https://github.com/rbsec/sslscan/releases/tag/1.11.0-rbsec)
The sslscan tool successfully tests the SSL connection, however I noticed that this results in new orphan heap blocks being created in the TaskAllocList in the RTOS Object View (ROV) HeapTrack . If I repeatedly run the SSL scan, the number of orphaned blocks grow until I run out of heap memory.
From my investigation over the past few days, it looks like it this happens when WolfSSL has an error (see screenshot of my Live Session tab). I have attached screenshots that show the result of one test, which indicates the memory leaks seem to happen when the errors happen.
Note - Modifications I’ve made to tcpEchoTLS example code:
- Use a counting semaphore to restrict the number of concurrent connections to 3.
- Changed TCP server to listen on port 443 (for SSL connections)
- Added a Log_info statement to log WolfSSL errors.
tcpWorker(){
...... /* Loop while we receive data */ /* Loop while we receive data */ while ((bytesRcvd = wolfSSL_recv(ssl, (char *)buffer, TCPPACKETSIZE, 0)) > 0) { bytesSent = wolfSSL_send(ssl, (char *)buffer, bytesRcvd, 0); if (bytesSent < 0 || bytesSent != bytesRcvd) { System_printf("tcpWorker: send failed.\n"); break; } } int errorCode = wolfSSL_get_error(ssl, bytesRcvd); if (errorCode != SSL_ERROR_NONE) { Log_info1("WolfSSL error [%d]", errorCode); } ..... }
Here is a zip of my tcpEchoTLS project.
Any hints on how I can fix this issue will be much appreciated.