[GH-ISSUE #4267] ollama_llama_server is still running after exiting via SIGINT #49175

Closed
opened 2026-04-28 10:53:56 -05:00 by GiteaMirror · 0 comments
Owner

Originally created by @robbycbennett on GitHub (May 8, 2024).
Original GitHub issue: https://github.com/ollama/ollama/issues/4267

Originally assigned to: @dhiltgen on GitHub.

What is the issue?

When I kill ollama serve with control-C with the keyboard, it closes ollama_llama_server and therefore it all exits properly. However, when I kill it in another way like kill -2 then ollama_llama_server still runs afterward.

Replicate:

  1. OLLAMA_HOST=localhost:6767 ollama serve &
  2. Note the process ID
  3. ollama pull llama3 if you don't already have this model
  4. Post a chat
    • Run the curl command below OR
    • Run the python script included below
  5. kill -2 PROCESS_ID_HERE (2 is SIGINT, just like control-C)
# curl command to post a chat
curl http://localhost:6767/api/chat -d '{
  "model": "llama3",
  "messages": [
    {
      "role": "user",
      "content": "why is the sky blue?"
    }
  ]
}'
#! /usr/bin/env python3


# python script to post a chat


from llama_index.core import Document, Settings, VectorStoreIndex
from llama_index.embeddings.ollama import OllamaEmbedding
from llama_index.llms.ollama import Ollama


MODEL = 'llama3'
TEMPERATURE = 0.2
PORT = 6767
PROMPT = 'What is your favorite color out of the colors listed?'


def createLLM():
    llm = Ollama(
        base_url=f'http://localhost:{PORT}',
        model=MODEL,
        temperature=TEMPERATURE,
        request_timeout=60.0, # seconds
    )
    Settings.llm = llm
    Settings.embed_model = OllamaEmbedding(model_name=MODEL)


def main():
    createLLM()

    index = VectorStoreIndex.from_documents([Document(id_='colors', text='red, yellow, blue')])
    query_engine = index.as_query_engine(streaming=True)

    print(PROMPT)
    response = str(query_engine.query(PROMPT))
    print(response)


if __name__ == '__main__':
    main()

OS

Linux

GPU

Nvidia

CPU

AMD

Ollama version

0.1.34

Originally created by @robbycbennett on GitHub (May 8, 2024). Original GitHub issue: https://github.com/ollama/ollama/issues/4267 Originally assigned to: @dhiltgen on GitHub. ### What is the issue? When I kill `ollama serve` with control-C with the keyboard, it closes `ollama_llama_server` and therefore it all exits properly. However, when I kill it in another way like `kill -2` then `ollama_llama_server` still runs afterward. Replicate: 1. `OLLAMA_HOST=localhost:6767 ollama serve &` 2. Note the process ID 3. `ollama pull llama3` if you don't already have this model 4. Post a chat - Run the curl command below OR - Run the python script included below 5. `kill -2 PROCESS_ID_HERE` (2 is SIGINT, just like control-C) ```sh # curl command to post a chat curl http://localhost:6767/api/chat -d '{ "model": "llama3", "messages": [ { "role": "user", "content": "why is the sky blue?" } ] }' ``` ```py #! /usr/bin/env python3 # python script to post a chat from llama_index.core import Document, Settings, VectorStoreIndex from llama_index.embeddings.ollama import OllamaEmbedding from llama_index.llms.ollama import Ollama MODEL = 'llama3' TEMPERATURE = 0.2 PORT = 6767 PROMPT = 'What is your favorite color out of the colors listed?' def createLLM(): llm = Ollama( base_url=f'http://localhost:{PORT}', model=MODEL, temperature=TEMPERATURE, request_timeout=60.0, # seconds ) Settings.llm = llm Settings.embed_model = OllamaEmbedding(model_name=MODEL) def main(): createLLM() index = VectorStoreIndex.from_documents([Document(id_='colors', text='red, yellow, blue')]) query_engine = index.as_query_engine(streaming=True) print(PROMPT) response = str(query_engine.query(PROMPT)) print(response) if __name__ == '__main__': main() ``` ### OS Linux ### GPU Nvidia ### CPU AMD ### Ollama version 0.1.34
GiteaMirror added the bug label 2026-04-28 10:53:56 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#49175