Skip to content

fix(k8s): raise the memory limit of roadmap-service #4149

Closed

Description

@dan-petty

Problem

The Deployment roadmap-service (k8s/devops/roadmap-service/deployment.yaml, resources) requests 256Mi of memory and limits it to 1Gi. The kernel killed the container with OOMKilled two times on 2026-11-08: at 03:06:50Z after 2 h 39 min, and at 10:01:52Z after 3 h 40 min. The metric container_memory_working_set_bytes (container service, namespace devops) grows about 100 to 150 MiB each hour, from 370-460 MiB to more than 860 MiB.

The fix of #4116 (PR #4140: bounded session answers, capped export queue, alert RoadmapServiceMemoryNearLimit) is merged. It is not enough to trust yet:

  • Its own measure showed that the answer store stops near 80 MB. That does not explain the whole growth from 370 to 860 MiB.
  • The image that carries it is not rolled out yet.
  • Each OOM kill restarts the Service. A restart loses the memory state, and a restart is now the first sign of the leak. The alert RoadmapServiceMemoryNearLimit (85 percent of the limit) has no time to warn, because the pod is killed in about 3 hours.

The owner said on 2026-11-08: "Raise the limits a reasonable amount for the task at hand."

Expected

Facts checked for this item:

  • Node room: the smallest node has 32 GB of memory and at most 44 percent is used. A request of 768Mi and a limit of 3Gi fit.
  • Alert rule: RoadmapServiceMemoryNearLimit in k8s/monitoring/prometheus-values.yaml divides the working set by kube_pod_container_resource_limits{resource="memory"}. It holds no literal limit, so the rule needs no change. The test fixture tests/fixtures/prometheus_rules/roadmap_service_tests.yaml sets its own limit series, so it needs no change.
  • Admission policy: k8s/devops/roadmap-service/admissionpolicy.yaml applies to jobs made by the user system:serviceaccount:devops:roadmap-service. It pins the size table of those Jobs only. It does not name the Service Deployment, so it needs no change.
  • Leave k8s/devops/cronjob-runner.yaml (4Gi request, 8Gi limit) and k8s/devops/cronjob.yaml (256Mi request, 1Gi limit, no OOM seen).
  • Rule of rollout: this change sets the Deployment only. No ConfigMap key changes, so no ConfigMap must be applied before the rollout. Argo CD applies it from main. This issue does not change the cluster by hand.

Documents to check with git grep -n -E '1Gi|256Mi':

  • k8s/README.md, Roadmap service: line 739 (alert row, "A rise of the limit only delays the kill") stays true. Add the new request and limit with the reason, and a pointer to fix(service): roadmap-service is OOMKilled after hours #4116, in the Roadmap service section where the Deployment is described. Lines 680-686 name the Jobs (4Gi/8Gi, size table) and stay.
  • openspec/specs/roadmap-service-alerts/spec.md line 343: the requirement reads the limit from the metric. No change.
  • openspec/specs/gitea-forge/spec.md line 69 (256Mi, 1Gi): Gitea, not the Service. No change.
  • tests/server/routes/test_k8s_roadmap_service.py line 127 (1Gi): the storage of the PVC, not the memory. No change.
  • k8s/devops/roadmap-service/pvc.yaml: storage, not memory. No change.

Acceptance criteria

  • The memory limit of the Service container is 3Gi. This command fails today (it prints 1Gi):
    uv run python -c "import yaml,sys; c=yaml.safe_load(open('k8s/devops/roadmap-service/deployment.yaml'))['spec']['template']['spec']['containers'][0]['resources']; sys.exit(0 if c['limits']['memory']=='3Gi' else print(c['limits']['memory']) or 1)"
  • The memory request of the Service container is 768Mi, and the CPU values stay 100m and 1. This command fails today (the request is 256Mi):
    uv run python -c "import yaml,sys; c=yaml.safe_load(open('k8s/devops/roadmap-service/deployment.yaml'))['spec']['template']['spec']['containers'][0]['resources']; sys.exit(0 if (c['requests']['memory'],c['requests']['cpu'],c['limits']['cpu'])==('768Mi','100m','1') else 1)"
  • A new test test_deployment_memory_is_sized_for_the_observed_growth in tests/server/routes/test_k8s_roadmap_service.py reads the Deployment and holds the request, the limit and the CPU values above. It fails today because the limit is 1Gi:
    uv run pytest tests/server/routes/test_k8s_roadmap_service.py -k observed_growth
  • The test also holds that the limit is at least 10 hours of growth at 150 MiB each hour above 460 MiB (one number in the test, with its source named in a comment), so a later cut of the limit fails the test and names fix(service): roadmap-service is OOMKilled after hours #4116.
  • The Alertmanager rule reads the limit from the metric. This command still passes after the change, and the rule holds no literal limit:
    uv run pytest tests/prometheus/test_k8s_monitoring_alerting.py -k RoadmapServiceMemoryNearLimit
  • k8s/README.md names the request, the limit and the reason in the Roadmap service section, and says that fix(service): roadmap-service is OOMKilled after hours #4116 holds the fix:
    grep -n '3Gi' k8s/README.md | grep -i 'roadmap service' (fails today)
  • uv run devops ci --check --only k8s,docs,openspec passes.
  • The Deployment manifests no other change. git diff --stat origin/main shows deployment.yaml, k8s/README.md and the test file only (plus the OpenSpec change folder).

