[GH-ISSUE #7663] Ollama API Multiple thread error reporting, abnormal thread time consumption #4890

Closed
opened 2026-04-12 15:55:41 -05:00 by GiteaMirror · 1 comment
Owner

Originally created by @jamine2024 on GitHub (Nov 14, 2024).
Original GitHub issue: https://github.com/ollama/ollama/issues/7663

What is the issue?

Error:
msg="failed to decode batch" error="could not find a KV slot for the batch - try reducing the size of the batch or increase the context. code: 1"
time=2024-11-13T20:41:50.757+08:00 level=ERROR source=server.go:690 msg="Failed to acquire semaphore" error="context canceled"

USE PYTHON API Find some error with server.log

`url = f'{ollama_api}/api/generate'
headers = {'Content-Type': 'application/json'}
data = {
"model": ollama_mode,
"prompt": f'{title} {config.get("out", "content")}'
}

response = requests.post(url, headers=headers, json=data, timeout=120)
responses = ''.join(json.loads(line)["response"] for line in response.text.split('\n') if line)`

How to deal with multithreading will lead to the API response delay, and eventually will appear as raised at the beginning!
Is there a scheme to end the thread?
1731562882316

OS

Windows

GPU

Nvidia

CPU

Intel

Ollama version

0.4.1

Originally created by @jamine2024 on GitHub (Nov 14, 2024). Original GitHub issue: https://github.com/ollama/ollama/issues/7663 ### What is the issue? Error: msg="failed to decode batch" error="could not find a KV slot for the batch - try reducing the size of the batch or increase the context. code: 1" time=2024-11-13T20:41:50.757+08:00 level=ERROR source=server.go:690 msg="Failed to acquire semaphore" error="context canceled" USE PYTHON API Find some error with server.log `url = f'{ollama_api}/api/generate' headers = {'Content-Type': 'application/json'} data = { "model": ollama_mode, "prompt": f'{title} {config.get("out", "content")}' } response = requests.post(url, headers=headers, json=data, timeout=120) responses = ''.join(json.loads(line)["response"] for line in response.text.split('\n') if line)` How to deal with multithreading will lead to the API response delay, and eventually will appear as raised at the beginning! Is there a scheme to end the thread? ![1731562882316](https://github.com/user-attachments/assets/514648d0-6c40-404d-b836-59677ac1ed3b) ### OS Windows ### GPU Nvidia ### CPU Intel ### Ollama version 0.4.1
GiteaMirror added the bug label 2026-04-12 15:55:41 -05:00
Author
Owner

@jessegross commented on GitHub (Nov 14, 2024):

This looks like it is the same as #7545 so let's track it there. However, this may already be fixed - if you are able to build from main to test it that would be very helpful.

<!-- gh-comment-id:2477118425 --> @jessegross commented on GitHub (Nov 14, 2024): This looks like it is the same as #7545 so let's track it there. However, this may already be fixed - if you are able to build from `main` to test it that would be very helpful.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#4890