bug: Docker terminals ignore `TERMINALS_MAX_STORAGE`, `TERMINALS_MAX_CPU` and `TERMINALS_MAX_MEMORY` when template limits are blank

Aperta
#83 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
70/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
docker, python
Ambito
backend, devops

Direzione di ricerca

Read terminals/utils/template_specs.py for template default resolution, then trace the effective configuration into terminals/backends/docker.py; the report also points to validation in terminals/routers/templates.py. Check how blank and explicit CPU, memory, and storage values interact with the configured ceilings, then verify newly provisioned Docker containers stay within those caps, including templates saved before the caps were set.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

UPDATE: I missed TERMINALS_MAX_STORAGE in the initial report. While 0.4.3 fixed the other two, the storage one apparantly was not fixed.

Description

In Terminals v0.4.2 with the Docker backend, leaving CPU or Memory at “Server default” in Open WebUI can create an instance with no explicit Docker limit, even when the corresponding TERMINALS_MAX_* variable is set. The README describes these variables as hard caps on each terminal container. [Configuration reference](https://github.com/open-webui/terminals/blob/v0.4.2/README.md#common)

Steps to reproduce
  1. Set the following in the Terminals orchestrator’s environment and recreate the orchestrator.

    TERMINALS_MAX_CPU=2
    TERMINALS_MAX_MEMORY=4Gi
    
  2. Create a new terminal template in Open WebUI. Leave CPU and Memory blank so both show “Server default.”

  3. Open the terminal to provision a fresh instance, then inspect the spawned container.

    docker inspect --format 'NanoCpus={{.HostConfig.NanoCpus}} Memory={{.HostConfig.Memory}}' <spawned-container>
    
Actual behavior

The provisioning code leaves both limits unset, which Docker reports as NanoCpus=0 Memory=0. If the template explicitly requests 4 CPUs and 8Gi of memory, the same environment variables clamp those values to 2 and 4Gi when the template is saved. [Template validation](https://github.com/open-webui/terminals/blob/v0.4.2/terminals/routers/templates.py#L109-L123) · [Docker provisioning](https://github.com/open-webui/terminals/blob/v0.4.2/terminals/backends/docker.py#L105-L125)

Expected behavior

Every newly provisioned instance should stay within the configured per-instance ceilings. A blank field can inherit the configured ceiling, an explicit value below it should be preserved, and a value above it should be clamped. With both fields blank in the example above, Docker should report NanoCpus=2000000000 Memory=4294967296.

Likely cause

Template validation only clamps fields that are present. The template resolver fills in the default image but leaves CPU and memory unset, and Docker provisioning only sets limits when those fields have values. Applying the ceilings when resolving the effective configuration would also cover templates saved before an administrator configured the caps. [Template default resolution](https://github.com/open-webui/terminals/blob/v0.4.2/terminals/utils/template_specs.py#L12-L21)

Verification: Traced against the v0.4.2 source. The Docker inspection above is a proposed runtime check.

Lingua principale
Python
Stelle
139
Fork
36
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

  • Include un Dockerfile o un file Docker Compose
  • Ha un modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di open-webui/terminals

Tutte le issue di open-webui/terminals

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.