vmcp optimizer tool search permanently fails with FTS5 disk I/O error (6410) under operator security hardening

Abierto
#7,181 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
54/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
go, kubernetes, sqlite

Línea de trabajo

Start by reading pkg/vmcp/optimizer/internal/toolstore/sqlite_store.go and pkg/container/kubernetes/security.go, then trace how the operator configures vmcp's read-only root filesystem and temporary storage. Reproduce the FTS5 find_tool failure under that configuration and compare the proposed writable /tmp mount with setting SQLite temp_store to MEMORY. Done means optimizer search works with the intended hardened setup and has coverage for the failure scenario.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

needs-triage

Environment

  • ToolHive operator on Kubernetes, operator and vmcp images v0.66.0
  • VirtualMCPServer with optimizer.enabled (embedding service configured via embeddingService)
  • Session storage: Redis provider (Dragonfly), single replica

What happens

On the vmcp gateway, find_tool fails on every call, on every fresh session, for every client:

find_tool failed: tool search failed: FTS5 query failed: disk I/O error (6410)

Direct call_tool execution by name works fine, so only tool discovery (the optimizer's search path) is affected. The failure persists across pod restarts and gateway version bumps (observed continuously on v0.63–v0.66 deploys over ~2 weeks).

Diagnosis

  • Extended code 6410 is SQLITE_IOERR_GETTEMPPATH: the VFS could not resolve a writable directory for temporary files.
  • The optimizer tool store is an in-memory SQLite database (file:memdb?mode=memory&cache=shared) with FTS5, from pkg/vmcp/optimizer/internal/toolstore/sqlite_store.go. FTS5 queries spill to file-backed temp storage (temp_store defaults to FILE), and os.TempDir() has nowhere usable to go.
  • The operator hardens vmcp containers with readOnlyRootFilesystem: true (pkg/container/kubernetes/security.go) and sets HOME=/tmp / XDG_CONFIG_HOME=/tmp, but does not mount a writable volume at /tmp. The image's /tmp is on the read-only rootfs.

Evidence from the running pod (ephemeral container probe):

HOME=/tmp
XDG_CONFIG_HOME=/tmp
# ls -ld /proc/1/root/tmp
drwxrwxrwt 2 root root 6 ... /proc/1/root/tmp
# touch /proc/1/root/tmp/zprobe
touch: /proc/1/root/tmp/zprobe: Read-only file system

And the gateway serves a healthy MCP session at the same time (fresh initialize → tools/list → reuse all 200), so the failure is isolated to the search path needing temp files.

Workaround

Adding an emptyDir at /tmp through the CRD's podTemplateSpec fixes it — that patch is applied as a strategic merge, so it combines cleanly with operator-set fields:

podTemplateSpec:
  spec:
    containers:
      - name: vmcp
        volumeMounts:
          - mountPath: /tmp
            name: vmcp-tmp
    volumes:
      - name: vmcp-tmp
        emptyDir: {}

Suggestion

Since the operator already points HOME and XDG_CONFIG_HOME at /tmp, it should probably mount a writable emptyDir there for vmcp by default when the rootfs is read-only. Alternatively, the tool store could set temp_store=MEMORY for the memdb so FTS5 never touches the filesystem — the store is in-memory anyway, and that would keep the hardening untouched.

Lenguaje dominante
Go
Estrellas
2.3k
Forks
332
Merge medio
19 h 39 min
PR fusionados (30 d)
174

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de stacklok/toolhive

Todos los issues de stacklok/toolhive

Issues similares

Más issues de Go

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.