Uploaded image for project: 'C Driver'
  1. C Driver
  2. CDRIVER-3068

Topology scanner stuck when changing standalone server to replica set

    • Type: Icon: Task Task
    • Resolution: Works as Designed
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 1.14.0
    • Component/s: None
    • None

      I am using the C driver (via mongo-cxx-driver) in pooled mode.

      First, I create a pool using the URL mongodb://localhost:27017. The server is a standalone MongoDB 4.0.3 server.

      Then, I destroy that pool and create a new pool using the URL mongodb://localhost:27017/?replicaset=rep. Afterwards, I stop the MongoDB server and start it again as a single replica set (with replica set name "rep"). I can successfully connect to the server using the Mongo shell (and e.g. call "rs.initiate()").

      However, I cannot connect to the replica set using clients from the new pool in my program. Using APMĀ  callbacks, it seems like the topology scanner does not get notified of the new configuration:

      mongodb://localhost:27017: topology changed (5ca4c4969a183ffe80003b21) Single -> Single
      ?? previous servers:??
      ?? Standalone localhost:27017 (master)??
      ?? new servers:??
      ?? Standalone localhost:27017 (master)??
      mongodb://localhost:27017: server changed (5ca4c4969a183ffe80003b21): localhost:27017 -> localhost:27017
      mongodb://localhost:27017: topology changed (5ca4c4969a183ffe80003b21) Single -> Single
      ?? previous servers:??
      ?? Standalone localhost:27017 (master)??
      ?? new servers: Standalone localhost:27017 (master)??
      mongodb://localhost:27017: topology closed (5ca4c4969a183ffe80003b21)
      mongodb://localhost:27017/?replicaset=rep: topology opening (5ca4c4d99a183ffe80003b23)
      mongodb://localhost:27017/?replicaset=rep: topology changed (5ca4c4d99a183ffe80003b23) Unknown -> ReplicaSetNoPrimary
      mongodb://localhost:27017/?replicaset=rep: server opening (5ca4c4d99a183ffe80003b23): localhost:27017
      mongodb://localhost:27017/?replicaset=rep: server changed (5ca4c4d99a183ffe80003b23): localhost:27017 -> localhost:27017
      mongodb://localhost:27017/?replicaset=rep: server closed (5ca4c4d99a183ffe80003b23): localhost:27017
      mongodb://localhost:27017/?replicaset=rep: topology changed (5ca4c4d99a183ffe80003b23) ReplicaSetNoPrimary -> ReplicaSetNoPrimary

      I am stuck as of now. The actual code is part of a larger code-base. If there is nothing else I could try, I could create a minimal working program which hopefully reproduces this.

      Thanks in advance.

            Assignee:
            Unassigned Unassigned
            Reporter:
            saszel Sascha Zelzer
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: