Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
Description
The implementation of the new method getApplicationsDAO() is incorrect:
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()...) ....
The slice creation is incorrect - the initial length should be 0, and the capacity should be set to the "size":
appList := make([]*objects.Application, 0, size)
Right now appList will contail "nil" elements after creation:
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
Attachments
Issue Links
- links to