Details
-
Bug
-
Resolution: Cannot Reproduce
-
Unknown
-
None
-
1.9.1, 1.11.1
-
None
-
None
Description
Summary
Go application experiences behavior where the application runs okay for a while but then over time gradually begins to consume more CPU until 100% of 1 CPU is consumed and the application mostly stops responding.
The application is reading messages from a collection via a tailable cursor. As the application increases in CPU usage, the number of goroutines increase:
go.mongodb.org/mongo-driver/x/mongo/driver/topology.(*connection).write.func2 N=XX
go.mongodb.org/mongo-driver/x/mongo/driver/topology.(*connection).read.func2 N=XX
N starts out small - under 10 and then increases to over 700 for both write and read. I have ran the command `db.currentOp(true)` on the Mongo server to ensure connections are not being leaked and most of the time the application only has 3-5 connections.
The application is processing the messages one at a time so it should not require a large number of connections to Mongo.
Please provide the version of the driver. If applicable, please provide the MongoDB server version and topology (standalone, replica set, or sharded cluster).
Mongo version: 5.0.14
Go version: 1.19.5
Reproduced on mongo driver versions 1.9.1 and 1.11.1.
How to Reproduce
Do not have a reproducible test case outside of application.
Additional Background
If problem is in application code, need some guidance on what kind of application code would cause a very high number of connection read/write goroutines but a low number of database connections.