You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@yunikorn.apache.org by "Peter Bacsko (Jira)" <ji...@apache.org> on 2023/03/27 11:35:00 UTC

[jira] [Comment Edited] (YUNIKORN-1641) Queue tracker object is not cleaned up when a queue is deleted

    [ https://issues.apache.org/jira/browse/YUNIKORN-1641?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17705307#comment-17705307 ] 

Peter Bacsko edited comment on YUNIKORN-1641 at 3/27/23 11:34 AM:
------------------------------------------------------------------

That looks different to me. Those checks tell whether a given user/group have zero tracked resources. We need to remove a tracker from the hierarchy whenever the tracked resource becomes zero. To me this looks like a good approach inside {{decreaseTrackedResource()}}:

{noformat}
func (qt *QueueTracker) decreaseTrackedResource(queuePath string, applicationID string, usage *resources.Resource, removeApp bool) error {
        ...
	for childQueue, tracker := range qt.childQueueTrackers {
		if resources.IsZero(tracker.resourceUsage) {
			log.Logger().Info("Removing child tracker, resource usage is zero",
				zap.String("this queue", qt.queueName),
				zap.String("child queue", childQueue))
			delete(qt.childQueueTrackers, childQueue)
		}
	}

	if len(qt.childQueueTrackers) == 0 && !resources.IsZero(qt.resourceUsage) {
		// invariant violated
		return fmt.Errorf("BUG: no child trackers left, but the resource usage is not zero - tracker %s resource %v",
			qt.queueName, qt.resourceUsage)
	}

       return nil
{noformat}

So every tracker checks its own immediate child trackers.


was (Author: pbacsko):
That looks different to me. Those checks tell whether a given user/group have zero tracked resources. We need to remove a tracker from the hierarchy whenever the tracked resource becomes zero. To me this looks like a good approach inside {{decreaseTrackedResource()}}:

{noformat}
func (qt *QueueTracker) decreaseTrackedResource(queuePath string, applicationID string, usage *resources.Resource, removeApp bool) error {
        ...
	for childQueue, tracker := range qt.childQueueTrackers {
		if resources.IsZero(tracker.resourceUsage) {
			log.Logger().Info("Removing tracker, resource usage is zero",
				zap.String("this queue", qt.queueName),
				zap.String("child queue", childQueue))
			delete(qt.childQueueTrackers, childQueue)
		}
	}

	if len(qt.childQueueTrackers) == 0 && !resources.IsZero(qt.resourceUsage) {
		// invariant violated
		return fmt.Errorf("BUG: no child trackers left, but the resource usage is not zero - tracker %s resource %v",
			qt.queueName, qt.resourceUsage)
	}

       return nil
{noformat}

So every tracker checks its own immediate child trackers.

> Queue tracker object is not cleaned up when a queue is deleted
> --------------------------------------------------------------
>
>                 Key: YUNIKORN-1641
>                 URL: https://issues.apache.org/jira/browse/YUNIKORN-1641
>             Project: Apache YuniKorn
>          Issue Type: Sub-task
>          Components: core - scheduler
>            Reporter: Peter Bacsko
>            Assignee: Qi Zhu
>            Priority: Major
>              Labels: pull-request-available
>
> Currently, every queue has its own {{QueueTracker}} object which is managed by {{{}ugm.Manager{}}}.
> But when the queue is deleted either by a config change or automatically by the partition manager, the tracker object stays in memory, causing a memory leak.



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

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@yunikorn.apache.org
For additional commands, e-mail: issues-help@yunikorn.apache.org