[GH-ISSUE #2066] Switching from CUDA to CPU runner causes segmentation fault #26956

Closed
opened 2026-04-22 03:45:11 -05:00 by GiteaMirror · 1 comment
Owner

Originally created by @jmorganca on GitHub (Jan 19, 2024).
Original GitHub issue: https://github.com/ollama/ollama/issues/2066

Originally assigned to: @dhiltgen on GitHub.

This is only currently an issue on main

2024/01/19 04:46:40 routes.go:76: INFO changing loaded model
2024/01/19 04:46:40 gpu.go:136: INFO CUDA Compute Capability detected: 8.9
2024/01/19 04:46:40 gpu.go:136: INFO CUDA Compute Capability detected: 8.9
2024/01/19 04:46:40 cpu_common.go:11: INFO CPU has AVX2
loading library /tmp/ollama2500718665/cpu_avx2/libext_server.so
2024/01/19 04:46:40 dyn_ext_server.go:90: INFO Loading Dynamic llm server: /tmp/ollama2500718665/cpu_avx2/libext_server.so
2024/01/19 04:46:40 dyn_ext_server.go:139: INFO Initializing llama server
SIGSEGV: segmentation violation
PC=0x7f811abadac8 m=5 sigcode=1
signal arrived during cgo execution

goroutine 14 [syscall]:
runtime.cgocall(0x9b4550, 0xc000a4e808)
	/usr/local/go/src/runtime/cgocall.go:157 +0x4b fp=0xc000a4e7e0 sp=0xc000a4e7a8 pc=0x409b0b
github.com/jmorganca/ollama/llm._Cfunc_dyn_llama_server_init({0x7f80bc000f60, 0x7f805a501b80, 0x7f805a4f3a80, 0x7f805a4f7960, 0x7f805a505650, 0x7f805a4ffba0, 0x7f805a4f7930, 0x7f805a4f3b00, 0x7f805a505e00, 0x7f805a505200, ...}, ...)
	_cgo_gotypes.go:280 +0x45 fp=0xc000a4e808 sp=0xc000a4e7e0 pc=0x7c2a45
github.com/jmorganca/ollama/llm.newDynExtServer.func7(0xae6f80?, 0x6e?)
	/go/src/github.com/jmorganca/ollama/llm/dyn_ext_server.go:142 +0xef fp=0xc000a4e8f8 sp=0xc000a4e808 pc=0x7c3eaf
github.com/jmorganca/ollama/llm.newDynExtServer({0xc000134090, 0x2f}, {0xc0009f4150, _}, {_, _, _}, {0x0, 0x0, 0x0}, ...)
	/go/src/github.com/jmorganca/ollama/llm/dyn_ext_server.go:142 +0xa32 fp=0xc000a4eb88 sp=0xc000a4e8f8 pc=0x7c3bf2
github.com/jmorganca/ollama/llm.newLlmServer({{_, _, _}, {_, _}, {_, _}}, {_, _}, {0x0, ...}, ...)
	/go/src/github.com/jmorganca/ollama/llm/llm.go:147 +0x36a fp=0xc000a4ed48 sp=0xc000a4eb88 pc=0x7c04ea
github.com/jmorganca/ollama/llm.New({0x419c8f?, 0x1000100000100?}, {0xc0009f4150, _}, {_, _, _}, {0x0, 0x0, 0x0}, ...)
	/go/src/github.com/jmorganca/ollama/llm/llm.go:122 +0x6f9 fp=0xc000a4efb8 sp=0xc000a4ed48 pc=0x7bff19
github.com/jmorganca/ollama/server.load(0xc00017e900?, 0xc00017e900, {{0x0, 0x800, 0x200, 0x1, 0x0, 0x0, 0x0, 0x1, ...}, ...}, ...)
	/go/src/github.com/jmorganca/ollama/server/routes.go:83 +0x3a5 fp=0xc000a4f138 sp=0xc000a4efb8 pc=0x9908a5
github.com/jmorganca/ollama/server.ChatHandler(0xc00007c100)
	/go/src/github.com/jmorganca/ollama/server/routes.go:1071 +0x828 fp=0xc000a4f748 sp=0xc000a4f138 pc=0x99b1e8
github.com/gin-gonic/gin.(*Context).Next(...)
Originally created by @jmorganca on GitHub (Jan 19, 2024). Original GitHub issue: https://github.com/ollama/ollama/issues/2066 Originally assigned to: @dhiltgen on GitHub. This is only currently an issue on `main` ``` 2024/01/19 04:46:40 routes.go:76: INFO changing loaded model 2024/01/19 04:46:40 gpu.go:136: INFO CUDA Compute Capability detected: 8.9 2024/01/19 04:46:40 gpu.go:136: INFO CUDA Compute Capability detected: 8.9 2024/01/19 04:46:40 cpu_common.go:11: INFO CPU has AVX2 loading library /tmp/ollama2500718665/cpu_avx2/libext_server.so 2024/01/19 04:46:40 dyn_ext_server.go:90: INFO Loading Dynamic llm server: /tmp/ollama2500718665/cpu_avx2/libext_server.so 2024/01/19 04:46:40 dyn_ext_server.go:139: INFO Initializing llama server SIGSEGV: segmentation violation PC=0x7f811abadac8 m=5 sigcode=1 signal arrived during cgo execution goroutine 14 [syscall]: runtime.cgocall(0x9b4550, 0xc000a4e808) /usr/local/go/src/runtime/cgocall.go:157 +0x4b fp=0xc000a4e7e0 sp=0xc000a4e7a8 pc=0x409b0b github.com/jmorganca/ollama/llm._Cfunc_dyn_llama_server_init({0x7f80bc000f60, 0x7f805a501b80, 0x7f805a4f3a80, 0x7f805a4f7960, 0x7f805a505650, 0x7f805a4ffba0, 0x7f805a4f7930, 0x7f805a4f3b00, 0x7f805a505e00, 0x7f805a505200, ...}, ...) _cgo_gotypes.go:280 +0x45 fp=0xc000a4e808 sp=0xc000a4e7e0 pc=0x7c2a45 github.com/jmorganca/ollama/llm.newDynExtServer.func7(0xae6f80?, 0x6e?) /go/src/github.com/jmorganca/ollama/llm/dyn_ext_server.go:142 +0xef fp=0xc000a4e8f8 sp=0xc000a4e808 pc=0x7c3eaf github.com/jmorganca/ollama/llm.newDynExtServer({0xc000134090, 0x2f}, {0xc0009f4150, _}, {_, _, _}, {0x0, 0x0, 0x0}, ...) /go/src/github.com/jmorganca/ollama/llm/dyn_ext_server.go:142 +0xa32 fp=0xc000a4eb88 sp=0xc000a4e8f8 pc=0x7c3bf2 github.com/jmorganca/ollama/llm.newLlmServer({{_, _, _}, {_, _}, {_, _}}, {_, _}, {0x0, ...}, ...) /go/src/github.com/jmorganca/ollama/llm/llm.go:147 +0x36a fp=0xc000a4ed48 sp=0xc000a4eb88 pc=0x7c04ea github.com/jmorganca/ollama/llm.New({0x419c8f?, 0x1000100000100?}, {0xc0009f4150, _}, {_, _, _}, {0x0, 0x0, 0x0}, ...) /go/src/github.com/jmorganca/ollama/llm/llm.go:122 +0x6f9 fp=0xc000a4efb8 sp=0xc000a4ed48 pc=0x7bff19 github.com/jmorganca/ollama/server.load(0xc00017e900?, 0xc00017e900, {{0x0, 0x800, 0x200, 0x1, 0x0, 0x0, 0x0, 0x1, ...}, ...}, ...) /go/src/github.com/jmorganca/ollama/server/routes.go:83 +0x3a5 fp=0xc000a4f138 sp=0xc000a4efb8 pc=0x9908a5 github.com/jmorganca/ollama/server.ChatHandler(0xc00007c100) /go/src/github.com/jmorganca/ollama/server/routes.go:1071 +0x828 fp=0xc000a4f748 sp=0xc000a4f138 pc=0x99b1e8 github.com/gin-gonic/gin.(*Context).Next(...) ```
GiteaMirror added the bug label 2026-04-22 03:45:11 -05:00
Author
Owner

@dhiltgen commented on GitHub (Jan 19, 2024):

Repro scenario: On a 4G card.

# Get the GPU runner loaded
% ollama run phi hello
...
% curl http://localhost:11434/api/generate -d '{
  "model": "mistral",
  "prompt": "hello",
  "stream": false, "options": {"num_ctx": 65536}
}'

There's some piece of global state that's lingering and not getting cleaned up. Possibly related to #1848

<!-- gh-comment-id:1900844798 --> @dhiltgen commented on GitHub (Jan 19, 2024): Repro scenario: On a 4G card. ``` # Get the GPU runner loaded % ollama run phi hello ... % curl http://localhost:11434/api/generate -d '{ "model": "mistral", "prompt": "hello", "stream": false, "options": {"num_ctx": 65536} }' ``` There's some piece of global state that's lingering and not getting cleaned up. Possibly related to #1848
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#26956