Re: Calling OpenSSL_thread_stop() multiple times

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On Wed, Aug 23, 2023, 7:01 PM Matt Caswell <matt@xxxxxxxxxxx> wrote:


On 23/08/2023 10:54, Dipak B wrote:
>
> Need input on following questions.
>
> In the application with pseudo code as above, not using
> Openssl_stop_thread() inside function TalkToWeb() leads to memory leak
> which gets accumulated until function Shutdown() is called.
 >
 > How can I avoid memory leak  (stack shared above) ?
 >

So, IIUC, TalkToWeb is a function called by a single thread and each
thread calls it once and then the thread exits. Is that correct?

In which case calling OPENSSL_thread_stop() at the end of TalkToWeb()
would be a good solution.


> Can I deduct the following conclusion?
>
> There is constraint on an application (exe) using a DLL which is
> statically linked to ossl. This constraint is due to openssl.
>
> Constraint:
> If thread originating in such a application calls function TalkToWeb()
> above then it has to call openssl_stop_thread() inside TalkToWeb().
>
> This does not allow one to re-use same thread for calling TalkToWeb().

Right. You cannot re-use the same thread after calling
OPENSSL_thread_stop(). If you wan to re-use the thread then you must
rearrange things such that OPENSSL_thread_stop() is only called after
the *last* time that it is reused.

Matt


>
> Please let me know if any specific part is unclear I will try to
> describe it.
>
> Thanks and Regards
>

Thank you for all the help.
I have fixed the leak by moving Openssl_thread_stop() to dll_thread_detach.





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux