fix(docker): resolve llama.cpp header overwrite causing SIGSEGV on startup#24
Merged
orneryd merged 1 commit intoorneryd:mainfrom Feb 28, 2026
Merged
Conversation
COPY . . overwrites the fresh llama.cpp b8157 headers (copied from the build stage) with the stale b7285 headers committed to the repo. The resulting struct size mismatch causes a SIGSEGV in create_gen_context when llama_init_from_model reads garbage for the new samplers field added in b8157. Fix: move the header COPY to after COPY . . in all affected Dockerfiles so the correct versioned headers always take precedence. Fixes crash: "the backend samplers must be of type llama_sampler_chain" Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Owner
|
Thanks for that! I somehow didn't see this on mac when i was testing so i appreciate the fix! |
orneryd
approved these changes
Feb 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Environment
timothyswt/nornicdb-arm64-metal-bge-heimdall:1.0.12via docker-compose, configured withNORNICDB_HEIMDALL_ENABLED=true,NORNICDB_HEIMDALL_PROVIDER=local,NORNICDB_HEIMDALL_GPU_LAYERS=0,NORNICDB_EMBEDDING_GPU_LAYERS=0Problem
Image
1.0.12crashes on startup — the container never passes its healthcheck and exits immediately. Image1.0.11works fine on the same machine with the same config.Crash output (
1.0.12):The reranker hits the same crash independently:
Root Cause
All affected Dockerfiles use
LLAMA_VERSION=b8157. The build stage correctly clones b8157 and copies its headers into/build/lib/llama/— but the next instruction immediately overwrites them:This causes a struct size mismatch at link time: the static library is compiled from b8157, but the CGo bindings compile against the repo's
lib/llama/llama.hat b7285. llama.cpp PR #17004 (merged Jan 4 2026, first included in b8157) addedsamplers/n_samplersfields tollama_context_params. With the truncated b7285 struct,create_gen_contextpasses an undersized struct by value tollama_init_from_model. The library reads garbage for the newsamplersfield, fails the validation assert, prints the error, and segfaults. This is why1.0.11(built against an older llama.cpp pre-PR#17004) was unaffected.Fix
Split the llama
COPY— keep the static library beforeCOPY . .for Docker layer cache efficiency, move the header copy to afterCOPY . .so the correct versioned headers always take precedence over whatever is committed to the repo:Also added header output to the
vulkan-heimdallllama-builder stage, which never copied headers at all (silently relying entirely on the stale repo headers).Affected Dockerfiles:
arm64-metal,arm64-metal-heimdall,amd64-cuda,amd64-cuda-heimdall,amd64-vulkan-heimdall,cpu-bgeVerification
Built from this branch and ran the fixed image on the same M1 Pro machine:
No SIGSEGV. Full docker-compose stack (nornicdb + mimir) comes up healthy.
🤖 Generated with Claude Code