OpenTelemetry.jl
OpenTelemetry.jl copied to clipboard
Memory leak when using the `/metrics` endpoint (PrometheusExporter)
I've identified a memory leak in a long running service coming from OpenTelemetry.
I'm attaching an MWE split off from the main service, which can reproduce the issue identically The example attached is pretty extreme and can get you to ~2GB memory usage in about 10 minutes.
The leak is dependent on measure activity and capturing measures through the /metrics
endpoint.
-
metricsspam
emulates a running service, which generates some metric activity - for emulating metrics capture we use
ab
to call the/metrics
endpoint extensively
Version info: julia 1.9.3, linux OpenTelemetry versions as the attached Manifest.toml or simpler, this repo at commit https://github.com/oolong-dev/OpenTelemetry.jl/commit/4975ecddf521f4fa930d4bc8964c0b8a91301039
subdir="src/api", # 0.3.0
subdir="src/sdk", # 0.2.1
subdir="src/proto", # 0.13.1
subdir="src/exporter/otlp/proto/grpc", # 0.2.1
subdir="src/exporter/prometheus", # 0.1.4
Reproducer: memleak.zip
Tar contents:
- run.jl - reproducer code
- make.jl - code to generate project/manifest with exact package revisions used
- Project.toml/Manifest.toml
Steps:
- extract the zip
- run the reproducer using
julia --project=. -e "include(\"run.jl\");init();"
- run the metrics capture emulation using
ab -c 500 -n 1000000 http://localhost:9967/
- observe endlessly rising memory usage in the process monitoring tool of your choice
Example runtime (~4gb in 25min)