Uploaded image for project: 'Node.js Driver'
  1. Node.js Driver
  2. NODE-4496

Topology comparison bug processId long type detection incorrectly reuses the same value

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Critical - P2 Critical - P2
    • 4.9.0
    • Affects Version/s: None
    • Component/s: None
    • 2
    • Not Needed

      server_description.ts has the following incorrect code which results in incorrect server version comparison whenever the second input's counter is of type Long, note the `rhsCounter` definition.

      if (lhs.processId.equals(rhs.processId)) {
          // tests mock counter as just number, but in a real situation counter should always be a Long
          const lhsCounter = Long.isLong(lhs.counter) ? lhs.counter : Long.fromNumber(lhs.counter);
          const rhsCounter = Long.isLong(rhs.counter) ? lhs.counter : Long.fromNumber(rhs.counter);
          return lhsCounter.compare(rhsCounter);
        }
      

            Assignee:
            neal.beeken@mongodb.com Neal Beeken
            Reporter:
            daria.pardue@mongodb.com Daria Pardue
            Daria Pardue
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: