Repository navigation
fix(ci): serialize ollama requests to prevent llama-server segfault cascade - #1381
Merged
ajbozarth merged 1 commit intoJul 13, 2026
Conversation
…ascade Concurrent-request tests made Ollama spawn multiple llama-server slots at once, which segfaults under the memory limits of GitHub-hosted CPU runners. A single segfault then cascaded across every remaining ollama-dependent test because the shared `ollama serve` never recovered and the only auto-retry is scoped to ReadTimeout. Setting OLLAMA_NUM_PARALLEL=1 makes Ollama queue concurrent requests instead of allocating parallel slots, removing the memory spike with no change to test coverage or meaningful CI runtime. Assisted-by: Claude Code Signed-off-by: Alex Bozarth <[email protected]>
Member
Author
|
I noticed CI was running into this flaky-ness on a handful of PRs last week and asked Claude to suggest a fix. Afaik this is a minimal fix and can be further addressed as outlined in the description, but that would increase runtime, unlike this fix |
AngeloDanducci
approved these changes
Jul 13, 2026
AngeloDanducci
left a comment
Contributor
There was a problem hiding this comment.
LGTM - noticed this happened once but if you've also seen it in parallel definitely worth addressing.
Merged
via the queue into
generative-computing:main
with commit Jul 13, 2026
5a764c1
8 checks passed
This was referenced Jul 13, 2026
ajbozarth
added a commit
to ajbozarth/mellea
that referenced
this pull request
Jul 14, 2026
…gfault cascade (generative-computing#1381)" (generative-computing#1387) This reverts commit 5a764c1. Setting OLLAMA_NUM_PARALLEL=1 did not prevent the segfault cascade it was meant to fix, and serializing all ollama requests roughly quadrupled CI runtime by forcing every concurrent-request test to run sequentially. Assisted-by: Claude Code Signed-off-by: Alex Bozarth <[email protected]>
1 of 8 tasks
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.
Issue
Fixes #
Description
CI's
qualityjob intermittently fails with a cascade of ~56 ollama-dependenttest failures, all tracing to:
ollama._types.ResponseError: llama-server process has terminated: signal: segmentation fault (core dumped)Root cause: the concurrent-request tests (
test_async_parallel_requests,test_multiple_asyncio_runs, etc.) make Ollama allocate multiplellama-serverrunner slots at once. On memory-limited GitHub-hosted CPU runners this spikes
memory and segfaults llama.cpp. Because the whole job shares one
ollama serve(started once via
nohup ollama serve &) and the only auto-retry is scoped toReadTimeout, a single segfault cascades across every remaining ollama test forthe rest of the run.
Fix: set
OLLAMA_NUM_PARALLEL=1so Ollama queues concurrent requests insteadof spawning parallel slots. The client still issues concurrent requests, so
mellea's async assertions are unchanged — Ollama just serializes execution
internally. Near-zero runtime cost; no model-reload churn.
Reviewer notes:
0.31.2(the installer is unpinned, so CI trackslatest — a recent Ollama/llama.cpp build likely explains the ~1–2 week onset).
OLLAMA_MAX_LOADED_MODELS=1(adds model-reload cost) or pinning the Ollama version.
Testing
Attribution
Adding a new component, requirement, sampling strategy, or tool?