Skip to content

Running tests with -trace is failing for new versions of go #66

@kapillamba4

Description

@kapillamba4

Problem:
Using goleak with trace flag in earlier versions of go (go1.13.10) is working fine due to fixed issue #39.

But in recent version of go (go1.17.1) testing simple programs with trace flag is failing again. I think the stack trace has now hidden the call to runtime.goparkunlock

func Test(t *testing.T) {
	defer goleak.VerifyNone(t)
}
make test:
        [Goroutine 18 in state trace reader (blocked), with runtime.ReadTrace on top of the stack:
        goroutine 18 [trace reader (blocked)]:
        runtime.ReadTrace()
        	/usr/local/go/src/runtime/trace.go:412 +0xd2
        runtime/trace.Start.func1()
        	/usr/local/go/src/runtime/trace/trace.go:129 +0x47
        created by runtime/trace.Start
        	/usr/local/go/src/runtime/trace/trace.go:127 +0xf4

Possible Solution:
Removing this piece of code:

goleak/options.go

Lines 159 to 161 in 1e9de54

if f := s.FirstFunction(); f != "runtime.goparkunlock" {
return false
}

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