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

Đang mở
#7,181 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
54/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
go, kubernetes, sqlite

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
Go
Star
2.3k
Fork
332
Merge trung bình
19 giờ 39 phút
Pull request đã merge (30 ngày)
174

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của stacklok/toolhive

Tất cả issue của stacklok/toolhive

Issue tương tự

Thêm issue về Go

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.