堆栈跟踪中指定的时间是什么意思?

huangapple go评论96阅读模式
英文:

What does time specified in a stack trace mean?

问题

我正在阅读用于调试的Go程序的堆栈跟踪。

goroutine 6 [chan receive]:
go.elastic.co/apm.(*Tracer).loop.func2(0xc000042420, 0xc0000423c0, 0x1551980, 0xc0004da100, 0xc000074300, 0xc000001080, 0xc00000e018)
/app/vendor/go.elastic.co/apm/tracer.go:803 +0x21a
created by go.elastic.co/apm.(*Tracer).loop
/app/vendor/go.elastic.co/apm/tracer.go:800 +0x36e

goroutine 8 [chan receive, 21 minutes]:
github.com/getsentry/sentry-go.(*HTTPTransport).worker(0xc0003025b0)
/app/vendor/github.com/getsentry/sentry-go/transport.go:387 +0x77
created by github.com/getsentry/sentry-go.(*HTTPTransport).Configure.func1
/app/vendor/github.com/getsentry/sentry-go/transport.go:255 +0x3e

第二个goroutine中的时间"21 minutes"表示什么?在第一个goroutine中没有这个时间。我在文档中查找了一下,但没有找到这个时间的含义。

英文:

I'm reading stack trace of a go program for debugging.

goroutine 6 [chan receive]:
go.elastic.co/apm.(*Tracer).loop.func2(0xc000042420, 0xc0000423c0, 0x1551980, 0xc0004da100, 0xc000074300, 0xc000001080, 0xc00000e018)
	/app/vendor/go.elastic.co/apm/tracer.go:803 +0x21a
created by go.elastic.co/apm.(*Tracer).loop
	/app/vendor/go.elastic.co/apm/tracer.go:800 +0x36e

goroutine 8 [chan receive, 21 minutes]:
github.com/getsentry/sentry-go.(*HTTPTransport).worker(0xc0003025b0)
	/app/vendor/github.com/getsentry/sentry-go/transport.go:387 +0x77
created by github.com/getsentry/sentry-go.(*HTTPTransport).Configure.func1
	/app/vendor/github.com/getsentry/sentry-go/transport.go:255 +0x3e

What does the time 21 minutes signify in the second go routine? This time is absent from the first one. I looked up in the documentation but couldn't find what this time is for.

答案1

得分: 5

这是 goroutine 被阻塞的大致时间。只有当 goroutine 被阻塞的时间至少为1分钟时,才会显示该信息。

你可以查看生成这个输出的代码,位于 Go 运行时源码的 runtime/traceback.go 文件中(链接是 go1.16.6 版本的代码)。

英文:

It's the approximate amount of time the goroutine was blocked. It is only displayed if the amount of time the goroutine was blocked is at least 1 minute.

You can look at the code that produces this output in the go runtime source, runtime/traceback.go (linked is the go1.16.6 version of the code).

huangapple
  • 本文由 发表于 2021年7月30日 15:20:36
  • 转载请务必保留本文链接:https://go.coder-hub.com/68586928.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定