[DRIVERS-2503] ConnectionId returned in heartbeats may be int64 Created: 17/Nov/22 Updated: 19/Apr/23 |
|
| Status: | Implementing |
| Project: | Drivers |
| Component/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Unknown |
| Reporter: | James Kovacs | Assignee: | James Kovacs |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Driver Changes: | Needed | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Quarter: | FY24Q1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Downstream Changes Summary: | The connectionId in the hello (or legacy hello) response can be an int32, double, or int64. Many drivers assume an int32, which may result in connectionId truncation or connection failure. Drivers should ensure that the server's connectionId (and the client connectionId for consistency) is expressed as a numeric type capable of holding an int64. NOTE: If the client and server connectionId fields are part of the driver's public API, you may have to add new int64 connectionId fields and deprecate the existing int32 fields. On the next major version bump, the deprecated int32 fields should be removed. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Case: | (copied to CRM) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Program Manager: | |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Start date: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Driver Compliance: |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Description |
| Comments |
| Comment by Githook User [ 19/Apr/23 ] | ||||||||||||||||||||||||||||
|
Author: {'name': 'James Kovacs', 'email': 'jkovacs@post.harvard.edu', 'username': 'JamesKovacs'}Message: DRIVERS-2503: Require connectionId and serverConnectionId to be int64. (#1392) | ||||||||||||||||||||||||||||
| Comment by James Kovacs [ 29/Mar/23 ] | ||||||||||||||||||||||||||||
|
Tracked down the code for appendNumber(StringData fieldName, long long llNumber). In MongoDB 4.4 and earlier the connectionId (a 64-bit integer) can be rendered as an int32, double, or int64:
– https://github.com/mongodb/mongo/blob/v4.4/src/mongo/bson/bsonobjbuilder.h#L317-L332 In MongoDB 5.0, double was removed as a possible type:
– https://github.com/mongodb/mongo/blob/v5.0/src/mongo/bson/bsonobjbuilder.h#L268-L279 Given that current drivers support MongoDB 3.6 and later, I will clarify that the connectionId returned from the server might be an int32, double, or int64. | ||||||||||||||||||||||||||||
| Comment by Kevin Albertson [ 27/Mar/23 ] | ||||||||||||||||||||||||||||
|
| ||||||||||||||||||||||||||||
| Comment by James Kovacs [ 17/Nov/22 ] | ||||||||||||||||||||||||||||
|
The CMAP spec specifies the connectionId as Number without any indication of bitness. Command Logging and Monitoring does indicate that the serverConnectionId is an Int32. This should be corrected to Int64. Other specs should be audited to ensure that they correctly indicate that connectionId is an Int64. |