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

golang (1.10) NewStacktrace yields a trace that service considers invalid. #186

Open
toshok opened this issue Apr 28, 2018 · 3 comments
Open

Comments

@toshok
Copy link

toshok commented Apr 28, 2018

we're running 1cc47a9 (although I don't see any changes that might fix it in the commits after), and we see quite a few errors like:

image

after expanding all stack frames and scanning, the reason is pretty clear:

{
abs_path: ...,
filename: ...,
function: ...,
in_app: ...,
lineno: ...,
module: ...,
}, 
{
in_app: False
}, 
{
abs_path: ...,
filename: ...,
function: ...,
in_app: ...,
lineno: ...,
module: ...,
}, 

That middle frame is missing Function/Filename/Module. We aren't doing anything interesting with the call to NewStacktrace:

        // skip = 1, context = 3, prefixes = []string{"github.com/honeycombio"}
	trace := raven.NewStacktrace(skip, context, prefixes)

running a loop over the StacktraceFrames to remove those problematic frames fixes everything, but probably shouldn't be adding them in the first place.

@mattrobenolt
Copy link
Contributor

Interesting, do you know how those frames are possibly generated?

@toshok
Copy link
Author

toshok commented Apr 28, 2018

it'll take a bit to get things set up again, but reading in the golang runtime package yielded this (when talking about runtime.Callers, but I expect it to apply to the pc's returned by runtime.Caller as well):

// To translate these PCs into symbolic information such as function
// names and line numbers, use CallersFrames. CallersFrames accounts
// for inlined functions and adjusts the return program counters into
// call program counters. Iterating over the returned slice of PCs
// directly is discouraged, as is using FuncForPC on any of the
// returned PCs, since these cannot account for inlining or return
// program counter adjustment.

@toshok
Copy link
Author

toshok commented Apr 28, 2018

haven't tested it yet outside our service, but I have a patch that seems to fix things. Will open a PR.

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

2 participants