Passing a nil context to cursor.Close triggered a panic that then caused the application to hang. The Go tracer identified the following stack trace:
noformat
runtime.selectgo:392
github.com/mongodb/mongo-go-driver/vendor/golang.org/x/sync/semaphore.(*Weighted).Acquire:64
github.com/mongodb/mongo-go-driver/core/connection.(*pool).Disconnect:131
github.com/mongodb/mongo-go-driver/core/topology.(*Server).Disconnect:164
github.com/mongodb/mongo-go-driver/core/topology.(*Topology).removeServer:422
github.com/mongodb/mongo-go-driver/core/topology.(*Topology).Disconnect:155
github.com/mongodb/mongo-go-driver/mongo.(*Client).Disconnect:109
github.com/mongodb/mongo-tools-common/db.(*SessionProvider).Close:124
runtime.call32:573
runtime.gopanic:502
runtime.panicmem:63
runtime.sigpanic:388
github.com/mongodb/mongo-go-driver/core/connection.(*pool).get:176
github.com/mongodb/mongo-go-driver/core/connection.(*pool).Get:163
github.com/mongodb/mongo-go-driver/core/topology.(*Server).Connection:180
github.com/mongodb/mongo-go-driver/core/topology.(*cursor).Close:148
github.com/mongodb/mongo-tools/mongodump.(*MongoDump).CreateIntentsForDatabase:379
github.com/mongodb/mongo-tools/mongodump.(*MongoDump).CreateAllIntents:416
github.com/mongodb/mongo-tools/mongodump.(*MongoDump).Dump:263
main.main:92
noformat