You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@yunikorn.apache.org by "Dale Richardson (Jira)" <ji...@apache.org> on 2026/08/14 15:57:00 UTC
[jira] [Resolved] (YUNIKORN-3366) Instrumented-package tests leak core-service goroutines by not stopping the services they start
[ https://issues.apache.org/jira/browse/YUNIKORN-3366?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Dale Richardson resolved YUNIKORN-3366.
---------------------------------------
Resolution: Duplicate
> Instrumented-package tests leak core-service goroutines by not stopping the services they start
> -----------------------------------------------------------------------------------------------
>
> Key: YUNIKORN-3366
> URL: https://issues.apache.org/jira/browse/YUNIKORN-3366
> Project: Apache YuniKorn
> Issue Type: Bug
> Components: core - scheduler
> Reporter: Dale Richardson
> Priority: Minor
> Labels: newbie
>
> Follow-up to YUNIKORN-3357 (PR #1124); burns down the "stoppable" leakcheck exemptions that are test hygiene rather than production defects:
> * scheduler.(*partitionManager).cleanRoot
> * scheduler.(*partitionManager).cleanExpiredApps
> * common/security.(*UserGroupCache).run
> * events.(*EventSystemImpl).StartServiceWithPublisher.func1 (the test-only half)
> These goroutines are all correctly stoppable in production — {{ClusterContext.Stop}} stops the two partition cleaners started by {{{}partitionManager.Run{}}}, {{UserGroupCache.Stop()}} closes the cleaner and resets the singleton (and {{ClusterContext.Stop}} calls it), and {{EventSystemImpl.Stop()}} stops the handler. The leaks are tests that construct these services (via {{{}events.Init(){}}}/{{{}StartService{}}}, a {{{}ClusterContext{}}}, or user resolution) and never call {{{}Stop(){}}}, so the goroutines outlive the test binary.
> Repro: remove the corresponding exemption in {{pkg/common/leakcheck/leakcheck.go}} and run the package, e.g.
> {code:java}
> go test ./pkg/scheduler/... ./pkg/common/security/... ./pkg/events/...
> {code}
> goleak's {{VerifyTestMain}} then fails the binary with the leaked stack.
> Proposed fix: have the affected tests {{defer <service>.Stop()}} after starting it, then delete the four exemptions. Can be split per-package if preferred (partition cleaners / UserGroupCache / event system).
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@yunikorn.apache.org
For additional commands, e-mail: dev-help@yunikorn.apache.org