[CSHARP-2768] Server selection times again out after launching mongocryptd process Created: 01/Oct/19  Updated: 28/Oct/23  Resolved: 04/Nov/19

Status: Closed
Project: C# Driver
Component/s: Field Level Encryption
Affects Version/s: 2.10.0
Fix Version/s: 2.10.0

Type: Bug Priority: Major - P3
Reporter: Robert Stam Assignee: Dmitry Lukyanov (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to DRIVERS-1860 Avoiding a second server selection ti... Closed

 Description   

The driver automatically launches the mongocryptd process as necessary (in response to a server selection timeout).

But if the mongocryptd process takes more than one second to spin up the driver throws a second non-recoverable server selection timeout.

Some mechanism is needed to delay the second round of server selection until mongocryptd is up and running and discovered by SDAM.



 Comments   
Comment by Githook User [ 04/Nov/19 ]

Author:

{'name': 'Dmitry Lukyanov', 'username': 'DmitryLukyanov', 'email': 'dmitry.lukyanov@mongodb.com'}

Message: CSHARP-2768: Server selection times again out after launching mongocryptd process.
Branch: master
https://github.com/mongodb/mongo-csharp-driver/commit/6904bc0d85b08739ee749cbbadd78e9c42da86b0

Comment by Robert Stam [ 01/Oct/19 ]

Here's some evidence that it is more likely to be an SDAM issue than delays in mongocryptd starting up:

PS C:\mongodb\v4.2.0\bin> .\mongocryptd
2019-10-01T14:35:11.684-0400 I  CONTROL  [initandlisten] MongoCryptD starting : pid=5452 port=27020 64-bit host=x1carbon-robert
2019-10-01T14:35:11.685-0400 I  CONTROL  [initandlisten] targetMinOS: Windows 7/Windows Server 2008 R2
2019-10-01T14:35:11.685-0400 I  CONTROL  [initandlisten] db version v4.2.0
2019-10-01T14:35:11.685-0400 I  CONTROL  [initandlisten] git version: a4b751dcf51dd249c5865812b390cfd1c0129c30
2019-10-01T14:35:11.685-0400 I  CONTROL  [initandlisten] allocator: tcmalloc
2019-10-01T14:35:11.685-0400 I  CONTROL  [initandlisten] modules: enterprise
2019-10-01T14:35:11.686-0400 I  CONTROL  [initandlisten] build environment:
2019-10-01T14:35:11.686-0400 I  CONTROL  [initandlisten]     distmod: windows-64
2019-10-01T14:35:11.686-0400 I  CONTROL  [initandlisten]     distarch: x86_64
2019-10-01T14:35:11.686-0400 I  CONTROL  [initandlisten]     target_arch: x86_64
2019-10-01T14:35:11.686-0400 I  CONTROL  [initandlisten] options: {}
2019-10-01T14:35:11.686-0400 I  CONTROL  [initandlisten] Using lock file: C:/mongodb/v4.2.0/bin/mongocryptd.pid
2019-10-01T14:35:11.689-0400 I  NETWORK  [initandlisten] Listening on 127.0.0.1
2019-10-01T14:35:11.689-0400 I  NETWORK  [initandlisten] waiting for connections on port 27020

The output is almost instantaneous, and notice that it starts waiting for connections within 5ms of the first message.

 

Comment by Robert Stam [ 01/Oct/19 ]

Note: another scenario could be that even if mongocryptd process spins up in much less than a second that some sort of hiccup in SDAM is causing delays in discovering it.

Comment by Robert Stam [ 01/Oct/19 ]

See SPEC-1450.

However, this error is happening so frequently when running tests on Evergreen that it seems very likely that applications would often hit the same server selection timeout.

Therefore we need to fix this issue in the C# driver regardless of what happens with the SPEC ticket.

Generated at Wed Feb 07 21:43:29 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.