Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DLL gets locked when linked against OpenSSL 1.1.1j #986

Closed
hbeni opened this issue Jul 7, 2021 · 7 comments
Closed

DLL gets locked when linked against OpenSSL 1.1.1j #986

hbeni opened this issue Jul 7, 2021 · 7 comments

Comments

@hbeni
Copy link

hbeni commented Jul 7, 2021

Hi there,
I really could use some help with the following issue.

I have a plugin for mumble in the works, which faciliates an updater. Mumble can load and unload the plugins. They are just DLLs exporting a bunch of functions. Mumble also has an updater, that calls a plugin function to get the latest download URL. It then fetches the new plugin, unloads the current one if loaded, and then ⚠️ deletes the old plugin dll to overwrite it with the downloaded version.

This is the point where I get problems:
As soon as I compile against OpenSSL (1.1.1j is in effect here) the DLL gets locked and thus cannot be deleted by mumble.

  • We already tracked this down to be specifically related to cpp-httplib and/or OpenSSL
  • We ruled out it'ts a mumble or generic plugin issue
  • I think the Problem is something in OpenSSL or maybe the way cpp-httplib instanciates/uses it
  • Just linking OpenSSL does not trigger the issue, it is only there if #define CPPHTTPLIB_OPENSSL_SUPPORT 1

I hoped you could see if there is a problem in the cpp-httplib regarding usage of OpenSSL.


Details:

@yhirose
Copy link
Owner

yhirose commented Jul 7, 2021

@hbeni, thanks for the feedback, but I probably cannot give you any meaningful help since I don't fully understand your environment. The only thing I can tell at this point is that you may want to look into the constructor and destructor of SSLServer and SSLClient where all the OpenSSL activities start. Hope it help!

@hbeni
Copy link
Author

hbeni commented Jul 7, 2021

Thank you, will do!
But maybe you could skim trough my updater code if you see something I do wrong wit the httplib?

https://github.com/hbeni/fgcom-mumble/blob/5d2125f1c296bc7cd64537a14eab2f828d766486/client/mumble-plugin/lib/updater.cpp#L143-L260

@hbeni
Copy link
Author

hbeni commented Jul 7, 2021

Just as an idea: wolfSSL is not supported, I guess?

@yhirose
Copy link
Owner

yhirose commented Jul 7, 2021

No, also I am not planning to support it. You may want to check the following as well.

static SSLInit sslinit_;

@hbeni
Copy link
Author

hbeni commented Jul 8, 2021

Looking at it again; I have a question.

In my code, inside a function, I do:

void fgcom_getLatestReleaseFromGithub_Web() {
  ...
  httplib::SSLClient cli(host.c_str());
  ...
}

I assumed that after the function is complete, everything is cleaned up automatically.
Is that maybe not the case, and I have to unload/destroy/free something regarding cli manually?

@yhirose
Copy link
Owner

yhirose commented Jul 8, 2021

Yes or no. Everything in httplib::SSLClient is cleaned up, but the global variable static SSLInit sslinit_; stays. You probably have to change the global variable to be unloadable manually.

@hbeni
Copy link
Author

hbeni commented Jul 8, 2021

OK, I found out something by accident.
I wondered if it might have to do with the OpenSSL version, and indeed it has.

Versions 1.1.1a and 1.1.1b are working fine, but any 1.1.1 after that has the issue.
So it is surely something in OpenSSL's codebase.

@hbeni hbeni closed this as completed Jul 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants