Please answer these questions before submitting a bug report.
What version of OpenCensus are you using?
v0.22.5
What version of Go are you using?
1.13.15
What did you do?
import (
"go.opencensus.io/trace"
_ "go.opencensus.io/zpages" // internal.LocalSpanStoreEnabled = true
)
type SpanTest struct {
Ctx context.Context
Count int
}
func (s *SpanTest) Inc() {
span := trace.StartSpan(s.Ctx, "test")
defer span.End()
}
func main() {
test := &SpanTest{
Ctx: context.Background(),
}
go func() {
for {
test.Inc()
}
}()
for {}
}
it make memory usage gradually increasing.
and i have found the problem:
opencensus-go/trace/trace.go line:269 ss.add(NewSpan(s))
opencensus-go/trace/trace.go line:294 s.spanStore.finished(NewSpan(s), sd)
when add a new span to the spanStore active set. it wrote a wrong way to release the active set, it shouldn't use NewSpan() to wrap the *span and pass to the finished function
Please answer these questions before submitting a bug report.
What version of OpenCensus are you using?
v0.22.5
What version of Go are you using?
1.13.15
What did you do?
it make memory usage gradually increasing. and i have found the problem: opencensus-go/trace/trace.go line:269 ss.add(NewSpan(s)) opencensus-go/trace/trace.go line:294 s.spanStore.finished(NewSpan(s), sd) when add a new span to the spanStore active set. it wrote a wrong way to release the active set, it shouldn't use NewSpan() to wrap the *span and pass to the finished function