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

オープン
#7,181 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
54/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
go, kubernetes, sqlite

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
Go
スター
2.3k
フォーク
332
平均マージ
19時間 39分
マージ済み PR(30日)
174

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

stacklok/toolhive のほかの issue

stacklok/toolhive の issue をすべて見る

似ている issue

Go の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。