SDK6.2 Breaks TLS Compared to SDK6.0 (CYW943907AEVAL1F)

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
ChMa_3922746
Level 5
Level 5
10 likes received 10 likes given 5 likes given

As I reported in a separate trouble report (see note, below), I observed that the HTTPS web server suffers from a memory leak using SDK6.2 when repeatedly serving pages to a client.  When I revert to SDK6.0, the problem is gone. 

So, starting with the SDK6.2 code environment, I imported the following code from SDK6.0 into it:

  • Files in the directory:  "mbedtls_open/"
  • Individual files: wiced_tls.c,   tls_types.h,   wiced_tls.h
  • I needed to edit the files x509_crt.cb and pkparse.c by replacing "strnstr" with "strnstrn".

With these changes, the build worked, and the memory leak was not present.   So, it appears that code changes were made in the WICED files or the mdedtls code that caused the memory leak.

Is this of interest to the WICED development team, and if so, is this something that can be addressed?  I think it is quite a major problem.

(Note:  the previous trouble report with additional information is here:  TLS Memory Leak on HTTPS Web Server and HTTPS Client (CYW943907AEVAL1F))

1 Solution

Update:  I upgrade to SDK6.4, and I see that the problem does not exist even with the crypto HW acceleration enabled.  This problem appears to no longer exist.

View solution in original post

0 Likes
6 Replies
RaktimR_11
Moderator
Moderator
Moderator
500 replies posted 250 replies posted 100 replies posted

Thanks for bringing it to our notice. Could you please provide a stripped down version of the https_client that you are using when you are seeing this error? (It will help us to reproduce the issue quickly and report to the developer team)

Thank you!  I will definitely do that as I am very interested in getting to the root cause.  It might take a few days for me to get to it, however.

0 Likes

You should check if you can observe https server memory leak if using wget/curl tools to send requests.

Just to clarify if the memory leak is related to server or https_client code.

0 Likes

Thanks.  I did use curl at first and found that the memory leak was not present.  That's why I was surprised why my http client program caused an issue!  I will provide an update shortly.

0 Likes
lock attach
Attachments are accessible only for community members.

UPDATE:  Here is the formula for replicating the problem:

1) Install WICED 6.2.1 (a fresh install is what I use).

2) Copy the attached files main.c and main.mk into the apps/ folder (the files are modelled after snip.https_server).  Build it and download to the target.  Every few seconds it will print out the results of mallinfo.  You should be able to connect to it via a browser at its IP address (e.g., https://192.168.0.1).

3) The Java client source is contained in the attached file JavaClient2.java.  You must change the string clientURL to point to the WICED device (e.g., clientURL = "https://192.168.0.1:443" )  I use Eclipse for Java to create the class file and execute it (on Linux, the command is:  sudo java -cp JavaClient2.jar JavaClient2.JavaClient2).   If you have a specific IP:PORT, I can always generate the class file for you (let me know).

With these two things running (WICED and Java client), you should see the memory start to be slowly consumed...  4k at a time.

Please let me know if you are able to duplicate this issue.  It is quite a thing!

0 Likes

Update:  I upgrade to SDK6.4, and I see that the problem does not exist even with the crypto HW acceleration enabled.  This problem appears to no longer exist.

0 Likes