Skip to content

Gleak: support goroutines that have brackets in the string due to generics in IgnoreTopFunction #850

@sheidkamp

Description

@sheidkamp

I have a goroutine with a stack that is reported by gleak as:

      goroutine 1713 [select]
          istio.io/istio/pkg/kube/krt.(*processorListener[...]).run(0x109b4c820) at krt/processor.go:171
          k8s.io/apimachinery/pkg/util/wait.(*Group).Start.func1() at wait/wait.go:72
          created by k8s.io/apimachinery/pkg/util/wait.(*Group).Start in goroutine 1781 at wait/wait.go:70

I would like to be able to match this exactly with IgnoreTopFunction and include state (like gleak.IgnoringTopFunction("istio.io/istio/pkg/kube/krt.(*processorListener[...]).run [select]")) , but am not currently able to do that because of how the topfname string is parsed.

It should also be able to handle prefix matching, like gleak.IgnoringTopFunction("istio.io/istio/pkg/kube/krt.(*processorListener[...])") as well

Proposed solution:
IgnoreTopFunction can look at the last index of [ instead of the first, and validate that the last index of ] is at the end of string before setting the expectedState field.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions