Uploaded image for project: 'MongoDB Database Tools'
  1. MongoDB Database Tools
  2. TOOLS-1633

Setting SSLDBConnector.dialError causes data race warnings

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

      Setting SSLDBConnector.dialError in https://github.com/mongodb/mongo-tools/blob/r3.4.2/common/db/openssl/openssl.go#L44 causes race warnings because the DialServer function may be called concurrently. See:

      ==================
      WARNING: DATA RACE
      Write at 0x00c420547b08 by goroutine 264:
        github.com/10gen/mongomirror/vendor/github.com/mongodb/mongo-tools/common/db/openssl.(*SSLDBConnector).Configure.func1()
            /data/mci/09cce1e77449b3dfc85a6c39a30ccafa/src/github.com/10gen/mongomirror/vendor/github.com/mongodb/mongo-tools/common/db/openssl/openssl.go:44 +0x115
        github.com/10gen/mongomirror/vendor/gopkg.in/mgo%2ev2.(*mongoServer).Connect()
            /data/mci/09cce1e77449b3dfc85a6c39a30ccafa/src/github.com/10gen/mongomirror/vendor/gopkg.in/mgo.v2/server.go:173 +0x33d
        github.com/10gen/mongomirror/vendor/gopkg.in/mgo%2ev2.(*mongoServer).AcquireSocket()
            /data/mci/09cce1e77449b3dfc85a6c39a30ccafa/src/github.com/10gen/mongomirror/vendor/gopkg.in/mgo.v2/server.go:129 +0x329
        github.com/10gen/mongomirror/vendor/gopkg.in/mgo%2ev2.(*mongoCluster).syncServer()
            /data/mci/09cce1e77449b3dfc85a6c39a30ccafa/src/github.com/10gen/mongomirror/vendor/gopkg.in/mgo.v2/cluster.go:190 +0x386
        github.com/10gen/mongomirror/vendor/gopkg.in/mgo%2ev2.(*mongoCluster).syncServersIteration.func1.1()
            /data/mci/09cce1e77449b3dfc85a6c39a30ccafa/src/github.com/10gen/mongomirror/vendor/gopkg.in/mgo.v2/cluster.go:518 +0x202
      Previous write at 0x00c420547b08 by goroutine 186:
        github.com/10gen/mongomirror/vendor/github.com/mongodb/mongo-tools/common/db/openssl.(*SSLDBConnector).Configure.func1()
            /data/mci/09cce1e77449b3dfc85a6c39a30ccafa/src/github.com/10gen/mongomirror/vendor/github.com/mongodb/mongo-tools/common/db/openssl/openssl.go:44 +0x115
        github.com/10gen/mongomirror/vendor/gopkg.in/mgo%2ev2.(*mongoServer).Connect()
            /data/mci/09cce1e77449b3dfc85a6c39a30ccafa/src/github.com/10gen/mongomirror/vendor/gopkg.in/mgo.v2/server.go:173 +0x33d
        github.com/10gen/mongomirror/vendor/gopkg.in/mgo%2ev2.(*mongoServer).AcquireSocket()
            /data/mci/09cce1e77449b3dfc85a6c39a30ccafa/src/github.com/10gen/mongomirror/vendor/gopkg.in/mgo.v2/server.go:129 +0x329
        github.com/10gen/mongomirror/vendor/gopkg.in/mgo%2ev2.(*mongoServer).pinger()
            /data/mci/09cce1e77449b3dfc85a6c39a30ccafa/src/github.com/10gen/mongomirror/vendor/gopkg.in/mgo.v2/server.go:304 +0x2c6
      Goroutine 264 (running) created at:
        github.com/10gen/mongomirror/vendor/gopkg.in/mgo%2ev2.(*mongoCluster).syncServersIteration.func1()
            /data/mci/09cce1e77449b3dfc85a6c39a30ccafa/src/github.com/10gen/mongomirror/vendor/gopkg.in/mgo.v2/cluster.go:540 +0x17c
        github.com/10gen/mongomirror/vendor/gopkg.in/mgo%2ev2.(*mongoCluster).syncServersIteration()
            /data/mci/09cce1e77449b3dfc85a6c39a30ccafa/src/github.com/10gen/mongomirror/vendor/gopkg.in/mgo.v2/cluster.go:545 +0x5ac
        github.com/10gen/mongomirror/vendor/gopkg.in/mgo%2ev2.(*mongoCluster).syncServersLoop()
            /data/mci/09cce1e77449b3dfc85a6c39a30ccafa/src/github.com/10gen/mongomirror/vendor/gopkg.in/mgo.v2/cluster.go:355 +0x1b6
      Goroutine 186 (running) created at:
        github.com/10gen/mongomirror/vendor/gopkg.in/mgo%2ev2.newServer()
            /data/mci/09cce1e77449b3dfc85a6c39a30ccafa/src/github.com/10gen/mongomirror/vendor/gopkg.in/mgo.v2/server.go:89 +0x230
        github.com/10gen/mongomirror/vendor/gopkg.in/mgo%2ev2.(*mongoCluster).server()
            /data/mci/09cce1e77449b3dfc85a6c39a30ccafa/src/github.com/10gen/mongomirror/vendor/gopkg.in/mgo.v2/cluster.go:409 +0x12e
        github.com/10gen/mongomirror/vendor/gopkg.in/mgo%2ev2.(*mongoCluster).syncServersIteration.func1.1()
            /data/mci/09cce1e77449b3dfc85a6c39a30ccafa/src/github.com/10gen/mongomirror/vendor/gopkg.in/mgo.v2/cluster.go:517 +0x1e2
      ==================
      Found 1 data race(s)
      

      Removing `dialError` should fix the problem and the error from dialing will still be returned.

            Assignee:
            shane.harvey@mongodb.com Shane Harvey
            Reporter:
            shane.harvey@mongodb.com Shane Harvey
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: