go: runtime: crash with "invalid pc-encoded table" in TSAN mode

What version of Go are you using (go version)?

go 1.11

Does this issue reproduce with the latest release?

yes

What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/users/kai.hayashi/go"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build387775402=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"

What did you do?

I am running a fairly run-of-the-mill production api server. I have observed one crash so far on this code since upgrading to go1.11 with fatal error: invalid runtime symbol table. I am running a library in this server code that periodically captures a cpu, block, and mutex profile every few minutes. The sample rates on the mutex profile is 1/10 and 1 block profile every second.

What did you expect to see?

No crashes

What did you see instead?

runtime: invalid pc-encoded table [...]
fatal error: invalid runtime symbol table
goroutine 0 [idle]:
runtime.throw(0x10501de, 0x1c)
      /usr/local/go/src/runtime/panic.go:608 +0x72 fp=0xc00064f258 sp=0xc00064f228 pc=0x42c2b2
runtime.pcvalue(0x179ed90, 0x19f6800, 0xXXXXXXXX005ea0e7, 0xaaf94c, 0xc00064f480, 0xXXXXXXXXXXXXXX01, 0xXXXXXXXX00000000)
      /usr/local/go/src/runtime/symtab.go:791 +0x50a fp=0xc00064f300 sp=0xc00064f258 pc=0x449d3a
runtime.funcspdelta(0x179ed90, 0x19f6800, 0xaaf94c, 0xc00064f480, 0xXXXXXXXX00000000)
     /usr/local/go/src/runtime/symtab.go:843 +0x5f fp=0xc00064f370 sp=0xc00064f300 pc=0x44a1ef
runtime.gentraceback(0x45d5d5, 0xc0005f3e00, 0x0, 0xc0004d1080, 0x0, 0xc00064f6d8, 0x40, 0x0, 0x0, 0x6, ...)
      /usr/local/go/src/runtime/traceback.go:208 +0x1828 fp=0xc00064f678 sp=0xc00064f370 pc=0x450ca8
runtime.sigprof(0x45d5d5, 0xc0005f3e00, 0x0, 0xc0004d1080, 0xc000244380)
      /usr/local/go/src/runtime/proc.go:3823 +0x4b6 fp=0xc00064f928 sp=0xc00064f678 pc=0x436cd6
runtime.sighandler(0xc00000001b, 0xc00064fbf0, 0xc00064fac0, 0xc0004d1080)
      /usr/local/go/src/runtime/signal_sighandler.go:38 +0x73c fp=0xc00064f9b8 sp=0xc00064f928 pc=0x440dec

This crash is reminiscent of a bug I was hoping would be fixed with the 1.11 release related to https://github.com/golang/go/issues/24925. The crashes do seem less frequent than when I was running the same code under 1.10.

CC @heschik and @rhysh

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 1
  • Comments: 42 (27 by maintainers)

Most upvoted comments

@scarbo87 I was running into this issue regularly when I had a background profiling process running periodically on a long-running process. My only fix so far has been to shift to only collecting profiles on demand or when prompted by specific anomalous events. Does not really solve the issue but significantly reduces the chance of tripping it…

For what it’s worth, the original bug report did not involve TSAN.

Indeed. I think this issue has ended up tracking something like three distinct but time-overlapping bugs with similar symptoms. (Hopefully we’ll eventually reach a state where we don’t have so many time-overlapping bugs and they’ll be easier to distinguish! 😅)

There are different failure modes, albeit all being related “invalid pc-encoded table” and profiling signals. The last two seem specific to TSAN, due to its delayed delivery of signals. The problem is that when the signal is delivered the signal context no longer matches the thread’s state, so unwinding would fail.

The earlier ones are probably related to VDSO.

Hi to everyone, I catched the same problem:

runtime: invalid pc-encoded table f=myproject/vendor/github.com/ugorji/go/codec.fastpathT.DecSliceUintN pc=0xa633f1 targetpc=0xa633f6 tab=[0/0]0x0
	value=0 until pc=0xa631d7
2019/11/06 21:58:37 2019-11-06 21:58:37.572165556 +0000 UTC 370458512998-2-23-5-404612000001-404612000001=7045535961053964897
	value=88 until pc=0xa6333f
	value=02019/11/06 21:58:37 2019-11-06 21:58:37.57217838 +0000 UTC 370458512999-2-23-18-1573077492-1573077515=7045535964200119947
 until pc=0xa63340
