[GH-ISSUE #1163] Segmentation Fault with CPU inference on 0.1.9 on Intel Mac with Monterey #26349

Closed
opened 2026-04-22 02:35:03 -05:00 by GiteaMirror · 11 comments
Owner

Originally created by @orlyandico on GitHub (Nov 17, 2023).
Original GitHub issue: https://github.com/ollama/ollama/issues/1163

I can consistently get an OOM and segfault with longer prompts on 0.1.9 and codellama model on a Mac Pro 2013 trashcan with 128GB of RAM, Ivy Bridge EP Xeon processor (E5-2696 v2) and Monterey 12.7.1. This model has the dual AMD D500 GPU which should not be relevant..

Shorter prompts work fine, e.g. "write python code to connect to postgresql and fetched named columns"

But the slightly longer "write code in python to connect to a database with psycopg2 and perform an upsert with bind variables" fails with the error

{"timestamp":1700181141,"level":"INFO","function":"main","line":1749,"message":"HTTP server listening","hostname":"127.0.0.1","port":64826}
{"timestamp":1700181141,"level":"INFO","function":"log_server_request","line":1240,"message":"request","remote_addr":"127.0.0.1","remote_port":50465,"status":200,"method":"HEAD","path":"/","params":{}}
2023/11/17 00:32:21 llama.go:487: llama runner started in 1.401922 seconds
[GIN] 2023/11/17 - 00:32:21 | 200 | 1.623658951s | 127.0.0.1 | POST "/api/generate"
{"timestamp":1700181160,"level":"INFO","function":"log_server_request","line":1240,"message":"request","remote_addr":"127.0.0.1","remote_port":50467,"status":200,"method":"HEAD","path":"/","params":{}}
2023/11/17 00:32:40 llama.go:430: signal: segmentation fault
2023/11/17 00:32:40 llama.go:504: llama runner stopped successfully
[GIN] 2023/11/17 - 00:32:40 | 200 | 247.513143ms | 127.0.0.1 | POST "/api/generate"
2023/11/17 00:37:40 llama.go:504: llama runner stopped successfully

This error also appears during startup (but this error also shows up in the i9-8880H so it's not specific to the old Xeon):

2023/11/17 00:32:20 llama.go:415: starting llama runner
2023/11/17 00:32:20 llama.go:417: error starting the external llama runner: fork/exec /var/folders/kq/gx8q5jw525zfzzxy2k1y5fz40000gn/T/ollama3231579164/llama.cpp/gguf/build/metal/bin/ollama-runner: bad CPU type in executable
2023/11/17 00:32:20 llama.go:415: starting llama runner

The exact same setup and prompts work fine on a 2019 Macbook Pro with Radeon Pro 5500M, 16GB RAM, and Coffee Lake i9-9880H running Ventura 13.4.1(c). GPU shouldn't be an issue either as it is unused (can confirm 800% CPU utilisation during inference).

Originally created by @orlyandico on GitHub (Nov 17, 2023). Original GitHub issue: https://github.com/ollama/ollama/issues/1163 I can consistently get an OOM and segfault with longer prompts on 0.1.9 and codellama model on a Mac Pro 2013 trashcan with 128GB of RAM, Ivy Bridge EP Xeon processor (E5-2696 v2) and Monterey 12.7.1. This model has the dual AMD D500 GPU which should not be relevant.. Shorter prompts work fine, e.g. "write python code to connect to postgresql and fetched named columns" But the slightly longer "write code in python to connect to a database with psycopg2 and perform an upsert with bind variables" fails with the error {"timestamp":1700181141,"level":"INFO","function":"main","line":1749,"message":"HTTP server listening","hostname":"127.0.0.1","port":64826} {"timestamp":1700181141,"level":"INFO","function":"log_server_request","line":1240,"message":"request","remote_addr":"127.0.0.1","remote_port":50465,"status":200,"method":"HEAD","path":"/","params":{}} 2023/11/17 00:32:21 llama.go:487: llama runner started in 1.401922 seconds [GIN] 2023/11/17 - 00:32:21 | 200 | 1.623658951s | 127.0.0.1 | POST "/api/generate" {"timestamp":1700181160,"level":"INFO","function":"log_server_request","line":1240,"message":"request","remote_addr":"127.0.0.1","remote_port":50467,"status":200,"method":"HEAD","path":"/","params":{}} 2023/11/17 00:32:40 llama.go:430: signal: segmentation fault 2023/11/17 00:32:40 llama.go:504: llama runner stopped successfully [GIN] 2023/11/17 - 00:32:40 | 200 | 247.513143ms | 127.0.0.1 | POST "/api/generate" 2023/11/17 00:37:40 llama.go:504: llama runner stopped successfully This error also appears during startup (but this error also shows up in the i9-8880H so it's not specific to the old Xeon): 2023/11/17 00:32:20 llama.go:415: starting llama runner 2023/11/17 00:32:20 llama.go:417: error starting the external llama runner: fork/exec /var/folders/kq/gx8q5jw525zfzzxy2k1y5fz40000gn/T/ollama3231579164/llama.cpp/gguf/build/metal/bin/ollama-runner: bad CPU type in executable 2023/11/17 00:32:20 llama.go:415: starting llama runner The exact same setup and prompts work fine on a 2019 Macbook Pro with Radeon Pro 5500M, 16GB RAM, and Coffee Lake i9-9880H running Ventura 13.4.1(c). GPU shouldn't be an issue either as it is unused (can confirm 800% CPU utilisation during inference).
Author
Owner

@orlyandico commented on GitHub (Nov 17, 2023):

Seems to be a duplicate of https://github.com/jmorganca/ollama/issues/987

Also tested on M2 Max with Ventura 13.2.1 and works fine.

<!-- gh-comment-id:1815579690 --> @orlyandico commented on GitHub (Nov 17, 2023): Seems to be a duplicate of https://github.com/jmorganca/ollama/issues/987 Also tested on M2 Max with Ventura 13.2.1 and works fine.
Author
Owner

@jmorganca commented on GitHub (Nov 17, 2023):

Hi I'm so sorry you hit this issue. This should be fixed in 41434a7. The release should be out tomorrow but in the meantime you can try the prerelease version here https://github.com/jmorganca/ollama/releases/tag/v0.1.10

<!-- gh-comment-id:1815684223 --> @jmorganca commented on GitHub (Nov 17, 2023): Hi I'm so sorry you hit this issue. This should be fixed in [`41434a7`](https://github.com/jmorganca/ollama/commit/41434a7cdcf33918ae2d37eb23d819ef7361e843). The release should be out tomorrow but in the meantime you can try the prerelease version here https://github.com/jmorganca/ollama/releases/tag/v0.1.10
Author
Owner

@orlyandico commented on GitHub (Nov 18, 2023):

Updated to 0.1.10, segfault still present

{"timestamp":1700270511,"level":"INFO","function":"main","line":1749,"message":"HTTP server listening","hostname":"127.0.0.1","port":50780}
{"timestamp":1700270511,"level":"INFO","function":"log_server_request","line":1240,"message":"request","remote_addr":"127.0.0.1","remote_port":51019,"status":200,"method":"HEAD","path":"/","params":{}}
2023/11/18 01:21:51 llama.go:488: llama runner started in 5.602716 seconds
[GIN] 2023/11/18 - 01:21:51 | 200 | 5.818638919s | 127.0.0.1 | POST "/api/generate"
{"timestamp":1700270519,"level":"INFO","function":"log_server_request","line":1240,"message":"request","remote_addr":"127.0.0.1","remote_port":51021,"status":200,"method":"HEAD","path":"/","params":{}}
2023/11/18 01:21:59 llama.go:431: signal: segmentation fault
2023/11/18 01:21:59 llama.go:505: llama runner stopped successfully
[GIN] 2023/11/18 - 01:21:59 | 200 | 265.08486ms | 127.0.0.1 | POST "/api/generate"

<!-- gh-comment-id:1817309612 --> @orlyandico commented on GitHub (Nov 18, 2023): Updated to 0.1.10, segfault still present {"timestamp":1700270511,"level":"INFO","function":"main","line":1749,"message":"HTTP server listening","hostname":"127.0.0.1","port":50780} {"timestamp":1700270511,"level":"INFO","function":"log_server_request","line":1240,"message":"request","remote_addr":"127.0.0.1","remote_port":51019,"status":200,"method":"HEAD","path":"/","params":{}} 2023/11/18 01:21:51 llama.go:488: llama runner started in 5.602716 seconds [GIN] 2023/11/18 - 01:21:51 | 200 | 5.818638919s | 127.0.0.1 | POST "/api/generate" {"timestamp":1700270519,"level":"INFO","function":"log_server_request","line":1240,"message":"request","remote_addr":"127.0.0.1","remote_port":51021,"status":200,"method":"HEAD","path":"/","params":{}} 2023/11/18 01:21:59 llama.go:431: signal: segmentation fault 2023/11/18 01:21:59 llama.go:505: llama runner stopped successfully [GIN] 2023/11/18 - 01:21:59 | 200 | 265.08486ms | 127.0.0.1 | POST "/api/generate"
Author
Owner

@Serpico84 commented on GitHub (Nov 18, 2023):

Updated to 0.1.10, segfault still present

Can confirm

<!-- gh-comment-id:1817658464 --> @Serpico84 commented on GitHub (Nov 18, 2023): > Updated to 0.1.10, segfault still present Can confirm
Author
Owner

@orlyandico commented on GitHub (Nov 18, 2023):

To reiterate: this segfault does not happen on my Ventura Intel Mac, but it does on my Monterey Intel Mac.

Can anyone else confirm their MacOS version?

@Serpico84 can you upgrade to Ventura? I do not want to downgrade my Ventura Mac to Monterey, and my Monterey Mac (trashcan) cannot run Ventura, at least not without OCLP.

<!-- gh-comment-id:1817676261 --> @orlyandico commented on GitHub (Nov 18, 2023): To reiterate: this segfault does not happen on my Ventura Intel Mac, but it does on my Monterey Intel Mac. Can anyone else confirm their MacOS version? @Serpico84 can you upgrade to Ventura? I do not want to downgrade my Ventura Mac to Monterey, and my Monterey Mac (trashcan) cannot run Ventura, at least not without OCLP.
Author
Owner

@jmorganca commented on GitHub (Nov 19, 2023):

Sorry this isn't fixed – will take another look at it. @Serpico84 which version of macOS are you running?

<!-- gh-comment-id:1817975744 --> @jmorganca commented on GitHub (Nov 19, 2023): Sorry this isn't fixed – will take another look at it. @Serpico84 which version of macOS are you running?
Author
Owner

@0xdevalias commented on GitHub (Nov 20, 2023):

This should be fixed in 41434a7. The release should be out tomorrow but in the meantime you can try the prerelease version here v0.1.10 (release)

On macOS Ventura, Intel mac, ollama 0.1.9, I got a segfault while running ollama run zephyr:

..snip..
ggml_metal_init: allocating
ggml_metal_init: found device: Intel(R) UHD Graphics 630
ggml_metal_init: found device: AMD Radeon Pro 5500M
ggml_metal_init: picking default device: AMD Radeon Pro 5500M
ggml_metal_init: default.metallib not found, loading from source
2023/11/20 14:41:20 llama.go:430: signal: segmentation fault
2023/11/20 14:41:20 llama.go:438: error starting llama runner: llama runner process has terminated

But after upgrading to ollama 0.1.10 it now seems to work 👌🏻

<!-- gh-comment-id:1818181954 --> @0xdevalias commented on GitHub (Nov 20, 2023): > This should be fixed in [`41434a7`](https://github.com/jmorganca/ollama/commit/41434a7cdcf33918ae2d37eb23d819ef7361e843). The release should be out tomorrow but in the meantime you can try the prerelease version here [`v0.1.10` (release)](https://github.com/jmorganca/ollama/releases/tag/v0.1.10) On macOS Ventura, Intel mac, `ollama` `0.1.9`, I got a segfault while running `ollama run zephyr`: ``` ..snip.. ggml_metal_init: allocating ggml_metal_init: found device: Intel(R) UHD Graphics 630 ggml_metal_init: found device: AMD Radeon Pro 5500M ggml_metal_init: picking default device: AMD Radeon Pro 5500M ggml_metal_init: default.metallib not found, loading from source 2023/11/20 14:41:20 llama.go:430: signal: segmentation fault 2023/11/20 14:41:20 llama.go:438: error starting llama runner: llama runner process has terminated ``` But after upgrading to `ollama` `0.1.10` it now seems to work 👌🏻
Author
Owner

@jmorganca commented on GitHub (Nov 20, 2023):

Thanks for chiming in @0xdevalias . 0.1.10 did fix issues on Ventura. However some issues persist on earlier versions of macOS (Big Sur, Monterey). Those will be fixed in the next upcoming release which will be out very soon

<!-- gh-comment-id:1818209190 --> @jmorganca commented on GitHub (Nov 20, 2023): Thanks for chiming in @0xdevalias . `0.1.10` did fix issues on Ventura. However some issues persist on earlier versions of macOS (Big Sur, Monterey). Those will be fixed in the next upcoming release which will be out very soon
Author
Owner

@Serpico84 commented on GitHub (Nov 20, 2023):

Sorry this isn't fixed – will take another look at it. @Serpico84 which version of macOS are you running?

Monterey

<!-- gh-comment-id:1818343621 --> @Serpico84 commented on GitHub (Nov 20, 2023): > Sorry this isn't fixed – will take another look at it. @Serpico84 which version of macOS are you running? Monterey
Author
Owner

@orlyandico commented on GitHub (Nov 23, 2023):

Noticed that 0.1.11 is out, but i get

2023/11/23 22:07:42 llama.go:420: starting llama runner
2023/11/23 22:07:42 llama.go:478: waiting for llama runner to start responding
2023/11/23 22:07:42 llama.go:435: signal: illegal instruction
2023/11/23 22:07:42 llama.go:443: error starting llama runner: llama runner process has terminated
2023/11/23 22:07:42 llama.go:509: llama runner stopped successfully

<!-- gh-comment-id:1824960535 --> @orlyandico commented on GitHub (Nov 23, 2023): Noticed that 0.1.11 is out, but i get 2023/11/23 22:07:42 llama.go:420: starting llama runner 2023/11/23 22:07:42 llama.go:478: waiting for llama runner to start responding 2023/11/23 22:07:42 llama.go:435: signal: illegal instruction 2023/11/23 22:07:42 llama.go:443: error starting llama runner: llama runner process has terminated 2023/11/23 22:07:42 llama.go:509: llama runner stopped successfully
Author
Owner

@orlyandico commented on GitHub (Nov 29, 2023):

This appears to have been fixed on 0.1.12 on Intel Mac with Monterey

<!-- gh-comment-id:1831694756 --> @orlyandico commented on GitHub (Nov 29, 2023): This appears to have been fixed on 0.1.12 on Intel Mac with Monterey
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#26349