For confirmed bugs, please report:
- Version: 7.7.0
- Operating System: n/a
- Discuss Forum URL: n/a
- Steps to Reproduce:
For some users the vSphere module is crashing randomly with:
runtime error: invalid memory address or nil pointer dereference
github.com/elastic/beats/v7/libbeat/logp.Recover
/go/src/github.com/elastic/beats/libbeat/logp/global.go:101
runtime.gopanic
/usr/local/go/src/runtime/panic.go:679
runtime.panicmem
/usr/local/go/src/runtime/panic.go:199
runtime.sigpanic
/usr/local/go/src/runtime/signal_windows.go:233
github.com/elastic/beats/v7/metricbeat/module/vsphere/virtualmachine.(*MetricSet).Fetch
/go/src/github.com/elastic/beats/metricbeat/module/vsphere/virtualmachine/virtualmachine.go:175
github.com/elastic/beats/v7/metricbeat/mb/module.(*metricSetWrapper).fetch
/go/src/github.com/elastic/beats/metricbeat/mb/module/wrapper.go:263
github.com/elastic/beats/v7/metricbeat/mb/module.(*metricSetWrapper).startPeriodicFetching
/go/src/github.com/elastic/beats/metricbeat/mb/module/wrapper.go:224
github.com/elastic/beats/v7/metricbeat/mb/module.(*metricSetWrapper).run
/go/src/github.com/elastic/beats/metricbeat/mb/module/wrapper.go:208
github.com/elastic/beats/v7/metricbeat/mb/module.(*Wrapper).Start.func1
/go/src/github.com/elastic/beats/metricbeat/mb/module/wrapper.go:147
These is the location of the invalid memory access (line 175):
|
if vm.Summary.Runtime.Host != nil { |
|
event["host.id"] = vm.Summary.Runtime.Host.Value |
|
} else { |
|
m.Logger().Debug("'Host', 'Runtime' or 'Summary' data not found. This is either a parsing error " + |
|
"from vsphere library, an error trying to reach host/guest or incomplete information returned " + |
|
"from host/guest") |
|
} |
|
|
|
hostSystem, err := getHostSystem(ctx, c, vm.Summary.Runtime.Host.Reference()) |
Looks to me like the access to vm.Summary.Runtime.Host.Reference should be done inside the != nil check in line 167. Alternatively the (debug) log message in 170 suggests that maybe processing should be terminated if .Host is nil.
For confirmed bugs, please report:
For some users the vSphere module is crashing randomly with:
These is the location of the invalid memory access (line 175):
beats/metricbeat/module/vsphere/virtualmachine/virtualmachine.go
Lines 167 to 175 in e3fcb7e
Looks to me like the access to
vm.Summary.Runtime.Host.Referenceshould be done inside the!= nilcheck in line 167. Alternatively the (debug) log message in 170 suggests that maybe processing should be terminated if.Hostis nil.