knative: goroutine leak in Deploy when service becomes ready before private-registry check

Open
#3,797 1 comment 0 reactions 1 assignee View on GitHub

@Elvand-Lie is already working on this.

Since Jun 2, 2026.

Assessment

This issue has not been assessed yet.

Description

kind/bug

In pkg/knative/deployer.go, the Deploy function (new-service creation path, around line 237) starts a background goroutine that polls isImageInPrivateRegistry every 5 seconds and sends results on an unbuffered channel (chprivate).

If the WaitForService goroutine completes first (service becomes ready via cherr), the main function breaks out of the select loop and returns. The poller goroutine is then stuck on the unbuffered channel send at line 242 (chprivate <- private) with no receiver, and it blocks forever. The time.Sleep at line 240 also does not respect context cancellation.

This leaks the goroutine and everything it captures (the deployer, serving client, and function struct).

Fix: use a done channel or context to signal the poller goroutine to exit when the main select loop finishes.

Dominant language
Go
Stars
365
Forks
223
Avg merge
2d 3h
Merged PRs (30d)
25

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from knative/func

All issues in knative/func

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.