Existing tool considered

  • The Vertical Pod Autoscaler (upstream Kubernetes autoscaler) can set requests from observed use. It does not stop a leak, it needs a new controller in the cluster, and the homelab keeps the request in git (Argo CD with prune and self-heal). It is not used for one Deployment.
  • Kubernetes LimitRange and ResourceQuota set a default, not the size of one Deployment. Not used.
  • The alert RoadmapServiceMemoryNearLimit (kubelet and kube-state-metrics series) is the tool that shows the leak. It stays.
  • A heap measure of the live pod (for example memray, or tracemalloc from the standard library) finds the cause. It is the work of fix(service): roadmap-service is OOMKilled after hours #4116, not of this issue.

Cost

  • Build: one edit of 2 values and a comment in deployment.yaml, one test of about 15 lines, and 2 sentences in k8s/README.md. About 25,000 tokens and 20 minutes including the CI run.
  • Keep: no new code path. One number to revisit when fix(service): roadmap-service is OOMKilled after hours #4116 is fixed (lower the limit again, or keep it if the working set is flat).
  • Fix cost if it goes wrong: a Deployment edit and a rollout. The raise uses up to 2.25Gi more memory on one node, which has room.
  • Cost of no change: the Service restarts about every 3 hours, the restart loses its memory state, and the alert has no time to warn.

Related

Proposed design

Problem statement

The kernel killed the container of Deployment roadmap-service with OOMKilled two times on 2026-11-08. The working set grows about 100 to 150 MiB each hour, and it passed 860 MiB. The fix #4116 is merged but not rolled out, and a restart is now the first sign of the leak. This change raises the memory request to 768Mi and the memory limit to 3Gi as a stopgap, so the pod runs about a day and the alert RoadmapServiceMemoryNearLimit warns before a kill.

Acceptance criteria

Requirement: Memory limit is 3Gi

The memory limit of container service of Deployment roadmap-service SHALL be 3Gi.

Scenario: The limit of the Deployment

  • WHEN A test reads spec.template.spec.containers[0].resources.limits.memory of k8s/devops/roadmap-service/deployment.yaml.
  • THEN The value is 3Gi.

Requirement: Memory request and CPU values

The memory request SHALL be 768Mi, and the CPU request and the CPU limit SHALL stay 100m and 1.

Scenario: The request and the CPU values

  • WHEN A test reads the requests and the limits of that container.
  • THEN The tuple of memory request, CPU request and CPU limit is ('768Mi', '100m', '1').

Requirement: A test holds the sizes

The test test_deployment_memory_is_sized_for_the_observed_growth in tests/server/routes/test_k8s_roadmap_service.py SHALL hold the memory request, the memory limit and the CPU values.

Scenario: The new test on the base commit

  • WHEN uv run pytest tests/server/routes/test_k8s_roadmap_service.py -k observed_growth runs on the base commit.
  • THEN The test fails there, because the limit is 1Gi, and it passes with the new sizes.

Requirement: The limit holds 10 hours of growth

The test SHALL hold that the limit is at least 10 hours of growth at 150 MiB each hour above 460 MiB, as one number with its source in a comment that names #4116.

Scenario: A later cut of the limit

Requirement: The comment names the stopgap and #4116

A comment above resources in the Deployment SHALL say that the raise is a stopgap with a reason and SHALL link #4116.

Scenario: The comment above resources

  • WHEN A test reads the lines above resources in k8s/devops/roadmap-service/deployment.yaml.
  • THEN The comment holds the word stopgap and the text #4116.

Requirement: The memory alert reads the limit from the metric

The rule RoadmapServiceMemoryNearLimit SHALL keep reading the memory limit from kube_pod_container_resource_limits and SHALL hold no literal limit.

Scenario: The alert rule test

  • WHEN uv run pytest tests/prometheus/test_k8s_monitoring_alerting.py -k RoadmapServiceMemoryNearLimit runs.
  • THEN The test passes, and the rule of k8s/monitoring/prometheus-values.yaml holds no literal memory limit.

Requirement: The README names the sizes and the reason

The Roadmap service section of k8s/README.md SHALL name the 768Mi request, the 3Gi limit, the reason for the raise and that #4116 holds the fix.

Scenario: The Roadmap service section

  • WHEN A test reads the Roadmap service section of k8s/README.md.
  • THEN The section names 768Mi, 3Gi, #4116 and the reason for the raise.

