-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: 3.9
-
Component/s: Encryption
-
None
The way we spawn mongocryptd leads to these warnings:
$ python setup.py test -s test.test_encryption ... test_01_insert_succeeds_under_2MiB (test.test_encryption.TestBsonSizeBatches) ... /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py:858: ResourceWarning: subprocess 3521 is still running ResourceWarning, source=self)
The issue is that we discard the Popen object will the daemon process is still running. I think we can fix this in a few ways:
1) we can keep a reference to the Popen object and call wait() when closing a MongoClient.
2) We can use the double-fork pattern to spawn mongocryptd as an actual daemon process.
I think we should do option 2) because option 1) would only fix the issue for applications that call MongoClient.close() explicitly.