-
Type: Bug
-
Resolution: Gone away
-
Priority: Major - P3
-
None
-
Affects Version/s: 3.2.3
-
Component/s: None
-
Labels:
There is a 2038 issue where the client will silently fail to update the operation time after epoch-seconds 0x7fffffff (Tue 19 Jan 2038 03:14:07 GMT) due to representing negative values in two's complement:
https://github.com/mongodb-js/mongodb-core/blob/4b6e607c489b2524dea109ff0c3f41e279106a2c/lib/sessions.js#L148
The bson 1.1.1 NodeJS package defines Timestamp as "a Timestamp class for representing a 64-bit two's-complement integer value", which is incorrect.
Consequently, Timestamp operators are broken, and MIN_VALUE and MAX_VALUE properties are incorrect.
For example, the following comparison incorrectly evaluates to false because b is treated as negative (two's-complement 64-bit signed):
> a = Timestamp(0xffffffff, 0x7fffffff)
> b = Timestamp(0x00000000,0x80000000)
>
> a.lessThan(b)
false
Discussed re https://jira.mongodb.org/browse/NODE-1939 and raised as separate issue from issue originally identified with MIN and MAX values.