Requirement: The change touches only the named files

The change SHALL touch only k8s/devops/roadmap-service/deployment.yaml, k8s/README.md, tests/server/routes/test_k8s_roadmap_service.py and the OpenSpec change folder.

Scenario: The diff against the default branch

  • WHEN git diff --stat origin/main runs on the branch of the change.
  • THEN It lists those files only.

Requirement: The scoped checks pass

The command uv run devops ci --check --only k8s,docs,openspec MUST pass.

Scenario: The scoped checks

  • WHEN uv run devops ci --check --only k8s,docs,openspec runs on the branch of the change.
  • THEN It exits 0.

Existing Tool Considered

No alternatives check has run. The Vertical Pod Autoscaler is the open, maintained tool that partly covers the need. It sets requests from observed use, but it does not stop a leak, it needs a new controller in the cluster, and the homelab keeps the request in git under Argo CD with prune and self-heal. Kubernetes LimitRange and ResourceQuota set a namespace default, not the size of one Deployment. The written cost of the hand edit is about 25,000 tokens and 20 minutes, with the CI run included, and one number to revisit when #4116 is fixed.

Key questions

  • Which memory limit lets the pod run about a day and lets the alert fire before a kill?: 3Gi. At 150 MiB each hour from 460 MiB the working set reaches 3Gi after about 21 hours, and the rule fires at 85 percent of the limit, about 2.5Gi, well before that. (best practice) [sources: k8s/monitoring/prometheus-values.yaml, k8s/devops/roadmap-service/deployment.yaml]
    • Chosen: 3Gi limit with a 768Mi request. It holds about 21 hours at the worst observed rate, and 85 percent of it is a point the alert can warn at.
    • Rejected: 2Gi limit. At 150 MiB each hour it is reached in about 10 hours, which is short of the day the body expects.
    • Rejected: 4Gi limit or more. It spends node memory for no gain, and the growth stays a leak that fix(service): roadmap-service is OOMKilled after hours #4116 must fix.
  • Does the admission policy or a LimitRange need a change for the new sizes?: No. ValidatingAdmissionPolicy roadmap-service-jobs pins the size table of the runner Jobs that the Service makes, and it does not name the Service Deployment. No LimitRange of namespace devops applies. [sources: k8s/devops/roadmap-service/admissionpolicy.yaml]
  • Does the alert rule or its promtool fixture need a change?: No. The rule divides the working set by kube_pod_container_resource_limits{resource="memory"}, so it reads the new limit. The fixture sets its own limit series. [sources: k8s/monitoring/prometheus-values.yaml, tests/fixtures/prometheus_rules/roadmap_service_tests.yaml]
  • Where does k8s/README.md record the new sizes?: In the Roadmap service section, at the row of RoadmapServiceMemoryNearLimit and the sentence that a rise of the limit only delays the kill. [sources: k8s/README.md:739]
  • Does the change need a ConfigMap key or a hand change to the cluster?: No. The change sets the Deployment only, and Argo CD applies it from main. Argo CD self-heals the Deployment, so no person changes the cluster by hand. [sources: k8s/devops/roadmap-service/deployment.yaml, k8s/README.md]
  • Do the sizes of the CronJobs change?: No. CronJob devops-cli-runner keeps its 4Gi request and 8Gi limit, and CronJob devops-cli keeps its 256Mi request and 1Gi limit. [sources: k8s/devops/cronjob-runner.yaml, k8s/devops/cronjob.yaml]

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

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

    @dan-petty
    OwnerAuthor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.

    • Type: type/bug. The fix prefix of the title gives the type.
    • Scope: scope/k8s. The (k8s) scope of the title gives the scope.
    • Priority: P1-High. The service is OOMKilled every three hours and the owner requested the raise on 2026-11-08.
    • Value: High. Prevents repeated OOMKilled restarts of a running service until the leak fix is validated.
    • Effort: Low. Changes two values in one YAML file and adds a comment and a README line.
    • Related: fix(service): roadmap-service is OOMKilled after hours #4116, which asks for a different change. Both address roadmap-service OOMKilled events; #4116 fixes the memory leak, this item raises the memory limit to buy time until the fix is validated.
  3. added
    priority/p1-high
    owner/agent
    on Nov 8, 2026
  4. added
    status/ready
    and removed
    status/new
    on Nov 8, 2026
  5. devops-cli-service commented on Nov 8, 2026

    @devops-cli-service
    Contributor

    Status set to Ready at aa772d6 (see proposed design in issue body).

  6. added
    status/in-progress
    status/in-review
    and removed
    status/ready
    status/in-progress
    on Nov 8, 2026
  7. removed
    status/in-review
    owner/agent
    on Nov 8, 2026
  8. devops-cli-service commented on Nov 8, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-08 13:44 UTC

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/p1-highscope/k8ssource/agenttype/bugvalue/high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions