You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Command used to build: CGO_CFLAGS="-g" go build -gcflags=all="-N -l"
ulimit -c unlimited
echo "core" > /proc/sys/kernel/core_pattern
export GOTRACEBACK=crash
When the complied go program is run, core file is getting generated because of calling panic(). The following code is line is causing the system stack corruption. Because of this, I am not seeing the complete stack trace.
326 func unwindm(restore *bool) {
327 if *restore {
328 // Restore sp saved by cgocallback during
329 // unwind of g's stack (see comment at top of file).
330 mp := acquirem()
331 sched := &mp.g0.sched
332 sched.sp = *(*uintptr)(unsafe.Pointer(sched.sp + alignUp(sys.MinFrameSize, sys.StackAlign)))
What did you expect to see?
0 0x0000000000460ea1 in runtime.raise
at /home/soomohan/mbalraj/GO/go1202/go/src/runtime/sys_linux_amd64.s:154
1 0x0000000000449845 in runtime.dieFromSignal
at /home/soomohan/mbalraj/GO/go1202/go/src/runtime/signal_unix.go:879
2 0x0000000000449e25 in runtime.sigfwdgo
at /home/soomohan/mbalraj/GO/go1202/go/src/runtime/signal_unix.go:1092
3 0x00000000004487a7 in runtime.sigtrampgo
at /home/soomohan/mbalraj/GO/go1202/go/src/runtime/signal_unix.go:432
4 0x0000000000461186 in runtime.sigtramp
at /home/soomohan/mbalraj/GO/go1202/go/src/runtime/sys_linux_amd64.s:354
5 0x00007f686b787520 in ???
at ?:-1
6 0x0000000000449a58 in runtime.crash
at /home/soomohan/mbalraj/GO/go1202/go/src/runtime/signal_unix.go:971
7 0x0000000000434d85 in runtime.fatalpanic
at /home/soomohan/mbalraj/GO/go1202/go/src/runtime/panic.go:1168
8 0x00000000004344cc in runtime.gopanic
at /home/soomohan/mbalraj/GO/go1202/go/src/runtime/panic.go:987
9 0x00000000004642a7 in main.Test4
at ./export.go:8
10 0x000000000046431c in _cgoexp_209e16473f08_Test4
at _cgo_gotypes.go:61
11 0x000000000040535b in runtime.cgocallbackg1
at /home/soomohan/mbalraj/GO/go1202/go/src/runtime/cgocall.go:315
12 0x0000000000405079 in runtime.cgocallbackg
at /home/soomohan/mbalraj/GO/go1202/go/src/runtime/cgocall.go:234
13 0x0000000000461b0f in runtime.cgocallbackg
at :1
14 0x000000000045f3d4 in runtime.cgocallback
at /home/soomohan/mbalraj/GO/go1202/go/src/runtime/asm_amd64.s:998
15 0x00000000004641bd in crosscall2
15 0x00000000004641bd in crosscall2
at /home/soomohan/mbalraj/GO/go1202/go/src/runtime/cgo/asm_amd64.s:30
16 0x0000000000464386 in C.Test4
at /tmp/go-build/_cgo_export.c:33
17 0x0000000000464432 in C.test1
at ./hello.go:10
18 0x000000000046444d in C.test2
at ./hello.go:15
19 0x0000000000464468 in C.test3
at ./hello.go:20
20 0x00000000004644a7 in C._cgo_209e16473f08_Cfunc_test3
at /tmp/go-build/cgo-gcc-prolog:49
21 0x000000000045f2c4 in runtime.asmcgocall
at /home/soomohan/mbalraj/GO/go1202/go/src/runtime/asm_amd64.s:848
22 0x000000000046448a in C._cgo_209e16473f08_Cfunc_test3
at /tmp/go-build/cgo-gcc-prolog:44
23 0x0000000000404f0a in runtime.cgocall
at /home/soomohan/mbalraj/GO/go1202/go/src/runtime/cgocall.go:167
24 0x0000000000464245 in main._Cfunc_test3
at _cgo_gotypes.go:39
25 0x00000000004642d7 in main.main
at ./hello.go:34
26 0x0000000000437053 in runtime.main
at /home/soomohan/mbalraj/GO/go1202/go/src/runtime/proc.go:250
27 0x000000000045f5c1 in runtime.goexit
at /home/soomohan/mbalraj/GO/go1202/go/src/runtime/asm_amd64.s:1598
What did you see instead?
0 0x0000000000460ec1 in runtime.raise
at /home/soomohan/mbalraj/GO/go1.20.3/go/src/runtime/sys_linux_amd64.s:154
1 0x0000000000449865 in runtime.dieFromSignal
at /home/soomohan/mbalraj/GO/go1.20.3/go/src/runtime/signal_unix.go:879
2 0x0000000000449e45 in runtime.sigfwdgo
at /home/soomohan/mbalraj/GO/go1.20.3/go/src/runtime/signal_unix.go:1092
3 0x00000000004487c7 in runtime.sigtrampgo
at /home/soomohan/mbalraj/GO/go1.20.3/go/src/runtime/signal_unix.go:432
4 0x00000000004611a6 in runtime.sigtramp
at /home/soomohan/mbalraj/GO/go1.20.3/go/src/runtime/sys_linux_amd64.s:354
5 0x00007ff08b3ae520 in ???
at ?:-1
6 0x0000000000449a78 in runtime.crash
at /home/soomohan/mbalraj/GO/go1.20.3/go/src/runtime/signal_unix.go:971
7 0x0000000000434da5 in runtime.fatalpanic
at /home/soomohan/mbalraj/GO/go1.20.3/go/src/runtime/panic.go:1168
8 0x00000000004344ec in runtime.gopanic
at /home/soomohan/mbalraj/GO/go1.20.3/go/src/runtime/panic.go:987
9 0x00000000004642c7 in main.Test4
at ./export.go:8
10 0x000000000046433c in _cgoexp_209e16473f08_Test4
at _cgo_gotypes.go:61
11 0x000000000040535b in runtime.cgocallbackg1
at /home/soomohan/mbalraj/GO/go1.20.3/go/src/runtime/cgocall.go:315
12 0x0000000000405079 in runtime.cgocallbackg
at /home/soomohan/mbalraj/GO/go1.20.3/go/src/runtime/cgocall.go:234
13 0x0000000000461b2f in runtime.cgocallbackg
at :1
14 0x000000000045f3f4 in runtime.cgocallback
at /home/soomohan/mbalraj/GO/go1.20.3/go/src/runtime/asm_amd64.s:998
15 0x0000000000000001 in ???
15 0x0000000000000001 in ???
at ?:-1
16 0x000000c00003e000 in ???
at ?:-1
error: error while reading spliced memory at 0x8: EOF
(truncated)
The text was updated successfully, but these errors were encountered:
As you already have extensive discussions about stack unwinding with stack switches in #57698, and as you see that it is a difficult task, I don't think it is necessary to have a separate issue. Although there is a difference in detail in this case, it is probably still better to have the discussion in one place. Thanks.
Hi Cherrymui,
Thanks. It is ok for me to close, if the issues can be considered as part
of one issue. Can we think of something innovative to fix all these issues?
You can think of providing an API to disable calling defer code in case of
panic. So that the stack unwinding will not happen. The stack trace will
look good.
Best Regards
Mariappan
On Mon, Apr 10, 2023 at 9:35 PM cherrymui ***@***.***> wrote:
As you already have extensive discussions about stack unwinding with stack
switches in #57698 <#57698>, and as
you see that it is a difficult task, I don't think it is necessary to have
a separate issue. Although there is a difference in detail in this case, it
is probably still better to have the discussion in one place. Thanks.
—
Reply to this email directly, view it on GitHub
<#59519 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/A25ROZTOTBGZAUCBX657OVDXAQVSZANCNFSM6AAAAAAWYY65UI>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
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?
Test case can be found in the following github.
https://github.com/MariappanBalraj/test_cgo_panic
Command used to build: CGO_CFLAGS="-g" go build -gcflags=all="-N -l"
ulimit -c unlimited
echo "core" > /proc/sys/kernel/core_pattern
export GOTRACEBACK=crash
When the complied go program is run, core file is getting generated because of calling panic(). The following code is line is causing the system stack corruption. Because of this, I am not seeing the complete stack trace.
326 func unwindm(restore *bool) {
327 if *restore {
328 // Restore sp saved by cgocallback during
329 // unwind of g's stack (see comment at top of file).
330 mp := acquirem()
331 sched := &mp.g0.sched
332 sched.sp = *(*uintptr)(unsafe.Pointer(sched.sp + alignUp(sys.MinFrameSize, sys.StackAlign)))
What did you expect to see?
0 0x0000000000460ea1 in runtime.raise
at /home/soomohan/mbalraj/GO/go1202/go/src/runtime/sys_linux_amd64.s:154
1 0x0000000000449845 in runtime.dieFromSignal
at /home/soomohan/mbalraj/GO/go1202/go/src/runtime/signal_unix.go:879
2 0x0000000000449e25 in runtime.sigfwdgo
at /home/soomohan/mbalraj/GO/go1202/go/src/runtime/signal_unix.go:1092
3 0x00000000004487a7 in runtime.sigtrampgo
at /home/soomohan/mbalraj/GO/go1202/go/src/runtime/signal_unix.go:432
4 0x0000000000461186 in runtime.sigtramp
at /home/soomohan/mbalraj/GO/go1202/go/src/runtime/sys_linux_amd64.s:354
5 0x00007f686b787520 in ???
at ?:-1
6 0x0000000000449a58 in runtime.crash
at /home/soomohan/mbalraj/GO/go1202/go/src/runtime/signal_unix.go:971
7 0x0000000000434d85 in runtime.fatalpanic
at /home/soomohan/mbalraj/GO/go1202/go/src/runtime/panic.go:1168
8 0x00000000004344cc in runtime.gopanic
at /home/soomohan/mbalraj/GO/go1202/go/src/runtime/panic.go:987
9 0x00000000004642a7 in main.Test4
at ./export.go:8
10 0x000000000046431c in _cgoexp_209e16473f08_Test4
at _cgo_gotypes.go:61
11 0x000000000040535b in runtime.cgocallbackg1
at /home/soomohan/mbalraj/GO/go1202/go/src/runtime/cgocall.go:315
12 0x0000000000405079 in runtime.cgocallbackg
at /home/soomohan/mbalraj/GO/go1202/go/src/runtime/cgocall.go:234
13 0x0000000000461b0f in runtime.cgocallbackg
at :1
14 0x000000000045f3d4 in runtime.cgocallback
at /home/soomohan/mbalraj/GO/go1202/go/src/runtime/asm_amd64.s:998
15 0x00000000004641bd in crosscall2
15 0x00000000004641bd in crosscall2
at /home/soomohan/mbalraj/GO/go1202/go/src/runtime/cgo/asm_amd64.s:30
16 0x0000000000464386 in C.Test4
at /tmp/go-build/_cgo_export.c:33
17 0x0000000000464432 in C.test1
at ./hello.go:10
18 0x000000000046444d in C.test2
at ./hello.go:15
19 0x0000000000464468 in C.test3
at ./hello.go:20
20 0x00000000004644a7 in C._cgo_209e16473f08_Cfunc_test3
at /tmp/go-build/cgo-gcc-prolog:49
21 0x000000000045f2c4 in runtime.asmcgocall
at /home/soomohan/mbalraj/GO/go1202/go/src/runtime/asm_amd64.s:848
22 0x000000000046448a in C._cgo_209e16473f08_Cfunc_test3
at /tmp/go-build/cgo-gcc-prolog:44
23 0x0000000000404f0a in runtime.cgocall
at /home/soomohan/mbalraj/GO/go1202/go/src/runtime/cgocall.go:167
24 0x0000000000464245 in main._Cfunc_test3
at _cgo_gotypes.go:39
25 0x00000000004642d7 in main.main
at ./hello.go:34
26 0x0000000000437053 in runtime.main
at /home/soomohan/mbalraj/GO/go1202/go/src/runtime/proc.go:250
27 0x000000000045f5c1 in runtime.goexit
at /home/soomohan/mbalraj/GO/go1202/go/src/runtime/asm_amd64.s:1598
What did you see instead?
0 0x0000000000460ec1 in runtime.raise
at /home/soomohan/mbalraj/GO/go1.20.3/go/src/runtime/sys_linux_amd64.s:154
1 0x0000000000449865 in runtime.dieFromSignal
at /home/soomohan/mbalraj/GO/go1.20.3/go/src/runtime/signal_unix.go:879
2 0x0000000000449e45 in runtime.sigfwdgo
at /home/soomohan/mbalraj/GO/go1.20.3/go/src/runtime/signal_unix.go:1092
3 0x00000000004487c7 in runtime.sigtrampgo
at /home/soomohan/mbalraj/GO/go1.20.3/go/src/runtime/signal_unix.go:432
4 0x00000000004611a6 in runtime.sigtramp
at /home/soomohan/mbalraj/GO/go1.20.3/go/src/runtime/sys_linux_amd64.s:354
5 0x00007ff08b3ae520 in ???
at ?:-1
6 0x0000000000449a78 in runtime.crash
at /home/soomohan/mbalraj/GO/go1.20.3/go/src/runtime/signal_unix.go:971
7 0x0000000000434da5 in runtime.fatalpanic
at /home/soomohan/mbalraj/GO/go1.20.3/go/src/runtime/panic.go:1168
8 0x00000000004344ec in runtime.gopanic
at /home/soomohan/mbalraj/GO/go1.20.3/go/src/runtime/panic.go:987
9 0x00000000004642c7 in main.Test4
at ./export.go:8
10 0x000000000046433c in _cgoexp_209e16473f08_Test4
at _cgo_gotypes.go:61
11 0x000000000040535b in runtime.cgocallbackg1
at /home/soomohan/mbalraj/GO/go1.20.3/go/src/runtime/cgocall.go:315
12 0x0000000000405079 in runtime.cgocallbackg
at /home/soomohan/mbalraj/GO/go1.20.3/go/src/runtime/cgocall.go:234
13 0x0000000000461b2f in runtime.cgocallbackg
at :1
14 0x000000000045f3f4 in runtime.cgocallback
at /home/soomohan/mbalraj/GO/go1.20.3/go/src/runtime/asm_amd64.s:998
15 0x0000000000000001 in ???
15 0x0000000000000001 in ???
at ?:-1
16 0x000000c00003e000 in ???
at ?:-1
error: error while reading spliced memory at 0x8: EOF
(truncated)
The text was updated successfully, but these errors were encountered: