Skip to content

fix(k8s): a trace search OOM-kills Tempo #6616

Closed

Description

@dan-petty

Problem Description

Two reads of the Tempo HTTP API OOM-killed the pod tempo-0 in the namespace otel on 2026-11-21. The memory limit of the pod is 2048Mi (k8s/otel/tempo-values.yaml), and the values set no limit on a search or on the size of a trace. While the pod restarted, a person or a job could not read a trace, and the pod did not get the spans of that time.

Reproduction Steps

  1. Run kubectl -n otel port-forward svc/tempo 13200:3200.
  2. Send about 10 requests, one after the other: GET /api/search?q={name="invoke_agent agent"}&start=<t-900>&end=<t+120>&limit=50&spss=20 over a busy hour, and GET /api/traces/<id> for each trace that the search returns.
  3. Read the pod state: kubectl -n otel get pod tempo-0.

Expected vs Actual Behavior

Expected: Tempo refuses or cuts a read that is too large, and the pod stays up.
Actual: the container stopped with OOMKilled (exit code 137) two times, at 07:07 and at 07:08:31 UTC. The restart count went to 2.

Logs, Traces, or Terminal Output

kubectl -n otel get pod tempo-0 -o jsonpath='{.status.containerStatuses[0].lastState}' gave {"terminated":{"exitCode":137,"finishedAt":"2026-11-21T07:08:31Z","reason":"OOMKilled"}}. A port-forward showed lost connection to pod.

Found during #6394. The fix belongs in k8s/otel/tempo-values.yaml: set query limits of Tempo, such as max_bytes_per_trace and the search limits of the query frontend, under the memory limit.

