Details
-
Bug
-
Resolution: Fixed
-
Major - P3
-
1.3.0
-
Linux
Description
I've noticed new issues recently.
I don't know if it's related to the v1.3.0 update, but it never happened before.
Some MongoDB queries are stuck indefinitely.
It happens for different types of queries: run command, find.
Here is the common part of the stack trace:
go.mongodb.org/mongo-driver/x/mongo/driver/topology.(*connection).wait(...)
|
/home/travis/gopath/pkg/mod/go.mongodb.org/mongo-driver@v1.3.0/x/mongo/driver/topology/connection.go:181 |
go.mongodb.org/mongo-driver/x/mongo/driver/topology.(*pool).closeConnection(0xc000410780, 0xc0008dce00, 0x0, 0xd7dd60) |
/home/travis/gopath/pkg/mod/go.mongodb.org/mongo-driver@v1.3.0/x/mongo/driver/topology/pool.go:417 +0x1f9 |
go.mongodb.org/mongo-driver/x/mongo/driver/topology.(*connection).close(0xc0008dce00, 0xc000c741c8, 0xc00041d9d0) |
/home/travis/gopath/pkg/mod/go.mongodb.org/mongo-driver@v1.3.0/x/mongo/driver/topology/connection.go:302 +0x97 |
go.mongodb.org/mongo-driver/x/mongo/driver/topology.(*connection).readWireMessage(0xc0008dce00, 0xd8aae0, 0xc000099740, 0xc0004d1400, 0x0, 0x200, 0xc0008dce00, 0xd8aae0, 0xc000099740, 0xc0004d1400, ...) |
/home/travis/gopath/pkg/mod/go.mongodb.org/mongo-driver@v1.3.0/x/mongo/driver/topology/connection.go:262 +0x4d8 |
go.mongodb.org/mongo-driver/x/mongo/driver/topology.initConnection.ReadWireMessage(0xc0008dce00, 0xd8aae0, 0xc000099740, 0xc0004d1400, 0x0, 0x200, 0xc0004d1400, 0x10e, 0x200, 0x0, ...) |
/home/travis/gopath/pkg/mod/go.mongodb.org/mongo-driver@v1.3.0/x/mongo/driver/topology/connection.go:351 +0x6a |
go.mongodb.org/mongo-driver/x/mongo/driver.Operation.roundTrip(0xc000d74360, 0xba7b6c, 0x5, 0xd89b60, 0xc000d74370, 0xc000d74380, 0x0, 0x0, 0x0, 0x0, ...) |
/home/travis/gopath/pkg/mod/go.mongodb.org/mongo-driver@v1.3.0/x/mongo/driver/operation.go:552 +0x401 |
go.mongodb.org/mongo-driver/x/mongo/driver.Operation.Execute(0xc000d74360, 0xba7b6c, 0x5, 0xd89b60, 0xc000d74370, 0xc000d74380, 0x0, 0x0, 0x0, 0x0, ...) |
/home/travis/gopath/pkg/mod/go.mongodb.org/mongo-driver@v1.3.0/x/mongo/driver/operation.go:367 +0xc06 |
go.mongodb.org/mongo-driver/x/mongo/driver/operation.(*IsMaster).GetDescription(0xc000cda9a0, 0xd8aae0, 0xc000099740, 0xc0004243fa, 0x2b, 0xd8efa0, 0xc0008dce00, 0x0, 0x0, 0x0, ...) |
/home/travis/gopath/pkg/mod/go.mongodb.org/mongo-driver@v1.3.0/x/mongo/driver/operation/ismaster.go:418 +0x1ec |
go.mongodb.org/mongo-driver/x/mongo/driver/topology.(*connection).connect(0xc0008dce00, 0xd8aae0, 0xc000099740) |
/home/travis/gopath/pkg/mod/go.mongodb.org/mongo-driver@v1.3.0/x/mongo/driver/topology/connection.go:133 +0x2ac |
go.mongodb.org/mongo-driver/x/mongo/driver/topology.(*pool).get(0xc000410780, 0xd8aba0, 0xc0009ade90, 0x1, 0x0, 0x0) |
/home/travis/gopath/pkg/mod/go.mongodb.org/mongo-driver@v1.3.0/x/mongo/driver/topology/pool.go:380 +0x73c |
go.mongodb.org/mongo-driver/x/mongo/driver/topology.(*Server).Connection(0xc0008bc160, 0xd8aba0, 0xc0009ade90, 0x0, 0x0, 0x0, 0x0) |
/home/travis/gopath/pkg/mod/go.mongodb.org/mongo-driver@v1.3.0/x/mongo/driver/topology/server.go:243 +0x1ea |
go.mongodb.org/mongo-driver/x/mongo/driver.Operation.Execute(0xc0012038d0, 0xc000424682, 0xe, 0xd88660, 0xc00028a000, 0xc0012038e0, 0xd7ed80, 0xc000279040, 0xc0000adf80, 0xc00027e220, ...) |
/home/travis/gopath/pkg/mod/go.mongodb.org/mongo-driver@v1.3.0/x/mongo/driver/operation.go:246 +0x207 |
I read quickly the source code, and I think there is a deadlock.
The connection.wait() function call is waiting for a channel to be closed.
As far as I know, this channel is closed only in another function call: connection.connect(). (defer)
But this function call is already in the calls stack, so the channel will never be closed.
That's why I think there is a deadlock.