<#7577 fix(actions): scope WatchForUpdates pub/sub...
# flyte-github
a
#7577 fix(actions): scope WatchForUpdates pub/sub by run to stop cross-run contamination Pull request opened by pingsutw Why are the changes needed? Parent actions were getting stuck in
Executing
forever on the development cluster under concurrent load (e.g. the
sleep_fanout
stress test), even though all of their children had completed. Root cause: watch subscriptions were keyed solely on the parent action name. Every run's root action is named
a0
, so
subscribers["a0"]
collected the watch channels of every concurrent run, and
notifySubscribers
fanned each child update out to all of them with no run filter: // actions/k8s/client.go updateCh := s.client.Subscribe(parentActionID.Name) // Subscribe("a0") ... for ch := range c.subscribers[update.ParentActionName] { // "a0" -> all runs' parents ch <- update } So a parent received child updates from every other run watching
a0
. Combined with the SDK informer caching children by bare action name (no run), and the fanout example naming its children deterministically (so the same 10 names recur every run), a child that
SUCCEEDED
in run A had its cached phase repeatedly clobbered back to
RUNNING
by run B's same-named child. The parent never saw all of its own children simultaneously terminal and hung indefinitely. Evidence from a stuck parent pod on flyte-development: its controller log referenced dozens of foreign runs (more lines for a foreign run than for itself), child output URIs pointing at other runs, and one child's phase oscillating `RUNNING`/`SUCCEEDED` (97/48). What changes were proposed in this pull request? Scope the watch pub/sub by (run, parent action) instead of parent action name alone: •
actions/k8s/client.go
— add
subscriberKey(runName, parentActionName)
(
runName + "/" + parentActionName
); `Subscribe`/`Unsubscribe` take a
runName
and key on the composite;
notifySubscribers
routes on the child update's own run (
update.ActionID.GetRun().GetName()
, nil-safe). •
actions/service/actions_service.go
—
WatchForUpdates
passes
parentActionID.GetRun().GetName()
. •
actions/service/interfaces.go
— interface signatures updated. •
actions/service/mocks/mocks.go
— regenerated via
mockery
. This isolates each run's watch stream at the source. (The SDK-side defensive guard — dropping foreign-run updates / keying the informer cache by full action id — is a separate flyte-sdk change.) How was this patch tested? Added `actions/k8s/client_subscribe_test.go`: •
TestSubscribeIsScopedByRun
— two subscribers on parent
a0
under different runs; a
runA
update reaches
runA
only and does not leak to
runB
(the exact failure before this fix). •
TestUnsubscribeScopedByRun
— the run-scoped key is cleaned up; notify after unsubscribe is a safe no-op.
go test ./actions/...
passes;
go build ./actions/... ./app/...
and
go vet ./actions/...
are clean. The apps service uses a separate
AppK8sClientInterface
and is unaffected. Labels • fixed Check all the applicable boxes • All new and existing tests passed. • All commits are signed-off. flyteorg/flyte