Alternatives check of 2026-11-21: in-use.
The repository already uses this tool.
Tool: grafana/tempo (https://github.com/grafana/tempo), AGPL-3.0, last activity 2026-11-21, maintained.
Reason: Searches found no separate tool: Grafana Tempo, already the project's tracing backend, ships the search byte, result, duration and concurrency limits the fix needs, so only the Helm values change.

Covers:

  • Caps bytes per trace read by search
  • Caps result count and search duration
  • Caps concurrent queries and outstanding queries per tenant

Lacks:

  • No default limits sized for a 2048Mi pod
  • No memory-aware cut based on live usage
  • Limits must be set by hand in the chart values

Proposed design

Problem statement

Two reads of the Tempo HTTP API OOM-killed the pod tempo-0 at the 2048Mi memory limit. The Tempo Helm values set no limit on a search or on the size of a trace. The fix sets Tempo query frontend and querier limits under the memory limit in k8s/otel/tempo-values.yaml.

Acceptance criteria

Requirement: Tempo query limits

The Tempo Helm values SHALL set the Tempo search, trace byte and query concurrency limits under the 2048Mi pod memory limit.

Scenario: Kubernetes manifest validation

  • WHEN I run uv run devops ci --check --only k8s
  • THEN The k8s check passes and reports no error for k8s/otel/tempo-values.yaml.

Requirement: Tempo stays up under search

Tempo SHALL refuse or cut an oversized search or trace read without restarting the pod.

Scenario: Ten search and trace reads

  • WHEN I deploy the values and run the ten search and trace reads from the reproduction steps
  • THEN kubectl -n otel get pod tempo-0 shows Running and the restart count does not increase.

Requirement: Deployed Tempo limits

The deployed Tempo configuration MUST show the search, trace byte and concurrency limits under the 2048Mi pod memory limit.

Scenario: Live configuration check

  • WHEN I deploy the values and run kubectl -n otel get configmap -l app.kubernetes.io/name=tempo -o yaml
  • THEN The output shows max_bytes_per_trace: 1000000, max_result_limit: 50, max_duration: 30s, target_bytes_per_second: 25000000, max_outstanding_per_tenant: 10 and max_concurrent_queries: 4.

Existing Tool Considered

Grafana Tempo (https://github.com/grafana/tempo), verdict in-use, per the alternatives check in the issue body. The check lists what the tool covers and lacks. The proposal sets the query frontend and querier limits by hand in k8s/otel/tempo-values.yaml to cover the gap that the check lists, and adds no custom code.

Key questions

  • What memory limit does the Tempo pod have?: The Tempo container has a memory limit of 2048Mi in k8s/otel/tempo-values.yaml. [sources: k8s/otel/tempo-values.yaml]
  • Which Tempo limits keep a search under the 2048Mi memory limit?: Set query_frontend.search.max_bytes_per_trace to 1000000, max_result_limit to 50, max_duration to 30s and target_bytes_per_second to 25000000. Set query_frontend.max_outstanding_per_tenant to 10 and querier.max_concurrent_queries to 4. (best practice) [sources: k8s/otel/tempo-values.yaml]
    • Chosen: Tempo built-in search and concurrency limits. Tempo caps bytes per trace, result count, duration, bytes per second and concurrent queries. The chart accepts these values in its Tempo block.
    • Rejected: Only max_bytes_per_trace. It leaves result count, duration and concurrency unbounded. Ten reads can still exhaust memory.
    • Rejected: A custom proxy that rejects large reads. It adds code to build and keep where Tempo has the limits.
  • Should the fix raise the 2048Mi memory limit instead of setting query limits?: No. Keep the 2048Mi limit and set query limits. A higher limit only delays an OOMKilled stop and increases cluster cost. (best practice) [sources: k8s/otel/tempo-values.yaml]
    • Chosen: Set query limits under the 2048Mi limit. It bounds each search and trace read and keeps the memory budget.
    • Rejected: Raise the memory limit above 2048Mi. It does not bound a large trace read and it spends more memory on the node.
  • How should the change place these limits in the Helm values?: Use the chart's Tempo values for the limits. Do not override the whole tempo.config, because the chart builds the Tempo configuration from its values. (best practice) [sources: k8s/otel/tempo-values.yaml]
    • Chosen: Chart Tempo values. The file header says the chart builds the Tempo config from these values. A full config override would pin one Tempo version's layout.
    • Rejected: Full tempo.config override. It pins a copy of one Tempo version's layout and can break on a Tempo upgrade.
    • Rejected: A separate ConfigMap patch. It adds a second source of Tempo configuration.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    type/bug
    scope/k8s
    source/agent
    status/new
    effort/low
    value/high
    on Nov 21, 2026
  2. dan-petty commented on Nov 21, 2026

    @dan-petty
    OwnerAuthor
  3. added
    priority/p0-critical
    on Nov 21, 2026
  4. devops-cli-service commented on Nov 21, 2026

    @devops-cli-service
    Contributor

    Next step: the alternatives check records a verdict. See the section Proposed design of the body.

  5. devops-cli-service commented on Nov 21, 2026

    @devops-cli-service
    Contributor

    The result in the alternatives block of the issue body changed. Before this check: no check. A person decides what the new result means for the item.

    Searches (9)

    Tools considered:

    Searches run:

    • Grafana Tempo query frontend search max_bytes_per_trace memory limit OOM, results: 5
    • grafana tempo helm chart tempo-values query_frontend max_outstanding_per_tenant, results: 5
    • Tempo search configuration max_result_limit max_duration query frontend docs, results: 5
    • "max_bytes_per_trace" tempo, results: 5
    • grafana.com docs tempo configuration search max_bytes_per_trace, results: 5
    • grafana tempo documentation, results: 5
    • tempo query frontend search limits prevent out of memory, results: 5
    • grafana-community tempo helm chart github repository, results: 5
    • Tempo configuration reference query_frontend search max_duration target_bytes_per_second, results: 5

    Sources:

  6. added
    status/ready
    and removed
    status/new
    on Nov 21, 2026
  7. devops-cli-service commented on Nov 21, 2026

    @devops-cli-service
    Contributor

    Next step: the stage job writes the plan of the item. See the section Proposed design of the body.

  8. added
    owner/service
    on Nov 21, 2026
  9. devops-cli-service commented on Nov 21, 2026

    @devops-cli-service
    Contributor

    Plan state: branch fix/6616-a-trace-search-oom-kills-tempo, draft pull request #6631. The pull request plans the item and closes no issue. The stage job and the step fix-plan edit this comment, and a comment of each run tells what the run did.

    The task groups, with the tokens of the inputs of each step, for a budget of 64000 tokens:

    1. Cap the Tempo search and query concurrency in the chart values: 20829 tokens
    2. Cut the spans of a trace beyond one million bytes as Tempo receives it: 17782 tokens

    A model review of the plan found these points. They stop no draft, and a person judges them:

    • minor spec_delta_wrong at spec workload-resource-limits (The Tempo query limits stay under the memory limit): The scenario "An edited limit fails the row" says the row names the key that differs, but the group 1 check compares all the exact values in one comparison without a per-key message; only the two product assertions name a file and a key, so no test can assert that part of the THEN. Evidence: "The row fails and names k8s/otel/tempo-values.yaml and the key that differs."
    • minor other at design (decisions): The plan decides to assert the literal values of the committed Helm values file in a gate check, which the project's testing rule forbids (a limit or a key of a config file gets no test); the plan relies on the gate exemption in config_values.py instead of the live check of the deployed configuration that the issue's criterion names. Evidence: "No test asserts a value of a manifest or of a config file: a version, a tag, a digest, a model name, a limit, a mode, a key, a port, an interval or the content of a table."
  10. 20 remaining items

  11. added
    status/in-progress
    and removed
    status/planned
    on Nov 21, 2026
  12. added
    status/in-review
    and removed
    status/in-progress
    on Nov 21, 2026
  13. devops-cli-service commented on Nov 21, 2026

    @devops-cli-service
    Contributor

    The draft pull request #6669 holds the final title and body. In mode on of roadmap.fix_checks.mode, the watch row marks it ready when its checks pass, and a fix-checks Job repairs a failed check whose name gives the class test, lint or types. In each other case the watch row stops the item: another failed check, a cancelled check, a conflict, a fix-checks Job that ended with no repair, or another mode.

    Spend: 38 model requests, 1431489 input tokens, 13963 output tokens.

  14. removed
    owner/service
    on Nov 21, 2026
  15. removed
    status/in-review
    on Nov 21, 2026
  16. devops-cli-service commented on Nov 21, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-21 19:37 UTC

  17. dan-petty commented on Nov 22, 2026

    @dan-petty
    OwnerAuthor

    The config keys that #6669 added stop Tempo 3.1.1 at start: otel/tempo-0 crash-loops since about 19:30 UTC on 2026-11-21 (field max_bytes_per_trace not found in type frontend.SearchConfig). The fix is #6730 (P0).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/lowpriority/p0-criticalscope/k8ssource/agenttype/bugvalue/high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions