Skip to content

chore: bump go-processmanager to pick up the concurrent-Run fix#11004

Merged
mudler merged 1 commit into
masterfrom
chore/bump-go-processmanager
Jul 20, 2026
Merged

chore: bump go-processmanager to pick up the concurrent-Run fix#11004
mudler merged 1 commit into
masterfrom
chore/bump-go-processmanager

Conversation

@localai-bot

Copy link
Copy Markdown
Collaborator

Picks up mudler/go-processmanager#7.

What it fixes upstream

Run's "already started" guard was a check-then-act on p.proc with no lock. Concurrent Run calls on the same handle could each observe a nil p.proc, each start a process, and each launch a monitor goroutine. Every monitor does defer close(p.done) against a channel created once in New and never recreated, so the second monitor to see its process exit panicked with close of closed channel. The same window raced on p.proc itself, written unsynchronized while the previous monitor, its reapChildren child and release were reading it.

Same class as the PID race picked up in the previous bump (#6), one field over.

Why bump now, given LocalAI does not hit it

This is defensive rather than a fix for an observed failure, and the PR should be judged as such:

  • the only New/Run pair is pkg/model/process.go:178-191, which runs a freshly created handle
  • core/services/worker/supervisor.go only ever calls Stop on handles it holds; it never calls Run
  • no reuse-after-Stop pattern exists anywhere in the repo

So no current call site can open the window. The value is not drifting further behind fixes in a process lifecycle we depend on, while the delta is still one line and reviewable.

Compatibility

Upstream reports no exported signature changes. ErrProcessAlreadyRun is additive, and its message keeps the historical command already started prefix so callers matching on that text keep working. Grepped this repo including tests/e2e/nothing matches that text, so even the text-compat path is unused here.

Verification

go build ./core/... ./pkg/...              exit 0, no output
go vet ./pkg/model/ ./core/services/worker/ exit 0
go test -race ./pkg/model/ ./core/services/worker/
  ok  github.com/mudler/LocalAI/pkg/model            2.927s
  ok  github.com/mudler/LocalAI/core/services/worker 6.741s

-race specifically, since the upstream change is a race fix — a plain go test would not exercise what this bump is for. Diff is go.mod + go.sum only.

Note for the maintainer

This stays on a pseudo-version because upstream has no tag past v0.1.1 (which is PR #4). Master was already on a #6 pseudo-version, so this is consistent with what is there rather than a new pattern. If you would rather cut a v0.1.2 on go-processmanager, this PR can be re-pointed at the tag instead.

Picks up mudler/go-processmanager#7, which closes the check-then-act
window in Run's "already started" guard. Concurrent Run calls on one
handle could each observe a nil p.proc, each start a process and each
launch a monitor goroutine; every monitor does `defer close(p.done)`
against a channel created once in New, so the second monitor to see its
process exit panicked on close of a closed channel. The same window
raced on p.proc itself.

LocalAI does not hit this today: the only New/Run pair
(pkg/model/process.go:178-191) runs a freshly created handle, and
core/services/worker/supervisor.go only ever calls Stop on handles it
holds. The bump is defensive, and keeps the dependency from drifting
further behind a fix in the process lifecycle we rely on.

No exported signature changes upstream; ErrProcessAlreadyRun is
additive and keeps the historical "command already started" prefix, so
any caller matching on that text is unaffected. Nothing in this repo
matches it.

Verified: go build ./core/... ./pkg/... clean; go vet clean;
go test -race ./pkg/model/ ./core/services/worker/ both ok.

Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
Assisted-by: Claude Code:claude-opus-4-8[1m] [Read] [Bash] [Edit]
@mudler
mudler merged commit d0401f9 into master Jul 20, 2026
21 of 22 checks passed
@mudler
mudler deleted the chore/bump-go-processmanager branch July 20, 2026 21:32
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.

2 participants