-
Notifications
You must be signed in to change notification settings - Fork 17.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
runtime/traceback: segmentation violation failures from unwinding crash #64030
Comments
I feel like Line 463 in 883f062
If this issue is related to the new unwinder you could try go 1.20.10 that does not have it. Would be helpful to get some more insights on what your program does with cgo, to try and reproduce the issue. /cc @golang/runtime |
I agree it would be interesting to know if the same crashes occur with the old unwinder. Thanks @mauri870. Also, if you have a core dump, could you report what the values are of everything in |
Interesting. In both cases it is scanning a goroutine stack. If |
Corresponding backtrace (different core dump than the initial report):
|
The CGo usage is via the wrappers in this repository, (e.g.). Unfortunately, we don't have a reduced example yet. We are currently testing the downgrade to 1.20.10 to see if that helps. |
I encountered the exact same stack on go1.21.3 linux/amd64. I rolled back to go1.20.11 and got a similar segfault. |
Also see #64781 |
Is this still happening, with more recent version of Go? If so, could you share more information about the program, like, what stack does it scanning? Could you include a full crash log if possible? Thanks. |
@cherrymui PANIC 2024-06-19T17:08:59.101284384Z SIGSEGV: segmentation violation
2024-06-19T17:08:59.101305416Z PC=0x468865 m=5 sigcode=1 addr=0x118
2024-06-19T17:08:59.101308921Z
2024-06-19T17:08:59.101313011Z goroutine 0 gp=0xc000103180 m=5 mp=0xc000100808 [idle]:
2024-06-19T17:08:59.101316543Z runtime.(*unwinder).next(0xc000157d28)
2024-06-19T17:08:59.101320330Z /usr/local/go/src/runtime/traceback.go:457 +0x105 fp=0xc000157ce8 sp=0xc000157c70 pc=0x468865
2024-06-19T17:08:59.101323626Z runtime.scanstack(0xc001225c00, 0xc000072168)
2024-06-19T17:08:59.101326778Z /usr/local/go/src/runtime/mgcmark.go:899 +0x271 fp=0xc000157e18 sp=0xc000157ce8 pc=0x423ed1
2024-06-19T17:08:59.101330416Z runtime.markroot.func1()
2024-06-19T17:08:59.101333574Z /usr/local/go/src/runtime/mgcmark.go:241 +0xb5 fp=0xc000157e68 sp=0xc000157e18 pc=0x422b95
2024-06-19T17:08:59.101336817Z runtime.markroot(0xc000072168, 0x3d6, 0x1)
2024-06-19T17:08:59.101340034Z /usr/local/go/src/runtime/mgcmark.go:215 +0x1a8 fp=0xc000157f10 sp=0xc000157e68 pc=0x422828
2024-06-19T17:08:59.101343201Z runtime.gcDrain(0xc000072168, 0x7)
2024-06-19T17:08:59.101346283Z /usr/local/go/src/runtime/mgcmark.go:1200 +0x3d4 fp=0xc000157f78 sp=0xc000157f10 pc=0x4249f4
2024-06-19T17:08:59.101349526Z runtime.gcDrainMarkWorkerIdle(...)
2024-06-19T17:08:59.101352636Z /usr/local/go/src/runtime/mgcmark.go:1114
2024-06-19T17:08:59.101355693Z runtime.gcBgMarkWorker.func2()
2024-06-19T17:08:59.101358906Z /usr/local/go/src/runtime/mgc.go:1406 +0x6f fp=0xc000157fc8 sp=0xc000157f78 pc=0x420e4f
2024-06-19T17:08:59.101362075Z runtime.systemstack(0x0)
2024-06-19T17:08:59.101365136Z /usr/local/go/src/runtime/asm_amd64.s:509 +0x4a fp=0xc000157fd8 sp=0xc000157fc8 pc=0x475e8a BT (dlv) bt
0 0x0000000000468865 in runtime.(*unwinder).next
at /snap/go/10630/src/runtime/traceback.go:513
1 0x000000000046a145 in runtime.guintptr.ptr
at /snap/go/10630/src/runtime/runtime2.go:266
2 0x000000000046a145 in runtime.traceback2
at /snap/go/10630/src/runtime/traceback.go:978
3 0x0000000000469ee6 in runtime.traceback1.func1
at /snap/go/10630/src/runtime/traceback.go:914
4 0x0000000000469d4f in runtime.traceback1
at /snap/go/10630/src/runtime/traceback.go:914
5 0x000000000046b7c5 in runtime.tracebackothers.func1
at /snap/go/10630/src/runtime/traceback.go:1255
6 0x0000000000440ea9 in runtime.forEachGRace
at /snap/go/10630/src/runtime/proc.go:673
7 0x00000000000003b2 in ???
at ?:-1
8 0x000000000046b6bb in runtime.tracebackothers
at /snap/go/10630/src/runtime/traceback.go:1245
9 0x00000000004556a5 in runtime.sighandler
at /snap/go/10630/src/runtime/signal_unix.go:743
10 0x0000000000454e4e in runtime.sigtrampgo
at /snap/go/10630/src/runtime/signal_unix.go:482
11 0x0000000000468865 in runtime.(*unwinder).next
at /snap/go/10630/src/runtime/traceback.go:512
12 0x0000000000423ed1 in runtime.scanstack
at /snap/go/10630/src/runtime/mgcmark.go:839
13 0x0000000000422b95 in runtime.casGToWaiting
at /snap/go/10630/src/runtime/proc.go:1207
Sending output to pager...
0 0x0000000000468865 in runtime.(*unwinder).next
at /snap/go/10630/src/runtime/traceback.go:513
1 0x000000000046a145 in runtime.guintptr.ptr
at /snap/go/10630/src/runtime/runtime2.go:266
2 0x000000000046a145 in runtime.traceback2
at /snap/go/10630/src/runtime/traceback.go:978
3 0x0000000000469ee6 in runtime.traceback1.func1
at /snap/go/10630/src/runtime/traceback.go:914
4 0x0000000000469d4f in runtime.traceback1
at /snap/go/10630/src/runtime/traceback.go:914
5 0x000000000046b7c5 in runtime.tracebackothers.func1
at /snap/go/10630/src/runtime/traceback.go:1255
6 0x0000000000440ea9 in runtime.forEachGRace
at /snap/go/10630/src/runtime/proc.go:673
7 0x00000000000003b2 in ???
at ?:-1
8 0x000000000046b6bb in runtime.tracebackothers
at /snap/go/10630/src/runtime/traceback.go:1245
9 0x00000000004556a5 in runtime.sighandler
at /snap/go/10630/src/runtime/signal_unix.go:743
10 0x0000000000454e4e in runtime.sigtrampgo
at /snap/go/10630/src/runtime/signal_unix.go:482
11 0x0000000000468865 in runtime.(*unwinder).next
at /snap/go/10630/src/runtime/traceback.go:512
12 0x0000000000423ed1 in runtime.scanstack
at /snap/go/10630/src/runtime/mgcmark.go:839
13 0x0000000000422b95 in runtime.casGToWaiting
at /snap/go/10630/src/runtime/proc.go:1207
14 0x0000000000422b95 in runtime.markroot.func1
at /snap/go/10630/src/runtime/mgcmark.go:223
15 0x0000000000422828 in runtime.markroot
at /snap/go/10630/src/runtime/mgcmark.go:215
16 0x00000000004249f4 in runtime.gcDrain
at /snap/go/10630/src/runtime/mgcmark.go:1195
17 0x0000000000420e4f in runtime.casGToWaiting
at /snap/go/10630/src/runtime/proc.go:1207
18 0x0000000000420e4f in runtime.gcBgMarkWorker.func2
at /snap/go/10630/src/runtime/mgc.go:1382
19 0x0000000000475e8a in runtime.systemstack
at /snap/go/10630/src/runtime/asm_amd64.s:509
20 0x0000000000475e28 in runtime.systemstack_switch
at /snap/go/10630/src/runtime/asm_amd64.s:474
21 0x0000000000420b12 in runtime.nanotime
at /snap/go/10630/src/runtime/time_nofake.go:19
22 0x0000000000420b12 in runtime.gcBgMarkWorker
at /snap/go/10630/src/runtime/mgc.go:1357
23 0x0000000000477cc1 in runtime.goexit
at /snap/go/10630/src/runtime/asm_amd64.s:1695 P U (dlv) p u
(*runtime.unwinder)(0xc00014ef90)
*runtime.unwinder {
frame: runtime.stkframe {
fn: (*runtime.funcInfo)(0xc00014ef90),
pc: 4457134,
continpc: 4457134,
lr: 2164653622083375972,
sp: 824713172096,
fp: 824713172128,
varp: 824713172112,
argp: 824713172128,},
g: 824652749824,
cgoCtxt: -1,
calleeFuncID: FuncIDNormal (0),
flags: unwindPrintErrors (1),} LIST > runtime.(*unwinder).next() /snap/go/10630/src/runtime/traceback.go:513 (PC: 0x468865)
Warning: debugging optimized function
508: frame.lr = x
509: }
510: }
511:
512: u.resolveInternal(false, false)
=> 513: }
514:
515: // finishInternal is an unwinder-internal helper called after the stack has been
516: // exhausted. It sets the unwinder to an invalid state and checks that it
517: // successfully unwound the entire stack.
518: func (u *unwinder) finishInternal() { |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
We build a Go application which also include some CGO requests and very frequently we see
SIGSEGV: segmentation violation
errors produced by an unwinding crash. Unfortunately, we are not able to reproduce the crash but the crashes occurred often without executing any specific request to produce this error. The crashes are happening frequently (more than 100 on a single day). We have checked the core dumps produced, but nothing there to indicate what causes the issue. Also, from core dumps, we see that there are no CGO requests during the time of the crash.We see the following stacktrace
We also downgrade golang version to
go1.21.0 linux/amd64
, but we see the same behaviour (same crashes), with a bit different stacktrace now.What did you expect to see?
No crashes
What did you see instead?
segmentation violation errors
The text was updated successfully, but these errors were encountered: