Segmentation fault when returning SSL_CTX of the app
Description:
I am experiencing a segmentation fault when attempting to retrieve the SSL context of my SSL server using the following code: SSL_CTX* sslContext = static_cast<SSL_CTX *>(_ssl_server->getNativeHandle());
Observations:
-
Stack Trace : I used gdb to obtain the stack trace, which points to an issue in openssl.c:
-
Library Build : The uWebSocket library was built without the
LIBUS_NO_SSLflag. -
Comparative Test : To isolate the issue, I created an identical HTTPS server in a separate project. In this test project, I was able to retrieve the
SSL_CTXwithout any issues. Both projects use the same libraries and versions, but only my current development project encounters the segmentation fault.
Details:
Current Development Environment:
- uWebSocket library built without
LIBUS_NO_SSL. - Identical code for setting up the HTTPS server.
Test Project Environment:
- Same uWebSocket library and version.
- No segmentation fault when retrieving
SSL_CTX.
- Why is there a difference in behavior between the two projects?
- The stack trace indicates a reference to openssl.c, which is not visited in the working test project. What could be causing this discrepancy?
- Are there any known issues or additional configurations needed when using uWebSockets with SSL in a specific project setup?
Like always, AddressSanitizer is your friend
Context is nullptr, why? I don't know
We are running three server instances in three different threads. Occasionally, when creating an ssl_server object using SSLApp, the httpContext is null. Is there any reason for this? Is this socket creation isn't thread safe?
Like always, AddressSanitizer is your friend
Use these tools. If you wonder about threading, use ThreadSanitizer. I don't accept bug reports of crashes without these tools being used.