Skip to content

Data race on Dial #178

Closed
Closed
@seriousben

Description

@seriousben

Just saw a data race, on Dial.

The typical scenario where we have seen this happen is when multiple sessions are opened against the same mongo cluster/server. We know we should use session.Copy, but in tests we actually want a separate Dial.

Using revision: efe0945

WARNING: DATA RACE
Write at 0x00c42043b548 by goroutine 133:
  /vendor/github.com/globalsign/mgo.DialWithInfo()
      vendor/github.com/globalsign/mgo/session.go:602 +0x55e
  ...

Previous read at 0x00c42043b548 by goroutine 196:
  /vendor/github.com/globalsign/mgo.(*mongoCluster).server()
      vendor/github.com/globalsign/mgo/cluster.go:442 +0x83
  /vendor/github.com/globalsign/mgo.(*mongoCluster).syncServersIteration.func1.1()
      vendor/github.com/globalsign/mgo/cluster.go:556 +0x1da

Goroutine 133 (running) created at:
  testing.(*T).Run()
      /usr/local/go/src/testing/testing.go:824 +0x564
  testing.tRunner()
      /usr/local/go/src/testing/testing.go:777 +0x16d

Goroutine 196 (running) created at:
  /vendor/github.com/globalsign/mgo.(*mongoCluster).syncServersIteration.func1()
      vendor/github.com/globalsign/mgo/cluster.go:529 +0x174
  /vendor/github.com/globalsign/mgo.(*mongoCluster).syncServersIteration()
      vendor/github.com/globalsign/mgo/cluster.go:584 +0x490
  /vendor/github.com/globalsign/mgo.(*mongoCluster).syncServersLoop()
      vendor/github.com/globalsign/mgo/cluster.go:392 +0x17b

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions