Access Violation shows OpenSSL stack

Dipak B <[email protected]> Sun, 13 Jul 2025 08:16:43 +0530
Newsgroups gmane.comp.encryption.openssl.user
Message-ID <CAMd_dYWrLMkJb-v3Hi1WOSwHCYNMTBrhkysnhBxp5AOPB1bd0A@mail.gmail.com>
Dear community,

Can you please share insights on the following?

Background:
A Windows service periodically loads and unloads a DLL statically linked to
Openssl 3.4.0.

This service has the DLL loaded always but when new version of DLL arrives,
it unloads the older DLL and loads the new DLL while maintaining its PID as
same. Thus service does not stop.

This DLL file calls SSL_Library_Init() once in single threaded manner as
part of initialization. Later many others threads exercise Openssl.

Now everytime the host Windows service unloads my DLL using FreeLibrary()
(after taking due care) and loads newer version of my DLL there is a access
violation on 1st thread of my DLL

This access violation shows Openssl frames in the stack trace.

Please note that Windows service  has threads that call my DLL and these
threads do TLS communication. Some of these Windows service threads outlive
the DLL loading and unloading.

On side note, these outliving threads leak since there is no possibility of
call to OpenSSL_Stop_Thread() (DLL does not get thread detach notification)

Will dropping explicit call to SSL_Library_Init() help here in fixing
access violations? Since this is OpenSSL 3.4.0 this call is not required
but it is retained here since long time.

What are the important points that I should be focused on while using DLL
which is statically linked to Openssl 3.4.0 in above scenario?

Are these outliving DLL threads some how cause access Violation?

Looking forward to your inputs.

Regards.

-- 
You received this message because you are subscribed to the Google Groups "openssl-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openssl-users+unsubscribe-MCmKBN63+Bmbup2nOX2J7Q@public.gmane.org
To view this discussion visit https://groups.google.com/a/openssl.org/d/msgid/openssl-users/CAMd_dYWrLMkJb-v3Hi1WOSwHCYNMTBrhkysnhBxp5AOPB1bd0A%40mail.gmail.com.