Description
There seems to be some memory leak in the OpenTelemtery SDK (0.28.x)
the test run is 30hrs and the leak is 25G by the end of the run.
Running our agent against the DHAT we see that call to send seems to be where the leak resides.
attached is a dhat report for a run (short) for my testing..
dhat heap json contains the results of my run dhat-heap1.json
RCA:
The use pattern for sending data using the observable APIs, is to provide a closure to the with_callback()
function to send the data that is captured by the closure.
with_callback calls Box::new()
which allocates memory for the closure on the heap.. however, was not able to find code that would drop the allocation..
The following snippet is the pattern to be able to send data.. it is call repeatedly for each new data needs to be sent.
meter
.i64_observable_gauge(metric_name)
.with_callback(move |observer| {
observer.observe(data, &attributes)
})
.build();
All of the Observable APIs follow the above pattern, will cause memory leaks.