2019/11/06 21:58:37 2019-11-06 21:58:37.572197437 +0000 UTC 370458513000-2-23-6-405062000000-405062000000=7045536774324119978
	value=88 until pc=0xa6335f2019/11/06 21:58:37 2019-11-06 21:58:37.572208358 +0000 UTC 370458513001-2-23-18-1573077515-1573077515=7045536777470275051

	value=2019/11/06 21:58:37 2019-11-06 21:58:37.572221159 +0000 UTC CMD OK #8205492792
02019/11/06 21:58:37 2019-11-06 21:58:37.572228878 +0000 UTC EID #17236529052
 until pc=0xa63360
	value=88 until pc=0xa633d5
	value=0 until pc=0xa633d6
	value=88 until pc=0xa633df
	value=0 until pc=0xa633e0
	value=88 until pc=0xa633e7
	value=0 until pc=0xa633f1
fatal error: invalid runtime symbol table

goroutine 0 [idle]:
runtime: unexpected return pc for runtime.sigreturn called from 0x7
stack: frame={sp:0xc003263ac0, fp:0xc003263ac8} stack=[0xc00325c000,0xc003264000)
000000c0032639c0:  000000c003263bf0  000000c003263ac0 
000000c0032639d0:  000000c003224600  0000000000000000 
000000c0032639e0:  0000000000000000  0000000000000000 
000000c0032639f0:  0000000000000000  0000000000000000 
000000c003263a00:  0000000000000000  0000000000000000 
000000c003263a10:  000000c003224600  0000000000000000 
000000c003263a20:  0000000000000000  0000000000000000 
000000c003263a30:  0000000000000000  0000000000000000 
000000c003263a40:  0000000000000000  0000000000000000 
000000c003263a50:  0000000000000000  000000c003263ab0 
000000c003263a60:  000000000045eb43 <runtime.sigtramp+67>  000000000000001b 
000000c003263a70:  000000c003263bf0  000000c003263ac0 
000000c003263a80:  0000000000000000  0000000000000000 
000000c003263a90:  00000000015beb60  0000000000000002 
000000c003263aa0:  000000c003263ab0  000000c003222380 
000000c003263ab0:  000000c00321fe20  000000000045ec30 <runtime.sigreturn+0> 
000000c003263ac0: <0000000000000007 >0000000000000000 
000000c003263ad0:  000000c00325c000  0000000000000000 
000000c003263ae0:  0000000000008000  000000000000fe9b 
000000c003263af0:  000000000160cfe8  001b5ec101d087a0 
000000c003263b00:  0000000000000001  0000000000000002 
000000c003263b10:  00000000015beb60  0000000000000000 
000000c003263b20:  0000000000000000  0000000000000001 
000000c003263b30:  000000c00321fe10  000000c00321fe20 
000000c003263b40:  000000c003222380  000000001ba8148a 
000000c003263b50:  0000000000a633f6 <myproject/vendor/github.com/ugorji/go/codec.fastpathT.DecSliceUintN+566>  0000000000000018 
000000c003263b60:  000000c00321fe10  000000000045e9df <runtime.nanotime+95> 
000000c003263b70:  0000000000000246  002b000000000033 
000000c003263b80:  0000000000000000  0000000000000000 
000000c003263b90:  0000000000000000  0000000000000000 
000000c003263ba0:  000000c003263c80  0000000000000000 
000000c003263bb0:  0000000000000000  0000000000000000 
000000c003263bc0:  0000000000000000 
runtime.throw(0xe064c9, 0x1c)
	/usr/local/Cellar/go/1.12.7/libexec/src/runtime/panic.go:617 +0x72
runtime.pcvalue(0x145d770, 0x15beb60, 0x4d4daf, 0xa633f6, 0xc0032634d0, 0xff8b01, 0x0)
	/usr/local/Cellar/go/1.12.7/libexec/src/runtime/symtab.go:704 +0x53f
runtime.funcspdelta(0x145d770, 0x15beb60, 0xa633f6, 0xc0032634d0, 0xc000000000)
	/usr/local/Cellar/go/1.12.7/libexec/src/runtime/symtab.go:756 +0x5f
runtime.gentraceback(0x45e9df, 0xc00321fe10, 0x0, 0xc003224600, 0x0, 0xc003263728, 0x40, 0x0, 0x0, 0x6, ...)
	/usr/local/Cellar/go/1.12.7/libexec/src/runtime/traceback.go:222 +0x1888
runtime.sigprof(0x45e9df, 0xc00321fe10, 0x0, 0xc003224600, 0xc003222380)
	/usr/local/Cellar/go/1.12.7/libexec/src/runtime/proc.go:3754 +0x432
runtime.sighandler(0xc00000001b, 0xc003263bf0, 0xc003263ac0, 0xc003224600)
	/usr/local/Cellar/go/1.12.7/libexec/src/runtime/signal_sighandler.go:38 +0x723
runtime.sigtrampgo(0x1b, 0xc003263bf0, 0xc003263ac0)
	/usr/local/Cellar/go/1.12.7/libexec/src/runtime/signal_unix.go:351 +0x1f2
runtime.sigtramp(0x7, 0x0, 0xc00325c000, 0x0, 0x8000, 0xfe9b, 0x160cfe8, 0x1b5ec101d087a0, 0x1, 0x2, ...)
	/usr/local/Cellar/go/1.12.7/libexec/src/runtime/sys_linux_amd64.s:357 +0x43
runtime: unexpected return pc for runtime.sigreturn called from 0x7
stack: frame={sp:0xc003263ac0, fp:0xc003263ac8} stack=[0xc00325c000,0xc003264000)
000000c0032639c0:  000000c003263bf0  000000c003263ac0 
000000c0032639d0:  000000c003224600  0000000000000000 
000000c0032639e0:  0000000000000000  0000000000000000 
000000c0032639f0:  0000000000000000  0000000000000000 
000000c003263a00:  0000000000000000  0000000000000000 
000000c003263a10:  000000c003224600  0000000000000000 
000000c003263a20:  0000000000000000  0000000000000000 
000000c003263a30:  0000000000000000  0000000000000000 
000000c003263a40:  0000000000000000  0000000000000000 
000000c003263a50:  0000000000000000  000000c003263ab0 
000000c003263a60:  000000000045eb43 <runtime.sigtramp+67>  000000000000001b 
000000c003263a70:  000000c003263bf0  000000c003263ac0 
000000c003263a80:  0000000000000000  0000000000000000 
000000c003263a90:  00000000015beb60  0000000000000002 
000000c003263aa0:  000000c003263ab0  000000c003222380 
000000c003263ab0:  000000c00321fe20  000000000045ec30 <runtime.sigreturn+0> 
000000c003263ac0: <0000000000000007 >0000000000000000 
000000c003263ad0:  000000c00325c000  0000000000000000 
000000c003263ae0:  0000000000008000  000000000000fe9b 
000000c003263af0:  000000000160cfe8  001b5ec101d087a0 
000000c003263b00:  0000000000000001  0000000000000002 
000000c003263b10:  00000000015beb60  0000000000000000 
000000c003263b20:  0000000000000000  0000000000000001 
000000c003263b30:  000000c00321fe10  000000c00321fe20 
000000c003263b40:  000000c003222380  000000001ba8148a 
000000c003263b50:  0000000000a633f6 <myproject/vendor/github.com/ugorji/go/codec.fastpathT.DecSliceUintN+566>  0000000000000018 
000000c003263b60:  000000c00321fe10  000000000045e9df <runtime.nanotime+95> 
000000c003263b70:  0000000000000246  002b000000000033 
000000c003263b80:  0000000000000000  0000000000000000 
000000c003263b90:  0000000000000000  0000000000000000 
000000c003263ba0:  000000c003263c80  0000000000000000 
000000c003263bb0:  0000000000000000  0000000000000000 
000000c003263bc0:  0000000000000000 
runtime.sigreturn(0x0, 0xc00325c000, 0x0, 0x8000, 0xfe9b, 0x160cfe8, 0x1b5ec101d087a0, 0x1, 0x2, 0x15beb60, ...)
	/usr/local/Cellar/go/1.12.7/libexec/src/runtime/sys_linux_amd64.s:449

I used go 1.12.7 version What should i do?