Wrong MongoDB instrumentation configuration leads to memory leaks
See original GitHub issueNow, brave mongo instrumentation uses thread-local variables to keep stacks of spans, so it can’t be used in an asynchronous environment.
Brave mongo client instrumentation is enabled when mongodb-driver-core is on the classpath, which is also used as a part of the asynchronous mongodb driver mongodb-driver-reactivestreams.
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (6 by maintainers)
Top Results From Across the Web
Suspect that $exists is causing a memory leak - MongoDB
The query takes a very long time and fills all the RAM, and as a result the connection to the MongoDB server breaks....
Read more >Memory leak with Mongo Java Connection - Stack Overflow
The mongo client is trying to connect to a mongos instance.The application has 3 replica sets on 3 shards and one config server...
Read more >Spring MongoDB Monitoring - TechDocs
You can view Spring MongoDB backend request metrics, including request details. Spring MongoDB Monitoring is bundled with the Java Agent.
Read more >Node.js Memory Leak Detection: How to Debug & Avoid Them
Memory leaks often go unnoticed. This is why I suggest using a tool to keep track of historical data of garbage collection cycles...
Read more >Avoiding Memory Leaks in Node.js: Best Practices for ...
Multiple references : When the same object is referenced from multiple objects, it might lead to a memory leak when one of the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

With Mongodb version 4.2 the internals are rewritten to use Reactor. Since we’re already instrumenting project reactor things just work out of the box. We could leverage the builder customizer again regardless of whether it’s reactive or not. WDYT @jonatan-ivanov , @beatfreaker , @ppressives ?
Ok I did another analysis and indeed there is improvement in comparison to mongo 4.1.x but the thread local span does not continue the trace from the reactor context. This would need to be improved somehow… cc @mp911de