profile
viewpoint

Ask questionsruntime: go program crach, it seems fall into infinite loop

<!-- Please answer these questions before submitting your issue. Thanks! -->

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

<pre> go version go1.12.9 linux/arm64

</pre>

Does this issue reproduce with the latest release?

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

<details><summary><code>go env</code> Output</summary><br><pre> aarch64

</pre></details>

What did you do?

do nothing, just run the go program

<!-- If possible, provide a recipe for reproducing the error. A complete runnable program is good. A link on play.golang.org is best. -->

What did you expect to see?

program run normally

What did you see instead?

program crashed!

after gdb core file, we see one thread falled into infinite loop, see details below

(gdb) bt
#0  runtime.futex () at /opt/tools/go/src/runtime/sys_linux_arm64.s:417
#1  0x000000000042cb68 in runtime.futexsleep (addr=0x14f23b0 <runtime.sched+272>, val=0, ns=60000000000) at /opt/tools/go/src/runtime/os_linux.go:63
#2  0x000000000040be7c in runtime.notetsleep_internal (n=0x14f23b0 <runtime.sched+272>, ns=60000000000, ~r2=<optimized out>) at /opt/tools/go/src/runtime/lock_futex.go:193
#3  0x000000000040bf50 in runtime.notetsleep (n=0x14f23b0 <runtime.sched+272>, ns=60000000000, ~r2=<optimized out>) at /opt/tools/go/src/runtime/lock_futex.go:216
#4  0x000000000043b614 in runtime.sysmon () at /opt/tools/go/src/runtime/proc.go:4305
#5  0x000000000043350c in runtime.mstart1 () at /opt/tools/go/src/runtime/proc.go:1206
#6  0x000000000043342c in runtime.mstart () at /opt/tools/go/src/runtime/proc.go:1172
#7  0x0000000000b683b8 in crosscall1 () at gcc_arm64.S:40
...
#38643 0x0000000000b683b8 in crosscall1 () at gcc_arm64.S:40
#38644 0x0000000000b683b8 in crosscall1 () at gcc_arm64.S:40
#38645 0x0000000000b683b8 in crosscall1 () at gcc_arm64.S:40
#38646 0x0000000000b683b8 in crosscall1 () at gcc_arm64.S:40
#38647 0x0000000000b683b8 in crosscall1 () at gcc_arm64.S:40
#38648 0x0000000000b683b8 in crosscall1 () at gcc_arm64.S:40
#38649 0x0000000000b683b8 in crosscall1 () at gcc_arm64.S:40
#38650 0x0000000000b683b8 in crosscall1 () at gcc_arm64.S:40
#38651 0x0000000000b683b8 in crosscall1 () at gcc_arm64.S:40
#38652 0x0000000000b683b8 in crosscall1 () at gcc_arm64.S:40

register values are

(gdb) i r
x0             0x4000874848        274886772808
x1             0x80                128
x2             0x0                 0
x3             0x0                 0
x4             0x0                 0
x5             0x0                 0
x6             0x45                69
x7             0x1                 1
x8             0x62                98
x9             0x92865ea           153642474
x10            0x5dcee731          1573840689
x11            0x18                24
x12            0xffffffffa235c94b  -1573533365
x13            0x0                 0
x14            0xfffe75ffa5c0      281468366464448
x15            0x0                 0
x16            0x4000874738        274886772536
x17            0xfffe75ffa870      281468366465136
x18            0x1                 1
x19            0x8                 8
x20            0x40009c2f20        274888142624
x21            0x4000874700        274886772480
x22            0x65f4              26100
x23            0x0                 0
x24            0x4000c673d8        274890912728
x25            0x6c1a1cae73a3c66a  7789570041080694378
x26            0xd5a720            14001952
x27            0x14b0380           21693312
x28            0x4000688180        274884755840
x29            0xfffe75ffa6f8      281468366464760
x30            0x42caf4            4377332
sp             0xfffe75ffa700      0xfffe75ffa700
pc             0x45be04            0x45be04 <runtime.futex+28>
cpsr           0x60000000          [ EL=0 C Z ]
fpsr           0x10                16
fpcr           0x0                 0
gcc_arm64.S code snapshot
25 .globl EXT(crosscall1)
26 EXT(crosscall1):
27 stp x19, x20, [sp, #-16]!
28 stp x21, x22, [sp, #-16]!
29 stp x23, x24, [sp, #-16]!
30 stp x25, x26, [sp, #-16]!
31 stp x27, x28, [sp, #-16]!
32 stp x29, x30, [sp, #-16]!
33 mov x29, sp
34
35 mov x19, x0
36 mov x20, x1
37 mov x0, x2
38
39 blr x20
40 blr x19
41
42 ldp x29, x30, [sp], #16
43 ldp x27, x28, [sp], #16
44 ldp x25, x26, [sp], #16
45 ldp x23, x24, [sp], #16
46 ldp x21, x22, [sp], #16
47 ldp x19, x20, [sp], #16
48 ret

as see above, x19's value is strange

golang/go

Answer questions mmli519

on 14 Oct, I submitted one similar issue: https://github.com/golang/go/issues/34886

useful!

Related questions

cmd/link: segmentation fault during mach-o linking
cmd/go: cannot find module providing package error stops `go get` processing hot 3
vendor/golang.org/x/xerrors/adaptor_go1_13.go:16:14: undefined: errors.Frame ... hot 2
cmd/vet: potential false positive in the "suspect or" check hot 2
internal/poll: transparently support new linux io_uring interface hot 2
cmd/go: needs a better error than "missing dot in first path element" when GOROOT is set incorrectly hot 2
x/xerrors: fails to compile on tip hot 1
cmd/go: `go clean <package>` downloads modules hot 1
cmd/cgo error: runtime: unknown pc 0x7fff5c805b86 hot 1
runtime: crash with "invalid pc-encoded table" hot 1
cmd/link: showing many ld warnings of "building for macOS, but linking in object file" hot 1
cmd/go: major version without preceding tag must be v0, not v1 - breaks build of github.com/go-check hot 1
gollvm: Using External Go Packages with gollvm hot 1
runtime: macOS Sierra builders spinning hot 1
cmd/go: Problem using go modules hot 1
Github User Rank List