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: [email protected]
For additional commands, e-mail: [email protected]