[GH-ISSUE #5840] Crash on startup when trying to clean up unused files #50152

Closed
opened 2026-04-28 14:26:14 -05:00 by GiteaMirror · 1 comment
Owner

Originally created by @jmorganca on GitHub (Jul 22, 2024).
Original GitHub issue: https://github.com/ollama/ollama/issues/5840

Originally assigned to: @jmorganca on GitHub.

What is the issue?

% ollama serve                                                                                         
2024/07/21 20:24:39 routes.go:1096: INFO server config env="map[OLLAMA_DEBUG:false OLLAMA_FLASH_ATTENTION:false OLLAMA_HOST:http://127.0.0.1:11434 OLLAMA_KEEP_ALIVE:5m0s OLLAMA_LLM_LIBRARY: OLLAMA_MAX_LOADED_MODELS:0 OLLAMA_MAX_QUEUE:512 OLLAMA_MAX_VRAM:0 OLLAMA_MODELS:/Users/administrator/.ollama/models OLLAMA_NOHISTORY:false OLLAMA_NOPRUNE:false OLLAMA_NUM_PARALLEL:0 OLLAMA_ORIGINS:[http://localhost https://localhost http://localhost:* https://localhost:* http://127.0.0.1 https://127.0.0.1 http://127.0.0.1:* https://127.0.0.1:* http://0.0.0.0 https://0.0.0.0 http://0.0.0.0:* https://0.0.0.0:* app://* file://* tauri://*] OLLAMA_RUNNERS_DIR: OLLAMA_SCHED_SPREAD:false OLLAMA_TMPDIR:]"
time=2024-07-21T20:24:39.143-07:00 level=INFO source=images.go:778 msg="total blobs: 0"
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x10 pc=0x102eecbb4]

goroutine 1 [running]:
github.com/ollama/ollama/server.deleteUnusedLayers.func1({0x140001bc230, 0x61}, {0x1035942c8?, 0x14000128680?}, {0x140001bc230?, 0x61?})
	github.com/ollama/ollama/server/images.go:722 +0x444
path/filepath.walk({0x140001bc230, 0x61}, {0x1035942c8, 0x14000128680}, 0x14000595850)
	path/filepath/path.go:478 +0xc8
path/filepath.walk({0x1400011ab40, 0x57}, {0x1035942c8, 0x14000128410}, 0x14000595850)
	path/filepath/path.go:502 +0x1d0
path/filepath.walk({0x1400003ceb0, 0x48}, {0x1035942c8, 0x14000128340}, 0x14000595850)
	path/filepath/path.go:502 +0x1d0
path/filepath.walk({0x1400003b000, 0x40}, {0x1035942c8, 0x14000128270}, 0x14000595850)
	path/filepath/path.go:502 +0x1d0
path/filepath.walk({0x140004a3aa0, 0x2d}, {0x1035942c8, 0x14000217e10}, 0x14000595850)
	path/filepath/path.go:502 +0x1d0
path/filepath.Walk({0x140004a3aa0, 0x2d}, 0x14000595850)
	path/filepath/path.go:560 +0x6c
github.com/ollama/ollama/server.deleteUnusedLayers(0x0, 0x14000595aa0)
	github.com/ollama/ollama/server/images.go:726 +0x68
github.com/ollama/ollama/server.PruneLayers()
	github.com/ollama/ollama/server/images.go:780 +0x38c
github.com/ollama/ollama/server.Serve({0x10358f438, 0x1400062a860})
	github.com/ollama/ollama/server/routes.go:1122 +0x248
github.com/ollama/ollama/cmd.RunServer(0x140001e1400?, {0x103d97220?, 0x4?, 0x10308aa76?})
	github.com/ollama/ollama/cmd/cmd.go:1084 +0xe0
github.com/spf13/cobra.(*Command).execute(0x140004e2308, {0x103d97220, 0x0, 0x0})
	github.com/spf13/cobra@v1.7.0/command.go:940 +0x654
github.com/spf13/cobra.(*Command).ExecuteC(0x14000495b08)
	github.com/spf13/cobra@v1.7.0/command.go:1068 +0x320
github.com/spf13/cobra.(*Command).Execute(...)
	github.com/spf13/cobra@v1.7.0/command.go:992
github.com/spf13/cobra.(*Command).ExecuteContext(...)
	github.com/spf13/cobra@v1.7.0/command.go:985
main.main()

OS

No response

GPU

No response

CPU

No response

Ollama version

No response

Originally created by @jmorganca on GitHub (Jul 22, 2024). Original GitHub issue: https://github.com/ollama/ollama/issues/5840 Originally assigned to: @jmorganca on GitHub. ### What is the issue? ``` % ollama serve 2024/07/21 20:24:39 routes.go:1096: INFO server config env="map[OLLAMA_DEBUG:false OLLAMA_FLASH_ATTENTION:false OLLAMA_HOST:http://127.0.0.1:11434 OLLAMA_KEEP_ALIVE:5m0s OLLAMA_LLM_LIBRARY: OLLAMA_MAX_LOADED_MODELS:0 OLLAMA_MAX_QUEUE:512 OLLAMA_MAX_VRAM:0 OLLAMA_MODELS:/Users/administrator/.ollama/models OLLAMA_NOHISTORY:false OLLAMA_NOPRUNE:false OLLAMA_NUM_PARALLEL:0 OLLAMA_ORIGINS:[http://localhost https://localhost http://localhost:* https://localhost:* http://127.0.0.1 https://127.0.0.1 http://127.0.0.1:* https://127.0.0.1:* http://0.0.0.0 https://0.0.0.0 http://0.0.0.0:* https://0.0.0.0:* app://* file://* tauri://*] OLLAMA_RUNNERS_DIR: OLLAMA_SCHED_SPREAD:false OLLAMA_TMPDIR:]" time=2024-07-21T20:24:39.143-07:00 level=INFO source=images.go:778 msg="total blobs: 0" panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x2 addr=0x10 pc=0x102eecbb4] goroutine 1 [running]: github.com/ollama/ollama/server.deleteUnusedLayers.func1({0x140001bc230, 0x61}, {0x1035942c8?, 0x14000128680?}, {0x140001bc230?, 0x61?}) github.com/ollama/ollama/server/images.go:722 +0x444 path/filepath.walk({0x140001bc230, 0x61}, {0x1035942c8, 0x14000128680}, 0x14000595850) path/filepath/path.go:478 +0xc8 path/filepath.walk({0x1400011ab40, 0x57}, {0x1035942c8, 0x14000128410}, 0x14000595850) path/filepath/path.go:502 +0x1d0 path/filepath.walk({0x1400003ceb0, 0x48}, {0x1035942c8, 0x14000128340}, 0x14000595850) path/filepath/path.go:502 +0x1d0 path/filepath.walk({0x1400003b000, 0x40}, {0x1035942c8, 0x14000128270}, 0x14000595850) path/filepath/path.go:502 +0x1d0 path/filepath.walk({0x140004a3aa0, 0x2d}, {0x1035942c8, 0x14000217e10}, 0x14000595850) path/filepath/path.go:502 +0x1d0 path/filepath.Walk({0x140004a3aa0, 0x2d}, 0x14000595850) path/filepath/path.go:560 +0x6c github.com/ollama/ollama/server.deleteUnusedLayers(0x0, 0x14000595aa0) github.com/ollama/ollama/server/images.go:726 +0x68 github.com/ollama/ollama/server.PruneLayers() github.com/ollama/ollama/server/images.go:780 +0x38c github.com/ollama/ollama/server.Serve({0x10358f438, 0x1400062a860}) github.com/ollama/ollama/server/routes.go:1122 +0x248 github.com/ollama/ollama/cmd.RunServer(0x140001e1400?, {0x103d97220?, 0x4?, 0x10308aa76?}) github.com/ollama/ollama/cmd/cmd.go:1084 +0xe0 github.com/spf13/cobra.(*Command).execute(0x140004e2308, {0x103d97220, 0x0, 0x0}) github.com/spf13/cobra@v1.7.0/command.go:940 +0x654 github.com/spf13/cobra.(*Command).ExecuteC(0x14000495b08) github.com/spf13/cobra@v1.7.0/command.go:1068 +0x320 github.com/spf13/cobra.(*Command).Execute(...) github.com/spf13/cobra@v1.7.0/command.go:992 github.com/spf13/cobra.(*Command).ExecuteContext(...) github.com/spf13/cobra@v1.7.0/command.go:985 main.main() ``` ### OS _No response_ ### GPU _No response_ ### CPU _No response_ ### Ollama version _No response_
GiteaMirror added the bug label 2026-04-28 14:26:14 -05:00
Author
Owner

@jessegross commented on GitHub (Aug 7, 2024):

Fixed by PR #6145

<!-- gh-comment-id:2274078734 --> @jessegross commented on GitHub (Aug 7, 2024): Fixed by PR #6145
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#50152