Skip to content

Metricbeat vsphere/virtualmachine crash #18996

Closed
@adriansr

Description

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.

Metadata

Assignees

Labels

MetricbeatMetricbeatTeam:IntegrationsLabel for the Integrations teambughelp wantedIndicates that a maintainer wants help on an issue or pull request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions