danielmiessler / danielmiessler/Fabric
[Bug]: ollama stream ignores request cancellation
- Dominant language
- Go
- Stars
- 43.9k
- Forks
- 4.3k
- Avg merge
- 1d 4h
- Merged PRs (30d)
- 8
Description
### What happened?
when ollama streaming starts.. the request context gets replaced with context.background() inside sendstream..
that means canceled cli sessions or closed http clients do not actually stop the ollama request.. it keeps running until ollama finishes or times out..
this also means stream sends can block longer than they should when the caller is already gone..
expected behavior.. sendstream should honor the incoming context for the ollama chat request and for writes into the stream channel.. returning context.canceled when the caller is gone..
steps to reproduce.. start an ollama stream request.. cancel the caller context or disconnect the client.. notice the ollama request keeps running instead of stopping immediately..
### Operating System
linux - amd64
### OS Version
```shell
Linux amd64
```
### How did you install Fabric?
go install
### Version
```text
v1.4.470
```
Contributor guide
Research direction
Locate sendstream and trace how the incoming context is used for the Ollama chat request and stream-channel writes. Reproduce cancellation with an Ollama stream, then verify the request stops promptly and returns context.canceled when the caller disconnects or cancels.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, ollama
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100