weaver icon indicating copy to clipboard operation
weaver copied to clipboard

live-check (continuous OTLP mode): memory grows with every sample, also with `--no-stats` and `--output none`

Open Lorenzofini opened this issue 3 weeks ago • 2 comments

Weaver version: 0.28.0 (otel/weaver:v0.28.0), registry in definition/2 with two dependencies (semantic-conventions v1.45.0 and semantic-conventions-genai).

What happens We run registry live-check as a long-lived service behind an OpenTelemetry Collector, which sends it a sample of the traffic. Its memory grows linearly with the number of samples received, and never goes down, even after traffic stops. In Kubernetes it reached its 512Mi limit in about an hour and was OOM-killed repeatedly.

Reproduction

docker network create wv
docker run -d --name wv --network wv -v $PWD:/reg -w /reg otel/weaver:v0.28.0 \
  registry live-check -r /reg/model --input-source otlp --otlp-grpc-address 0.0.0.0 \
  --otlp-grpc-port 4317 --inactivity-timeout 0 --output none --no-stats --fail-on none
docker run --rm --network wv ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen:v0.164.0 \
  traces --otlp-endpoint wv:4317 --otlp-insecure --rate 200 --duration 150s --service test
docker stats --no-stream wv

Measured (200 traces/s, two spans each)

Flags start 50 s 100 s 150 s 20 s after traffic stopped
--output none --no-stats --emit-otlp-logs 38 MiB 101 MiB 160 MiB 218 MiB 218 MiB
--output none --no-stats 37 MiB 99 MiB 158 MiB 216 MiB 216 MiB
--output none (statistics on) 37 MiB 99 MiB 158 MiB 216 MiB 216 MiB

That is about 6 KiB retained per trace, independently of --no-stats and of --emit-otlp-logs.

Expected With --no-stats ("useful for long-running sessions") and --output none, nothing is reported at the end, so samples should not be retained after they are checked. Memory should stay flat under constant traffic.

Possibly related 0.27.0: "Live-check reports now retain OTLP context on their samples". If samples are kept for the final report, they may be kept even when no report is produced.

Workaround we use A Kubernetes livenessProbe that restarts the container when its RSS goes above a threshold.

Lorenzofini avatar Nov 10 '26 09:11 Lorenzofini

Thanks for the detailed report. I tried to reproduce this with otel/weaver:v0.28.0 (arm64 and amd64), telemetrygen v0.164.0 at 200 traces/s, and v2 registries depending on semantic-conventions v1.45.0 and semantic-conventions-genai, using your flags. Memory stayed flat in every run (e.g. 33 → 38 MiB on amd64, no growth after the first seconds). Since your command mounts your repo as the working directory, could you share any .weaver.toml there (matchers, finding filters, search_all_attributes, etc.), and ideally a minimal registry that shows the growth? It would also help to know whether the growth still happens with that config file removed.

jerbly avatar Nov 11 '26 01:11 jerbly

Thanks for looking into this — you were right, the growth comes from our config, not from Weaver.

Our image copies the registry's .weaver.toml into the working directory, and that file sets [live-check] no_stream = true (meant for CI runs on finite input). In continuous OTLP mode this keeps every sample for a report that is never rendered.

Same image and flags, 200 traces/s for 4 minutes:

start 120 s end of traffic 40 s later
no_stream = true from the file 54 MiB 156 MiB 227 MiB 227 MiB
--no-stream=false 43 MiB 43 MiB 43 MiB 43 MiB

The findings emitted with --emit-otlp-logs are the same in both cases.

A suggestion: Weaver could warn (or skip accumulating) when no_stream is combined with OTLP input and --inactivity-timeout 0 or --output none, since the report can never be produced. Feel free to close.

Lorenzofini avatar Nov 30 '26 08:11 Lorenzofini