Skip to content

Reuse connections in engine health probes - #35

Merged
JaredP94 merged 1 commit into
mainfrom
fix/probe-connection-reuse
Nov 2, 2026
Merged

JaredP94 merged 1 commit into
mainfrom
fix/probe-connection-reuse

Conversation

@JaredP94

@JaredP94 JaredP94 commented Nov 2, 2026

Copy link
Copy Markdown
Owner

Description

The broker's Ollama, LM Studio and oMLX health checks and the engine manager's readiness probe closed response bodies unread. Go's HTTP/1 transport only pools a connection whose body reached EOF, so every poll opened a new connection. Bodies are now drained (bounded at 1 MiB) before closing, via a shared httpcon.DrainAndClose.

Ported from NVIDIA/Personal-AI-Router@5ae90de (NVIDIA#37), which fixed only the Ollama path; extended to the LM Studio and oMLX probes.

Validation

go test ./... in shared (new test: 16 polls use 1 connection, for both Content-Length and chunked bodies), nvpair-ui-broker, nvpair-engine-manager.

Risk

Low. ui-broker 2.5.0, engine-manager 1.4.0.

Checklist

  • I have read the Contributing Guidelines.
  • Every commit is signed off (git commit -s), certifying the Developer Certificate of Origin.
  • New or existing tests cover the change.
  • Relevant documentation is updated.
  • I checked the diff, changed filenames, and commit messages for credentials, private data, internal URLs, internal issue identifiers, and generated artifacts.
  • I recorded the validation commands and results above.
  • I bumped any affected component in services/versions.json, and described user-visible changes above so they reach the release notes.

Part of the upstream issue/PR review. Each branch is independent off main; they all bump services/versions.json, so the second one merged will need a trivial conflict resolution there.

The broker's Ollama, LM Studio and oMLX health checks and the engine
manager's readiness probe closed each response body without reading it.
Go's HTTP/1 transport only returns a connection to the pool once its
body reaches EOF, so every poll opened a new connection to the engine.

Drain a bounded amount of each body before closing it (shared
httpcon.DrainAndClose), so one connection serves every poll.

Ported from NVIDIA/Personal-AI-Router@5ae90de (NVIDIA#37), which fixed the
Ollama path; extended to this fork's LM Studio and oMLX probes.

Co-authored-by: Psych0h3ad <41975091+Psych0h3ad@users.noreply.github.com>
Signed-off-by: Jared Ping <13906915+JaredP94@users.noreply.github.com>
@JaredP94
JaredP94 force-pushed the fix/probe-connection-reuse branch from 45a95b3 to 878251b Compare November 2, 2026 18:57
@JaredP94
JaredP94 merged commit 6684181 into main Nov 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant