stablediffusion-ggml backend segfaults instead of returning an error when a Metal pipeline fails to compile, and its stderr never reaches the LocalAI log
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 52/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 冷清
- 领域
- backend, observability
调研方向
首先通过 /video 请求复现该故障,并检查 stablediffusion-ggml pipeline 的创建路径以及 run.sh 中的 launcher。确认失败的 Metal pipeline 会返回错误而不是被使用,并确认 backend 的 stderr 或其原因会进入 LocalAI 日志;重新运行复现步骤,以验证不会发生 segfault。
由索引模型根据 Issue 内容生成。
描述
Summary
When a Metal pipeline fails to compile, the backend logs the failure and then
uses the pipeline anyway. The null dereference takes SIGSEGV inside cgo and the
process dies. LocalAI sees only exitCode=2 and rpc error: EOF.
Compounding it, the backend's stderr is not attached to anything LocalAI logs, so
the underlying Metal error is invisible from the server side. Between the two,
a precise and well-reported error from Metal reaches the operator as an opaque
crash.
Environment
- LocalAI 4.7.1
- Backend
metal-stablediffusion-ggml, digest
sha256:9cafbf0956c55791cac472f20c73f55f425eeaefeb9d9a9bb22c9c5b8e8d7258 - macOS 26.5.2 (build 25F84), Apple M3 Ultra, 256 GB unified memory
What the operator sees
Nothing useful. A /video request fails, and the LocalAI log contains only:
exitCode=2
rpc error: code = Unavailable desc = error reading from server: EOF
No Metal error, no kernel name, no indication that anything compiled or failed to
compile. Two earlier attempts against this backend produced exactly this and were
abandoned undiagnosed, because there was nothing to go on.
What is actually happening
Metal reports the failure correctly and precisely:
compiling pipeline: kernel_mul_mv_ext_bf16_f32_r1_5
[ERROR] MTLLibraryErrorDomain Code=5 "Function kernel_mul_mv_ext_bf16_f32_r1_5
was not found in the library"
SIGSEGV: segmentation violation, signal arrived during cgo execution
The [ERROR] line shows the failure is detected and logged. The SIGSEGV
immediately after shows the result is then used without a nil check. A returned
error at that point would have made this a one-line diagnosis.
How to see it at all, which is the second half of the report
The backend's stderr does not reach LocalAI's log. To capture it we had to edit
the backend's own launcher, appending a redirect to the exec line in
run.sh:
exec "$CURDIR"/stablediffusion-ggml "$@" 2>>/tmp/sd-ggml-stderr.log
then reproduce, then restore the file. That is not a reasonable diagnostic path
for an operator, and it is the only reason the missing kernel in the companion
report was ever identified (companion issue: #AAA).
What would help
- Check the pipeline before using it. A failed
newComputePipelineState(or
equivalent) should propagate an error rather than being dereferenced. This is
the fix that matters; it converts an opaque crash into an actionable message
for every future missing-kernel case, not just this one. - Surface backend stderr in the LocalAI log, or document how to capture it.
A backend that dies withexitCode=2and no output leaves the operator with
nothing. - Optionally, include the Metal error text in the gRPC error returned to
LocalAI, sorpc error: EOFcarries a cause.
Why this is worth fixing independently of the missing kernel
The companion report is one absent kernel in one build, and a rebuild will fix
it. This defect turns any future pipeline-compile failure, from any cause,
into an uninformative segfault with no log output. The next occurrence will cost
the next person the same days.
Notes
Happy to run diagnostics or test a patched build on request. The model and
hardware stay available specifically to re-test.
- 主要语言
- Go
- 星标
- 50k
- 派生
- 4.6k
- 平均合并
- 20 小时 31 分钟
- 30 天内合并 PR
- 333
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 提供 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
mudler/LocalAI 的其他 Issue
-
[Bug] Qwen3.8-27b Uncensored Fails to Download due to 404可能重新可做 关联的 PR 已关闭且未合并。 未关闭bug unconfirmed
难度 1/5 1 小时以内 新手友好度 70/100
维护者通常 1 天内回复
-
Realtime: ASR EOU language tags leak into the LLM conversation (unintended reply-language switching)可能已有人在做 @nexxtmobile 于 12 天前认领。 未关闭area/api bug unconfirmed
难度 2/5 1-3 小时 新手友好度 70/100
维护者通常 1 天内回复
-
Open Responses API doesn't accept "output_text" as an input Item可能重新可做 关联的 PR 已关闭且未合并。 未关闭bug unconfirmed
难度 2/5 1-3 小时 新手友好度 78/100
mudler/LocalAI#12337 · 1 条评论 ·
维护者通常 1 天内回复
-
Gallery model audio-cpp-sortformer-diarization fails to install: SHA mismatch, reproducible across retries可能重新可做 关联的 PR 已关闭且未合并。 未关闭
难度 2/5 1-3 小时 新手友好度 76/100
mudler/LocalAI#11995 · 1 条评论 ·
维护者通常 1 天内回复
-
Agent pool Postgres DSN is logged in cleartext, including the password, while the auth DSN is redacted可能已有人在做 @localai-org-maint-bot 于 48 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 75/100
mudler/LocalAI#11991 · 1 条评论 ·
维护者通常 1 天内回复
相似的 Issue
-
难度 1/5 1 小时以内 新手友好度 72/100
slavakurilyak/awesome-ai-agents#888 ·
维护者通常 1 天内回复
-
enhancement nav-pilot
难度 2/5 1-3 小时 新手友好度 88/100
维护者通常 1 天内回复
-
kind/enhancement
难度 2/5 1-3 小时 新手友好度 64/100
维护者通常 1 天内回复
-
feat(gmail): make gmail get --format raw text output the exact message, like drafts get --format raw未关闭clawsweeper:needs-product-decision clawsweeper:no-new-fix-pr clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster P3
难度 2/5 1-3 小时 新手友好度 78/100
openclaw/gogcli#1276 · 1 条评论 · 1 个 reaction ·
维护者通常 1 天内回复
-
Seed a JRNYAx price before the last close so asset-detail S1.3 doesn't fail from 08:00Z to the open未关闭bug tests
难度 2/5 1-3 小时 新手友好度 83/100
lognorman20/monaco#7231 ·