[GH-ISSUE #2822] multiple idle ollama threads for each ollama serve process #1714

Closed
opened 2026-04-12 11:41:30 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @commit4ever on GitHub (Feb 29, 2024).
Original GitHub issue: https://github.com/ollama/ollama/issues/2822

Originally assigned to: @dhiltgen on GitHub.

Ubuntu 20.04

we run a small proxy that creates multiple ollama serve processes on diff ports. I have noticed in htop that there a ton of threads created but not disposed under each parent/master process.
This looks to be from every generate api call. Does ollama not manage this?
Is there a workround to safely closed unused threads ?

image

Thanks!

Originally created by @commit4ever on GitHub (Feb 29, 2024). Original GitHub issue: https://github.com/ollama/ollama/issues/2822 Originally assigned to: @dhiltgen on GitHub. Ubuntu 20.04 we run a small proxy that creates multiple ollama serve processes on diff ports. I have noticed in htop that there a ton of threads created but not disposed under each parent/master process. This looks to be from every generate api call. Does ollama not manage this? Is there a workround to safely closed unused threads ? <img width="611" alt="image" src="https://github.com/ollama/ollama/assets/30615541/dd19047b-f181-4bae-a4a4-8eea23e2a58d"> Thanks!
GiteaMirror added the bug label 2026-04-12 11:41:30 -05:00
Author
Owner

@dhiltgen commented on GitHub (Mar 20, 2024):

Ollama is written in Go. This is normal behavior. The Go runtime will managed the mapping of lightweight threads which come and go to kernel/os threads which stick around longer as they have higher overhead to create and delete, and those OS/kernel threads are what you see above.

<!-- gh-comment-id:2009996236 --> @dhiltgen commented on GitHub (Mar 20, 2024): Ollama is written in Go. This is normal behavior. The Go runtime will managed the mapping of lightweight threads which come and go to kernel/os threads which stick around longer as they have higher overhead to create and delete, and those OS/kernel threads are what you see above.
Author
Owner

@TIME-GATE commented on GitHub (Apr 8, 2024):

I encountered the same problem, which seemed very abnormal, and after only a few requests, the whole ollama got stuck, and after waiting for nearly an hour, there still seemed to be dozens of these processes, so I have to restart it and continue to use ollama.

@aiseei did you solve this problem? looks like it's the only problem I've encountered on ubuntu.

<!-- gh-comment-id:2043169054 --> @TIME-GATE commented on GitHub (Apr 8, 2024): I encountered the same problem, which seemed very abnormal, and after only a few requests, the whole ollama got stuck, and after waiting for nearly an hour, there still seemed to be dozens of these processes, so I have to restart it and continue to use ollama. @aiseei did you solve this problem? looks like it's the only problem I've encountered on ubuntu.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#1714