ECSTeam / cloudfoundry-top-plugin

Cloud Foundry CF cli plugin - show top stats
Apache License 2.0
73 stars 21 forks source link

panic: runtime error: invalid memory address or nil pointer dereference #19

Open filidav opened 4 years ago

filidav commented 4 years ago

After installation and running cf top Then selecting Cells I get this error

panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0x4539672]

goroutine 1 [running]: github.com/ecsteam/cloudfoundry-top-plugin/ui/views/cellViews/cellView.(CellListView).postProcessData(0xc000011a88, 0x1) /Users/kkellner/go_lib/src/github.com/ecsteam/cloudfoundry-top-plugin/ui/views/cellViews/cellView/cellListView.go:166 +0x3d2 github.com/ecsteam/cloudfoundry-top-plugin/ui/views/cellViews/cellView.(CellListView).GetListData(0xc000011a88, 0x45ec640, 0xc000da8040, 0xc001c17810) /Users/kkellner/go_lib/src/github.com/ecsteam/cloudfoundry-top-plugin/ui/views/cellViews/cellView/cellListView.go:127 +0x2b github.com/ecsteam/cloudfoundry-top-plugin/ui/uiCommon/views/dataView.(DataListView).updateData(0xc0003ca870) /Users/kkellner/go_lib/src/github.com/ecsteam/cloudfoundry-top-plugin/ui/uiCommon/views/dataView/dataListView.go:225 +0x2e github.com/ecsteam/cloudfoundry-top-plugin/ui/uiCommon/views/dataView.(DataListView).UpdateDisplay(0xc0003ca870, 0xc0002fe120, 0x0, 0x0) /Users/kkellner/go_lib/src/github.com/ecsteam/cloudfoundry-top-plugin/ui/uiCommon/views/dataView/dataListView.go:211 +0x2b github.com/ecsteam/cloudfoundry-top-plugin/ui.(MasterUI).updateDisplay.func1(0xc0002fe120, 0xc0018278bc, 0x3) /Users/kkellner/go_lib/src/github.com/ecsteam/cloudfoundry-top-plugin/ui/masterUi.go:620 +0x67 github.com/jroimartin/gocui.(Gui).consumeevents(0xc0002fe120, 0xc001827a10, 0x0) /Users/kkellner/go_lib/src/github.com/jroimartin/gocui/gui.go:399 +0x1e8 github.com/jroimartin/gocui.(Gui).MainLoop(0xc0002fe120, 0x4718d90, 0xc000182600) /Users/kkellner/go_lib/src/github.com/jroimartin/gocui/gui.go:381 +0x206 github.com/ecsteam/cloudfoundry-top-plugin/ui.(MasterUI).initGui(0xc000182600, 0x0) /Users/kkellner/go_lib/src/github.com/ecsteam/cloudfoundry-top-plugin/ui/masterUi.go:199 +0x70f github.com/ecsteam/cloudfoundry-top-plugin/ui.(MasterUI).Start(0xc000182600, 0x0) /Users/kkellner/go_lib/src/github.com/ecsteam/cloudfoundry-top-plugin/ui/masterUi.go:151 +0x4b github.com/ecsteam/cloudfoundry-top-plugin/top.(Client).Start(0xc000166400) /Users/kkellner/go_lib/src/github.com/ecsteam/cloudfoundry-top-plugin/top/client.go:144 +0x49a main.(*TopCmd).Run(0xc00013a7f0, 0x47d29c0, 0xc00013a800, 0xc00009c0b0, 0x1, 0x1) /Users/kkellner/go_lib/src/github.com/ecsteam/cloudfoundry-top-plugin/main.go:167 +0x76d github.com/cloudfoundry/cli/plugin.Start(0x47c3860, 0xc00013a7f0) /Users/kkellner/go_lib/src/github.com/cloudfoundry/cli/plugin/plugin_shim.go:34 +0x284

filidav commented 4 years ago

Same issue with 0.9.4 version 0.9.3 works fine

forbushbl commented 4 years ago

I get the same issue with 0.9.5 if I change to the cells view immediately. If I wait for 10 min or so after starting cf top, I can switch to cell stats without any issues.

mauricebrinkmann commented 2 years ago

Same here with 0.9.5 (and CF CLI version 7.4.0+e55633fed.2021-11-15). But thanks to the previous comment, I finally could open the cells view after waiting for all meta data to be loaded as a workaround.

mauricebrinkmann commented 2 years ago

stackGroupMd := asUI.GetMdGlobalMgr().GetStackMdManager().FindStackGroupByStackGuid(appMetadata.StackGuid) if displayCellStat.StackGroupId == "" && appMetadata.StackGuid != "" { displayCellStat.StackGroupId = stackGroupMd.Guid } if displayCellStat.StackGroupName == "" && stackGroupMd.Name != "" { The last line is the failing cellListView.go line 166 and there is a check for displayCellStat != nil before, so the same check is missing for stackGroupMd or how should be the logic if that is nil or not containing a valid Name field?