Summary
In the hello response, the server will return connectionId as an int32, int64, or even double. Many drivers (and our specs) assume that it is an int32. This can result in connection failures in some drivers (e.g. .NET/C#) or truncation of the connectionId (Java).
Motivation
Who is the affected end user?
End users with long-running clusters and high connection churn.
How does this affect the end user?
Depends on how the driver handles the overflow. Some will throw an exception. Others will truncate the connectionId. Worst case scenario, the user will be unable to connect to the MongoDB cluster.
Note that some drivers like Node.js and Python aren't affected by this bug because they use arbitrary-width numeric types.
How likely is it that this problem or use case will occur?
This issue is relatively infrequent. To overflow an int32 connectionId, the server would have to churn 100 connections per second for 8 months at a sustained rate. If the churn rate was higher, then the time to overflow would be proportionately shorter. This is mitigated by the fact that the server's connectionId counter is reset with every server restart.
If the problem does occur, what are the consequences and how severe are they?
Some drivers (like .NET/C#) won't be able to connect until the affected server is restarted. Others like Java will simply truncate the connectionId making it difficult/impossible to correlate client and server logs. Others like Python and Node.js are unaffected by this bug.
Is this issue urgent?
Given that restarting the affected server resolves the issue for multiple months even at high connection churn rates, this issue does not appear to be urgent at this time.
Is this ticket required by a downstream team?
No.
Is this ticket only for tests?
No.
Does this ticket have any functional impact, or is it just test improvements?
- causes
-
CSHARP-4417 Int overflow in connectionId
- Closed
- is related to
-
CDRIVER-4502 libmongoc expects connectionId in hello response to be int32
- Closed
-
SERVER-75293 Different return types for the connectionId
- Closed
- split to
-
RUBY-3206 ConnectionId returned in heartbeats may be int64
- Backlog
-
CSHARP-4483 ConnectionId returned in heartbeats may be int64
- Closed
-
CXX-2638 ConnectionId returned in heartbeats may be int64
- Closed
-
GODRIVER-2737 ConnectionId returned in heartbeats may be int64
- Closed
-
MOTOR-1084 ConnectionId returned in heartbeats may be int64
- Closed
-
NODE-4971 ConnectionId returned in heartbeats may be int64
- Closed
-
PHPC-2220 ConnectionId returned in heartbeats may be int64
- Closed
-
PYTHON-3571 ConnectionId returned in heartbeats may be int64
- Closed
-
RUST-1571 ConnectionId returned in heartbeats may be int64
- Closed
-
CDRIVER-4557 ConnectionId returned in heartbeats may be int64
- Closed
-
JAVA-4846 ConnectionId returned in heartbeats may be int64
- Closed