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

Db.close is async, but topology is closed "synchronously"

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.2.0
    • Affects Version/s: None
    • Component/s: None

      If I call db.close on a connection, this.s.topology.close is called synchronously. I can't find where the logic for topology.close exists, but I would think that it would be closed async. I am encountering issues across a large test suite (which sometimes opens/closes quickly) that causes "destroyed topology" errors to be thrown. If I introduce a delay before closing connections then the error disappears. This makes me believe that the db is not actually closed.

      db.close appears to be a wrapper around topology.close that emits close events, but fails to call topology.close async.

      See: https://github.com/mongodb/node-mongodb-native/blob/2.1/lib/db.js#L368

            Assignee:
            christkv Christian Amor Kvalheim
            Reporter:
            landau Trevor
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: