-
Type: Bug
-
Resolution: Fixed
-
Priority: Unknown
-
Affects Version/s: None
-
Component/s: None
-
None
The test will sometimes fail (example) with:
[2023/01/05 23:53:50.372] Error: Kind: An error occurred during client-side encryption: CryptShared (1): csfle lib_create() failed: Cannot initialize the Mongo Crypt Shared Support Library when it is already initialized. [Error 3, code 1], labels: {}
This failure happens at the EncryptedClientBuilder::build method, tracing back to the libmongocrypt mongocrypt_init call.
Open questions:
- Why does this failure happen at all? Loading and unloading of the shared support library loading is handled entirely within libmongocrypt, and it's explicitly documented that creating multiple handles via mongocrypt_init is allowed.
- Even given the above, all of the csfle tests are exclusive, so there shouldn't be multiple instances existing at any given moment anyway.
- Why does this failure only happen in that test? It doesn't do anything notable with initialization (single instance, standard setup).
- Why does this failure only happen on MacOS? This is likely a timing issue; we've seen that other flaky tests are more likely to fail there as well.
My current theory is that there's some race condition within libmongocrypt initialization that doesn't properly handle concurrent [de]initialization; that's getting tickled (somehow) by the background nature of `Client` teardown, which is (again, hypothetically) allowing a previously-constructed `Crypt` to persist in lifetime into the execution of the above test.
- is caused by
-
MONGOCRYPT-526 csfle lib_create() failed: Cannot initialize the Mongo Crypt Shared Support Library when it is already initialized
- Closed
- is related to
-
PYTHON-3559 Shared library encryption tests intermittently failing
- Blocked