Skip to content

fix: remove MALLOC_ARENA_MAX from VTA, DID hosting and VTC tuning - #163

Merged
vthwang merged 1 commit into
mainfrom
fix/remove-malloc-arena-max
Nov 20, 2026
Merged

vthwang merged 1 commit into
mainfrom
fix/remove-malloc-arena-max

Conversation

@geoffturk

Copy link
Copy Markdown
Member

Why

MALLOC_ARENA_MAX=2 capped glibc's malloc arenas so idle pods gave memory back (#143, #149). The VTA, VTC and DID hosting images now link jemalloc, which does not read the variable, so it does nothing on any current image. Dev, staging and production are all on jemalloc images.

What changes

  • VtaTuningEnv, DidsTuningEnv and VtcTuningEnv no longer set MALLOC_ARENA_MAX, so new Deployments are created without it.
  • ensureTuningEnv becomes reconcileTuningEnv. It still adds missing template variables, and now also removes the variables listed in retiredTuningEnv (only MALLOC_ARENA_MAX today).
  • scripts/backfill-vta-malloc-arena.sh is deleted.

Effect on running Deployments

Nothing restarts when this is deployed. Each VTA, DID hosting and VTC Deployment loses the variable in the rollout of its next image upgrade, rollback or recovery, the same way it gained it.

Things to notice

  • Hand-tuned STORAGE_FJALL_* values are still left alone. A hand-set MALLOC_ARENA_MAX is removed whatever its value.
  • The variable is also removed when a Deployment is moved back to an image built before the jemalloc change. That image then runs on glibc without the cap.
  • The mediator and trust registry are not touched; they never had the variable.

Testing

go vet and go test ./internal/k8s/... ./internal/setup/... ./internal/upgrade/... pass in a golang:1.26 container. New tests cover removal on vta, fs-vta, fs-dids and fs-vtc through both SetDeploymentImage and RecoverDeploymentImage. Not exercised against a cluster.

Related: ic3software/devops#165

MALLOC_ARENA_MAX=2 capped glibc's malloc arenas so idle pods gave
memory back (#143, #149). The VTA, VTC and DID hosting images now
link jemalloc, which does not read the variable, so it does nothing
on any current image.

- internal/k8s/vta_resources.go: drop the variable from
  VtaTuningEnv, DidsTuningEnv and VtcTuningEnv. Add retiredTuningEnv
  and rename ensureTuningEnv to reconcileTuningEnv, which now also
  removes retired variables from existing Deployments.
- internal/k8s/upgrade.go: SetDeploymentImage and
  RecoverDeploymentImage call the renamed helper, so the variable
  leaves each Deployment in the rollout of its next image change.
  No extra restart.
- scripts/backfill-vta-malloc-arena.sh: deleted; there is nothing
  left to backfill.

Hand-tuned Fjall values are still left alone. The variable is also
removed when a Deployment is moved back to an image built before the
jemalloc change, which then runs without the cap.

Signed-off-by: Geoff Turk <geoff@ic3.dev>
@geoffturk
geoffturk requested a review from vthwang November 19, 2026 09:46
@vthwang
vthwang merged commit 789b494 into main Nov 20, 2026
1 check passed
@vthwang
vthwang deleted the fix/remove-malloc-arena-max branch November 20, 2026 05:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants