You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@yunikorn.apache.org by "Kinga Marton (Jira)" <ji...@apache.org> on 2021/11/29 11:51:00 UTC

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

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

Kinga Marton resolved YUNIKORN-952.
-----------------------------------
    Fix Version/s: 0.12
       Resolution: Fixed

> 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
>            Assignee: Peter Bacsko
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 0.12
>
>
> 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:
> {noformat}
> goroutine 847 [running]:
> net/http.(*conn).serve.func1()
> 	/snap/go/8627/src/net/http/server.go:1801 +0xb9
> panic({0x14c04e0, 0x2476930})
> 	/snap/go/8627/src/runtime/panic.go:1047 +0x266
> github.com/apache/incubator-yunikorn-core/pkg/scheduler/objects.(*Application).GetAllAllocations(0xffffffffffffffff)
> 	/home/bacskop/repos/yunikorn-core/pkg/scheduler/objects/application.go:1134 +0x51
> github.com/apache/incubator-yunikorn-core/pkg/webservice.getApplicationJSON(0x0)
> 	/home/bacskop/repos/yunikorn-core/pkg/webservice/handlers.go:250 +0x36
> github.com/apache/incubator-yunikorn-core/pkg/webservice.getApplicationsDAO(0xc006916270)
> 	/home/bacskop/repos/yunikorn-core/pkg/webservice/handlers.go:632 +0x313
> github.com/apache/incubator-yunikorn-core/pkg/webservice.doStateDump({0x188dee0, 0xc0002400e0})
> 	/home/bacskop/repos/yunikorn-core/pkg/webservice/state_dump.go:143 +0x158
> github.com/apache/incubator-yunikorn-core/pkg/webservice.getFullStateDump({0x18b5138, 0xc0002400e0}, 0x489bf7)
> 	/home/bacskop/repos/yunikorn-core/pkg/webservice/state_dump.go:67 +0x45
> net/http.HandlerFunc.ServeHTTP(0x100000000000000, {0x18b5138, 0xc0002400e0}, 0x90)
> 	/snap/go/8627/src/net/http/server.go:2046 +0x2f
> {noformat}



--
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