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
This is simplified simulated code, but can't reproduce the problem.
Basically, I have a complex struct and its value will be concurrently modified (which I guess is the key). After all, the complex struct will be printed and the whole process crash occasionally.
I set GOTRACEBACK=crash, so I can get the core dump and analyse it with delve.
below is the backtrace
0 0x0000000000482de1 in runtime.raise
at /usr/local/go/src/runtime/sys_linux_amd64.s:164
1 0x000000000045ea1d in runtime.dieFromSignal
at /usr/local/go/src/runtime/signal_unix.go:768
2 0x000000000045f071 in runtime.sigfwdgo
at /usr/local/go/src/runtime/signal_unix.go:982
3 0x000000000045d894 in runtime.sigtrampgo
at /usr/local/go/src/runtime/signal_unix.go:416
4 0x0000000000483163 in runtime.sigtramp
at /usr/local/go/src/runtime/sys_linux_amd64.s:399
5 0x00007f98d33fb630 in???
at ?:-1
6 0x00000000004473ac in runtime.crash
at /usr/local/go/src/runtime/signal_unix.go:860
7 0x00000000004473ac in runtime.fatalpanic
at /usr/local/go/src/runtime/panic.go:1217
8 0x0000000000446ce5 in runtime.gopanic
at /usr/local/go/src/runtime/panic.go:1065
9 0x00000000004449fb in runtime.panicmem
at /usr/local/go/src/runtime/panic.go:212
10 0x000000000045e853 in runtime.sigpanic
at /usr/local/go/src/runtime/signal_unix.go:734
11 0x00000000004824fc in runtime.memmove
at /usr/local/go/src/runtime/memmove_amd64.s:185
12 0x000000000050654e in fmt.(*buffer).writeString
at /usr/local/go/src/fmt/print.go:82
13 0x000000000050654e in fmt.(*fmt).padString
at /usr/local/go/src/fmt/format.go:110
14 0x00000000005074a5 in fmt.(*fmt).fmtS
at /usr/local/go/src/fmt/format.go:359
15 0x000000000050a951 in fmt.(*pp).fmtString
at /usr/local/go/src/fmt/print.go:443
16 0x000000000050f056 in fmt.(*pp).printValue
at /usr/local/go/src/fmt/print.go:757
17 0x000000000050e9a8 in fmt.(*pp).printValue
at /usr/local/go/src/fmt/print.go:806
18 0x000000000050e9a8 in fmt.(*pp).printValue
at /usr/local/go/src/fmt/print.go:806
19 0x000000000050e797 in fmt.(*pp).printValue
at /usr/local/go/src/fmt/print.go:876
20 0x000000000050c813 in fmt.(*pp).printArg
at /usr/local/go/src/fmt/print.go:712
21 0x000000000050fe48 in fmt.(*pp).doPrintf
at /usr/local/go/src/fmt/print.go:1026
22 0x0000000000509186 in fmt.Sprintf
at /usr/local/go/src/fmt/print.go:219
The code has a data race, which in a bigger and more complex program in the long run probably ends up corrupting some internal data. In general, there is no guarantee that a racy program will behave in a predictable way. You'll need to protect access to shared resources with locks or by using atomic operations.
Running the program with -race will print race warnings that point to the exact location of the data race.
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
never try the latest release of go.
One process will crash every few days in production environment ( not very frequent, about 100 processes in total).
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Note: real used version is 1.16.9
https://go.dev/play/p/W9ut43Jar8b
This is simplified simulated code, but can't reproduce the problem.
Basically, I have a complex struct and its value will be concurrently modified (which I guess is the key). After all, the complex struct will be printed and the whole process crash occasionally.
I set
GOTRACEBACK=crash
, so I can get the core dump and analyse it with delve.below is the backtrace
THE code of frame 12 is:
I'm sure
b
is not nil, because I examine it in frame 13, while str can't be examinedWhat did you expect to see?
I wanna know the reason.
What did you see instead?
The text was updated successfully, but these errors were encountered: