-
Type: Bug
-
Resolution: Fixed
-
Priority: Unknown
-
Affects Version/s: None
-
Component/s: None
-
None
-
Not Needed
Both rust and python are seeing occasional csfle lib_create() failed: Cannot initialize the Mongo Crypt Shared Support Library when it is already initialized. [Error 3, code 1] errors when testing crypt_shared: PYTHON-3559 and RUST-1578. I have not been able to reproduce the error locally yet.
abraham.egnor@mongodb.com was able to remove this error by putting a global mutex around mongocrypt_init and mongocrypt_destroy (here https://github.com/mongodb/libmongocrypt-rust/pull/20/files) which indicates this is a race condition in libmongocrypt itself.
Here's an example:
[2022/12/20 22:35:48.583] ERROR: test_legacy_badQueries_$pullAll_succeeds_on_unencrypted,_error_on_encrypted (test.test_encryption.TestSpec) [2022/12/20 22:35:48.583] ---------------------------------------------------------------------- [2022/12/20 22:35:48.583] Traceback (most recent call last): [2022/12/20 22:35:48.583] File "C:\data\mci\7d56f8d50d34074aa87d3e48f70ad8bc\src\test\__init__.py", line 603, in wrap [2022/12/20 22:35:48.583] return f(*args, **kwargs) [2022/12/20 22:35:48.583] File "C:\data\mci\7d56f8d50d34074aa87d3e48f70ad8bc\src\test\__init__.py", line 603, in wrap [2022/12/20 22:35:48.583] return f(*args, **kwargs) [2022/12/20 22:35:48.583] File "C:\data\mci\7d56f8d50d34074aa87d3e48f70ad8bc\src\test\test_encryption.py", line 686, in run_scenario [2022/12/20 22:35:48.583] self.run_scenario(scenario_def, test) [2022/12/20 22:35:48.583] File "C:\data\mci\7d56f8d50d34074aa87d3e48f70ad8bc\src\test\utils_spec_runner.py", line 520, in run_scenario [2022/12/20 22:35:48.583] client = rs_client( [2022/12/20 22:35:48.583] File "C:\data\mci\7d56f8d50d34074aa87d3e48f70ad8bc\src\test\utils.py", line 595, in rs_client [2022/12/20 22:35:48.583] return _mongo_client(h, p, **kwargs) [2022/12/20 22:35:48.583] File "C:\data\mci\7d56f8d50d34074aa87d3e48f70ad8bc\src\test\utils.py", line 575, in _mongo_client [2022/12/20 22:35:48.583] return MongoClient(uri, port, **client_options) [2022/12/20 22:35:48.583] File "C:\data\mci\7d56f8d50d34074aa87d3e48f70ad8bc\src\pymongo\mongo_client.py", line 831, in __init__ [2022/12/20 22:35:48.583] self._encrypter = _Encrypter(self, self.__options.auto_encryption_opts) [2022/12/20 22:35:48.583] File "C:\data\mci\7d56f8d50d34074aa87d3e48f70ad8bc\src\pymongo\encryption.py", line 337, in __init__ [2022/12/20 22:35:48.583] self._auto_encrypter = AutoEncrypter( [2022/12/20 22:35:48.583] File "Z:\data\mci\7d56f8d50d34074aa87d3e48f70ad8bc\src\venv-encryption\lib\site-packages\pymongocrypt\auto_encrypter.py", line 31, in __init__ [2022/12/20 22:35:48.583] self.mongocrypt = MongoCrypt(mongo_crypt_opts, callback) [2022/12/20 22:35:48.583] File "Z:\data\mci\7d56f8d50d34074aa87d3e48f70ad8bc\src\venv-encryption\lib\site-packages\pymongocrypt\mongocrypt.py", line 194, in __init__ [2022/12/20 22:35:48.583] self.__init() [2022/12/20 22:35:48.583] File "Z:\data\mci\7d56f8d50d34074aa87d3e48f70ad8bc\src\venv-encryption\lib\site-packages\pymongocrypt\mongocrypt.py", line 263, in __init [2022/12/20 22:35:48.583] self.__raise_from_status() [2022/12/20 22:35:48.583] File "Z:\data\mci\7d56f8d50d34074aa87d3e48f70ad8bc\src\venv-encryption\lib\site-packages\pymongocrypt\mongocrypt.py", line 279, in __raise_from_status [2022/12/20 22:35:48.583] raise exc [2022/12/20 22:35:48.583] pymongocrypt.errors.MongoCryptError: csfle lib_create() failed: Cannot initialize the Mongo Crypt Shared Support Library when it is already initialized. [Error 3, code 1] [2022/12/20 22:35:48.583] ----------------------------------------------------------------------
- causes
-
RUST-1578 CSFLE test bypass_mongocryptd_via_shared_library is flaky
- Closed
-
PYTHON-3559 Shared library encryption tests intermittently failing
- Blocked