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 2021/11/23 13:17:00 UTC

[jira] [Created] (YUNIKORN-952) nil pointer error in webservice.getApplicationJSON()

Peter Bacsko created YUNIKORN-952:
-------------------------------------

             Summary: nil pointer error in webservice.getApplicationJSON()
                 Key: YUNIKORN-952
                 URL: https://issues.apache.org/jira/browse/YUNIKORN-952
             Project: Apache YuniKorn
          Issue Type: Bug
          Components: core - scheduler
            Reporter: Peter Bacsko


The implementation of the new method {{getApplicationsDAO()}} is incorrect:

{noformat}
func getApplicationsDAO(lists map[string]*scheduler.PartitionContext) []*dao.ApplicationDAOInfo {
	result := make([]*dao.ApplicationDAOInfo, 0, 32)

	for _, partition := range lists {
		size := partition.GetTotalCompletedApplicationCount() + partition.GetTotalApplicationCount()
		appList := make([]*objects.Application, size)
		appList = append(appList, partition.GetApplications()...)
		appList = append(appList, partition.GetCompletedApplications()...)
....
{noformat}

The slice creation is incorrect - the initial length should be 0, and the capacity should be set to the "size":
{noformat}
appList := make([]*objects.Application, 0, size)
{noformat}

Right now appList will contail "nil" elements after creation.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

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