From 3703fad74384423487676904950203939a1f6724 Mon Sep 17 00:00:00 2001 From: Jussi Maki Date: Tue, 9 Jun 2026 11:43:09 +0200 Subject: [PATCH] job: Don't unset started when registry stops By setting 'started = false' any jobs added after the registry has stopped could get appended to the application lifecycle. This can be hit by having a job added before starting that tries to add a job at runtime. That job is stopped after the registry and thus has time to call JobGroup.Add. It is possible to deadlock by stopping at the same time: Hive.Stop has locked the lifecycle mutex and appending is not possible and if job tries to append to the lifecycle before its stop hook gets called it'll deadlock. There is no use-case for making the registry restartable so just remove setting started to false completely. Signed-off-by: Jussi Maki --- job/job.go | 1 - 1 file changed, 1 deletion(-) diff --git a/job/job.go b/job/job.go index 5709616..dc83009 100644 --- a/job/job.go +++ b/job/job.go @@ -94,7 +94,6 @@ func (c *registry) Stop(ctx cell.HookContext) error { if !c.started { return nil } - c.started = false return c.runtimeLifecycle.stop(ctx, c.logger) }