Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Paho » Memory leaks in openssl(Calling OPENSSL_thread_stop in MQTTAsync_sendThread and MQTTAsync_receiveThread)
Memory leaks in openssl [message #1796214] Mon, 08 October 2018 12:19 Go to next message
Alois Schausberger is currently offline Alois SchausbergerFriend
Messages: 5
Registered: August 2018
Junior Member
We are using openssl linked as a static library under windows and we are getting some memory leaks for each connection we create in a session (MQTTAsync_connect and MQTTAsync_disconnect).
The documentation of openSSL states that thread local storeage is automatically deleted (see https://www.openssl.org/docs/man1.1.1/man3/OPENSSL_thread_stop.html, paragraph NOTES).
Because we are working with static linkage, this behaviour does not happen and we get memory leaks.
To prevent memory leaks, we have inserted a call to OPENSSL_thread_stop() in MQTTAsync_sendThread and MQTTAsync_receiveThread. I have included the adapted source file.
Please let us know, if there is already prepared a mechanismus to circumvent this behaviour or if we have to take care for any other mechanismus provided from your side.
One more information - we are using the version from April 9th, 2018.
  • Attachment: MQTTAsync.c
    (Size: 90.34KB, Downloaded 111 times)
Re: Memory leaks in openssl [message #1796231 is a reply to message #1796214] Mon, 08 October 2018 14:25 Go to previous messageGo to next message
Ian Craggs is currently offline Ian CraggsFriend
Messages: 83
Registered: March 2013
Member
Using the library statically was not something I considered when writing it, but it seems to work, apparently. The biggest impact to the project would be the need to add further tests, unless some other problem is found, which it sounds like it is not.

A question is whether these additions cause any problems for dynamically linked libraries. The best way to answer that could be to create a PR with your changes, then the regression tests will be automatically run against them.
Re: Memory leaks in openssl [message #1796233 is a reply to message #1796231] Mon, 08 October 2018 14:33 Go to previous message
Alois Schausberger is currently offline Alois SchausbergerFriend
Messages: 5
Registered: August 2018
Junior Member
Up to now I have no problems found except that with memory leaks.
Today I have added the two calls and running my module test (includes numerous subsriptions, publications, reconnections) did not encounter any problems.
Maybe the inclusion of the calls to OPENSSL_thread_stop can be guarded by a constant. On the other hand I thought I found a statement in the openssl documentation, that the call to this functions can be done even if openssl is dynamically linked.
One thing has to be considered: I think this behaviour is specifically implemented in openssl 1.1.0 and is not available in older version (but I am not sure).
Previous Topic:Visual Studio 2017 CrossCompile
Next Topic:Memory leaks in async MQTT C client
Goto Forum:
  


Current Time: Fri May 03 07:09:00 GMT 2024

Powered by FUDForum. Page generated in 0.03252 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top