Skip to content

[envtest] Deferred cleanup panic on nil ETCD process state #3271

@Danil-Grigorev

Description

@Danil-Grigorev
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0xd8 pc=0x562ec6147b07]

goroutine 17 [running, locked to thread]:
sigs.k8s.io/controller-runtime/pkg/internal/testing/controlplane.(*Etcd).Stop(...)
	/home/runner/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.21.0/pkg/internal/testing/controlplane/etcd.go:162
sigs.k8s.io/controller-runtime/pkg/internal/testing/controlplane.(*ControlPlane).Stop(0xc00160b348?)
	/home/runner/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.21.0/pkg/internal/testing/controlplane/plane.go:103 +0xe7
sigs.k8s.io/controller-runtime/pkg/envtest.(*Environment).Stop(0xc00160b348)
	/home/runner/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.21.0/pkg/envtest/server.go:211 +0x105
main.Envtest.create.func2(0xc000599610?)

It appears the ETCD cleanup is missing nil check, similar to

resulting in envtest.Stop() to panic occasionally if the cleanup is performed on setup failure.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions