[GODRIVER-1224] Race detected in x/mongo/driver/topology Created: 09/Aug/19  Updated: 28/Oct/23  Resolved: 13/Aug/19

Status: Closed
Project: Go Driver
Component/s: Core API
Affects Version/s: None
Fix Version/s: 1.1.0

Type: Bug Priority: Major - P3
Reporter: David Golden Assignee: Isabella Siu (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

Found during mongomirror testing.  Driver vended at  commit 58da8e604dddd89f6c03a5ecf3cb406e646685df from master branch.

WARNING: DATA RACE
Read at 0x00c0000eea50 by goroutine 90:
  github.com/10gen/mongomirror/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology.(*pool).get()
      /Users/david/golang/src/github.com/10gen/mongomirror/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/pool.go:164 +0x26f
  github.com/10gen/mongomirror/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology.(*Server).Connection()
      /Users/david/golang/src/github.com/10gen/mongomirror/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/server.go:206 +0x110
  github.com/10gen/mongomirror/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology.(*SelectedServer).Connection()
      <autogenerated>:1 +0x78
  github.com/10gen/mongomirror/vendor/go.mongodb.org/mongo-driver/x/mongo/driver.Operation.Execute()
      /Users/david/golang/src/github.com/10gen/mongomirror/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation.go:232 +0x218
  github.com/10gen/mongomirror/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation.(*Insert).Execute()
      /Users/david/golang/src/github.com/10gen/mongomirror/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/insert.go:105 +0x4b4
  github.com/10gen/mongomirror/vendor/go.mongodb.org/mongo-driver/mongo.(*Collection).insert()
      /Users/david/golang/src/github.com/10gen/mongomirror/vendor/go.mongodb.org/mongo-driver/mongo/collection.go:287 +0xa0f
  github.com/10gen/mongomirror/vendor/go.mongodb.org/mongo-driver/mongo.(*Collection).InsertOne()
      /Users/david/golang/src/github.com/10gen/mongomirror/vendor/go.mongodb.org/mongo-driver/mongo/collection.go:302 +0x39c
  github.com/10gen/mongomirror/mongomirror.sourceFailoverTestCase.func1()
      /Users/david/golang/src/github.com/10gen/mongomirror/mongomirror/mongomirror_internal_test.go:5374 +0x35b
 
Previous write at 0x00c0000eea50 by goroutine 55:
  sync/atomic.AddInt64()
      /usr/local/go/src/runtime/race_amd64.s:276 +0xb
  github.com/10gen/mongomirror/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology.(*Server).ProcessError()
      /Users/david/golang/src/github.com/10gen/mongomirror/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/pool.go:75 +0xbe9
  github.com/10gen/mongomirror/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology.(*SelectedServer).ProcessError()
      <autogenerated>:1 +0x6d
  github.com/10gen/mongomirror/vendor/go.mongodb.org/mongo-driver/x/mongo/driver.Operation.Execute()
      /Users/david/golang/src/github.com/10gen/mongomirror/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation.go:332 +0x2d7b
  github.com/10gen/mongomirror/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation.(*Command).Execute()
      /Users/david/golang/src/github.com/10gen/mongomirror/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/command.go:73 +0x2eb
  github.com/10gen/mongomirror/vendor/go.mongodb.org/mongo-driver/mongo.(*Database).RunCommand()
      /Users/david/golang/src/github.com/10gen/mongomirror/vendor/go.mongodb.org/mongo-driver/mongo/database.go:171 +0x23f
  github.com/10gen/mongomirror/mongomirror.sourceFailoverTestCase()
      /Users/david/golang/src/github.com/10gen/mongomirror/mongomirror/mongomirror_internal_test.go:5421 +0x828
  github.com/10gen/mongomirror/mongomirror.TestSourceFailoverApplyingOplog()
      /Users/david/golang/src/github.com/10gen/mongomirror/mongomirror/mongomirror_internal_test.go:5543 +0x575
  testing.tRunner()
      /usr/local/go/src/testing/testing.go:865 +0x163

 



 Comments   
Comment by Githook User [ 13/Aug/19 ]

Author:

{'name': 'iwysiu', 'email': 'isabella.siu@10gen.com', 'username': 'iwysiu'}

Message: GODRIVER-1224 fix race condition in topology.pool

Change-Id: Ib283caf6e786a0e0636a9e462c12a0e8c395dbcd
Branch: master
https://github.com/mongodb/mongo-go-driver/commit/2a811e3d4bc9ee76c0f9a2e4f974f936b50c9572

Comment by Isabella Siu (Inactive) [ 12/Aug/19 ]

code review url: https://review.gerrithub.io/c/mongodb/mongo-go-driver/+/464955

Generated at Thu Feb 08 08:35:57 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.