apple / apple/foundationdb

Opening a database with TLS and then exiting can cause client crashes

Open
#2,841 5 comments 0 reactions 1 assignee Claimed by @alexmiller-apple View on GitHub
bug
Dominant language
C++
Stars
16.7k
Forks
1.6k
Avg merge
1d 20h
Merged PRs (30d)
126

Description

This appears to be due to the fact that OpenSSL uses an atexit handler to free static resources, and this races with the still executing network thread. AJ found this issue was [already reported upstream](https://github.com/openssl/openssl/issues/6214).

The suggested fix is to call `OPENSSL_init_crypto()` with `OPENSSL_INIT_NO_ATEXIT` in `startNetworkThread()`, which will not register the handler. We should then call `OPENSSL_cleanup()` in `stopNetworkThread()`.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.