Skip to content
This repository has been archived by the owner on Jul 31, 2023. It is now read-only.

Panic in span End() when created with NewSpan #717

Closed
delthas opened this issue Apr 19, 2018 · 6 comments
Closed

Panic in span End() when created with NewSpan #717

delthas opened this issue Apr 19, 2018 · 6 comments
Assignees

Comments

@delthas
Copy link

delthas commented Apr 19, 2018

When creating a span using the now deprecated NewSpan function, calling End() on it panics. Panic trace:

panic: runtime error: invalid memory address or nil pointer dereference [recovered]
	panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x9ebf4e]

goroutine 39 [running]:
testing.tRunner.func1(0xc42017e3c0)
	/usr/local/go/src/testing/testing.go:742 +0x454
panic(0xfd56e0, 0x164dfc0)
	/usr/local/go/src/runtime/panic.go:505 +0x24a
go.opencensus.io/trace.(*Span).End.func1()
	[XXX]/go.opencensus.io/trace/trace.go:269 +0x3e
sync.(*Once).Do(0xc42051b208, 0xc4204b4c90)
	/usr/local/go/src/sync/once.go:44 +0xd2
go.opencensus.io/trace.(*Span).End(0xc42051b1d0)
	[XXX]/go/src/go.opencensus.io/trace/trace.go:268 +0xa0

The simplest way to fix this is probably to replace s.executionTracerSpanEnd() by if s.executionTracerSpanEnd != nil { s.executionTracerSpanEnd() }.

This is a serious bug caused by #715 .

@odeke-em
Copy link
Member

/cc @rakyll @Ramonza

@rakyll rakyll self-assigned this Apr 20, 2018
rakyll added a commit to rakyll/opencensus-go that referenced this issue Apr 20, 2018
For spans created with NewSpanXXX, we cannot
create execution tracer tasks. Don't try to end
if none is created.

Fixes census-instrumentation#717.
rakyll added a commit that referenced this issue Apr 20, 2018
For spans created with NewSpanXXX, we cannot
create execution tracer tasks. Don't try to end
if none is created.

Fixes #717.
@odeke-em
Copy link
Member

Thank you for reporting this @delthas and welcome to OpenCensus!

@rakyll just fixed this bug, please get the latest from master.

@delthas
Copy link
Author

delthas commented Apr 22, 2018

Thanks. I would have done the PR myself but signing the Contributor License Agreement is quite a hassle.

I'm using this library in production, is there a way I can freeze the version of this library to avoid my infrastructure going down because of panics introduced in the code?

@odeke-em
Copy link
Member

@delthas not a problem, thank you for reporting it and for using OpenCensus!

Awesome, that's great to know. So in order to freeze a version, perhaps you can use a package management tool, as per https://github.com/golang/go/wiki/PackageManagementTools?

Also it would be great to keep in touch with companies/individuals using OpenCensus in production, if you are comfortable doing so, please send me an email at [email protected] telling me how you are using it and in the future, we'll compile a list and post it publicly on the wiki here perhaps or somewhere.

@odeke-em
Copy link
Member

PS: for clarity, I asked for an email because I haven't yet discussed with the OpenCensus team on how to liase with companies using OpenCensus i.e. publicly via wiki? Specialized contact? I didn't want to make a wiki suggestion without first discussing with the team on liason policy
/cc @bogdandrutu

@rakyll
Copy link
Contributor

rakyll commented Apr 23, 2018

@delthas, you should pin to a specific release version at https://github.com/census-instrumentation/opencensus-go/releases and have reproducible builds by using a dependency management tool such as dep (https://github.com/golang/dep).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants