go/src/runtime/runtime2.go
第211行到第215行:
| | |
| | funcefaceOf(ep*interface{}) *eface { |
| | return (*eface)(unsafe.Pointer(ep)) |
| | } |
| | |
为什么这个函数没有`//go:nosplit`?
go/src/runtime/proc.go
第446行到第449行:
```go
| | //go:nosplit |
| | funcfuncPC(finterface{}) uintptr { |
| | return*(*uintptr)(efaceOf(&f).data) |
| | } |
当设置信号调用`funcPC`时,会出现panic!
fatal error: stack growth after fork
runtime stack:
runtime.throw(0x8afa736, 0x17)
/usr/local/go/src/runtime/panic.go:1117 +0x6a
runtime.newstack()
/usr/local/go/src/runtime/stack.go:942 +0xc58
runtime.morestack()
/usr/local/go/src/runtime/asm_386.s:471 +0x7f
goroutine 50 [running, locked to thread]:
runtime.efaceOf(0xaa23554, 0xa51c72c0)
/usr/local/go/src/runtime/runtime2.go:213 +0x20 fp=0xaa23548 sp=0xaa23544 pc=0x8091a20
runtime.funcPC(0x89fea00, 0x8b2e9dc, 0x0)
/usr/local/go/src/runtime/proc.go:448 +0xf fp=0xaa23554 sp=0xaa23548 pc=0x808322f
runtime.setsig(0x1, 0x0)
/usr/local/go/src/runtime/os_linux.go:427 +0x3a fp=0xaa23578 sp=0xaa23554 pc=0x807d13a
runtime.clearSignalHandlers()
/usr/local/go/src/runtime/signal_unix.go:259 +0x44 fp=0xaa23588 sp=0xaa23578 pc=0x80950d4
syscall.runtime_AfterForkInChild()
/usr/local/go/src/runtime/proc.go:3951 +0xf fp=0xaa2359c sp=0xaa23588 pc=0x80ae48f
syscall.forkAndExecInChild1(0xaa26730, 0xaa10168, 0x5, 0x5, 0xaa341c0, 0x1a, 0x1a, 0x0, 0x0, 0xaa23a28, ...)
/usr/local/go/src/syscall/exec_linux.go:240 +0x6e0 fp=0xaa23794 sp=0xaa2359c pc=0x80c0640
syscall.forkAndExecInChild(0xaa26730, 0xaa10168, 0x5, 0x5, 0xaa341c0, 0x1a, 0x1a, 0x0, 0x0, 0xaa23a28, ...)
/usr/local/go/src/syscall/exec_linux.go:83 +0xf8 fp=0xaa23830 sp=0xaa23794 pc=0x80bfcd8
syscall.forkExec(0xa89e190, 0x45, 0xaa4a1c0, 0x4, 0x4, 0xaa23a28, 0x0, 0x0, 0x0)
/usr/local/go/src/syscall/exec_unix.go:211 +0x791 fp=0xaa23930 sp=0xaa23830 pc=0x80c3ad1
syscall.StartProcess(0xa89e190, 0x45, 0xaa4a1c0, 0x4, 0x4, 0xaa23a28, 0x0, 0x0, 0x0, 0x0)
/usr/local/go/src/syscall/exec_unix.go:263 +0x7d fp=0xaa23964 sp=0xaa23930 pc=0x80c3efd
os.startProcess(0xa89e190, 0x45, 0xaa4a1c0, 0x4, 0x4, 0xaa28600, 0x0, 0x0, 0x0)
/usr/local/go/src/os/exec_posix.go:53 +0x432 fp=0xaa23a50 sp=0xaa23964 pc=0x815ad42
os.StartProcess(0xa89e190, 0x45, 0xaa4a1c0, 0x4, 0x4, 0xaa28600, 0x0, 0x0, 0x0)
/usr/local/go/src/os/exec.go:106 +0x91 fp=0xaa23a90 sp=0xaa23a50 pc=0x815a4d1
...
...
3条答案
按热度按时间emeijp431#
https://golang.org/cl/356109提到了这个问题:
runtime: add missing //go:nosplit for efaceOf
ntjbwcob2#
你正在使用哪个版本的Go?
setsig
似乎目前无法通过funcPC
调用(在1.17中被新的内建函数https://cs.opensource.google/go/go/+/master:src/runtime/os_linux.go;l=445;drc=master;bpv=1;bpt=1取代)。我们或许应该回溯这个功能?vfork期间的栈增长听起来相当糟糕。
qyuhtwio3#
我正在使用go1.17.2,并在1.16.9上进行了测试。
是的,我们应该回溯这个补丁,主分支不需要这个补丁。