[ 
https://issues.apache.org/jira/browse/YUNIKORN-3363?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Dale Richardson updated YUNIKORN-3363:
--------------------------------------
    Description: 
Follow-up to YUNIKORN-3357 (goleak adoption, PR #1124); burns down leakcheck 
exemptions events.(*EventSystemImpl).StartServiceWithPublisher.func1 and 
events.(*eventPublisher).start.func1.

{{events.Init()}} registers a configmap callback ({{{}event_system.go{}}}) that 
{{EventSystemImpl.Stop()}} never removes via 
{{configs.RemoveConfigMapCallback}} — compare {{{}health_checker.go{}}}, which 
deregisters correctly. Any configuration reload after {{Stop()}} runs 
{{reloadConfig() -> restart()}} and resurrects an event system that nobody 
holds a reference to; its handler ({{{}StartServiceWithPublisher.func1{}}}) and 
publisher ({{{}eventPublisher.start.func1{}}}) goroutines then run for the life 
of the process.

Aggravator: {{eventSystemId}} is {{{}fmt.Sprintf("event-system-%d", 
time.Now().Unix()){}}}, so repeated {{Init()}} calls collide on the callback 
key within a second and accumulate across seconds.

Proposed fix:
 * deregister the callback in {{Stop()}} (or re-register in 
{{{}StartServiceWithPublisher{}}})
 * use a unique id (uuid) instead of a unix-seconds timestamp
 * delete the two events exemptions in {{pkg/common/leakcheck/leakcheck.go}}

  was:
Follow-up to YUNIKORN-3357 (goleak adoption, PR #1124); burns down leakcheck 
exemptions
events.(*EventSystemImpl).StartServiceWithPublisher.func1 and 
events.(*eventPublisher).start.func1.

{{events.Init()}} registers a configmap callback ({{event_system.go}}) that 
{{EventSystemImpl.Stop()}} never removes via 
{{configs.RemoveConfigMapCallback}} — compare {{health_checker.go}}, which 
deregisters correctly. Any configuration reload after {{Stop()}} runs 
{{reloadConfig() -> restart()}} and resurrects an event system that nobody 
holds a reference to; its handler ({{StartServiceWithPublisher.func1}}) and 
publisher ({{eventPublisher.start.func1}}) goroutines then run for the life of 
the process.

Aggravator: {{eventSystemId}} is {{fmt.Sprintf("event-system-%d", 
time.Now().Unix())}}, so repeated {{Init()}} calls collide on the callback key 
within a second and accumulate across seconds.

Proposed fix:
* deregister the callback in {{Stop()}} (or re-register in 
{{StartServiceWithPublisher}})
* use a unique id (uuid) instead of a unix-seconds timestamp
* delete the two events exemptions in {{pkg/common/leakcheck/leakcheck.go}}


> Event system restarts after Stop(): configmap callback never deregistered, 
> leaking handler and publisher goroutines
> -------------------------------------------------------------------------------------------------------------------
>
>                 Key: YUNIKORN-3363
>                 URL: https://issues.apache.org/jira/browse/YUNIKORN-3363
>             Project: Apache YuniKorn
>          Issue Type: Bug
>          Components: core - scheduler
>            Reporter: Dale Richardson
>            Priority: Major
>              Labels: newbie
>
> Follow-up to YUNIKORN-3357 (goleak adoption, PR #1124); burns down leakcheck 
> exemptions events.(*EventSystemImpl).StartServiceWithPublisher.func1 and 
> events.(*eventPublisher).start.func1.
> {{events.Init()}} registers a configmap callback ({{{}event_system.go{}}}) 
> that {{EventSystemImpl.Stop()}} never removes via 
> {{configs.RemoveConfigMapCallback}} — compare {{{}health_checker.go{}}}, 
> which deregisters correctly. Any configuration reload after {{Stop()}} runs 
> {{reloadConfig() -> restart()}} and resurrects an event system that nobody 
> holds a reference to; its handler ({{{}StartServiceWithPublisher.func1{}}}) 
> and publisher ({{{}eventPublisher.start.func1{}}}) goroutines then run for 
> the life of the process.
> Aggravator: {{eventSystemId}} is {{{}fmt.Sprintf("event-system-%d", 
> time.Now().Unix()){}}}, so repeated {{Init()}} calls collide on the callback 
> key within a second and accumulate across seconds.
> Proposed fix:
>  * deregister the callback in {{Stop()}} (or re-register in 
> {{{}StartServiceWithPublisher{}}})
>  * use a unique id (uuid) instead of a unix-seconds timestamp
>  * delete the two events exemptions in {{pkg/common/leakcheck/leakcheck.go}}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to