Skip to content
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: fatal error: missed stack barrier #14101

Closed
kostya-sh opened this issue Jan 26, 2016 · 4 comments
Closed

runtime: fatal error: missed stack barrier #14101

kostya-sh opened this issue Jan 26, 2016 · 4 comments
Milestone

Comments

@kostya-sh
Copy link
Contributor

A program with trace enabled (runtime/trace.Start) compiled with Go tip (e634765) panics with fatal error: missed stack barrier fairly consistently (1 run in 2).

OS: Debian 8.2
Hardware: 4 cores i7-4700MQ
Full source code: https://github.com/kostya-sh/sandbox/blob/master/tfb-go/app-files/src/hello/hello.go
To trigger a panic:

$ curl http://localhost:8080/profile/start?f=x
$ wrk -t4 -c4 -d60 http://localhost:8080/json

Full stack trace:

found next stack barrier at 0xc82045ff90; expected [@@@ *0xc82045ff90=0x464401 ==>]
fatal error: missed stack barrier

runtime stack:
runtime.throw(0x8d7130, 0x14)
    /home/ksh/work/os-code/go/src/runtime/panic.go:530 +0x90
runtime.gentraceback(0x654185, 0xc82045f8a8, 0x0, 0xc820001680, 0x0, 0x7f74a4400020, 0x80, 0x0, 0x0, 0x0, ...)
    /home/ksh/work/os-code/go/src/runtime/traceback.go:295 +0x1560
runtime.gcallers(0xc820001680, 0x1, 0x7f74a4400020, 0x80, 0x80, 0x944138)
    /home/ksh/work/os-code/go/src/runtime/traceback.go:609 +0x7f
runtime.traceEvent(0x4d821c, 0x1, 0x0, 0x0, 0x0)
    /home/ksh/work/os-code/go/src/runtime/trace.go:532 +0x599
runtime.traceGoSysCall()
    /home/ksh/work/os-code/go/src/runtime/trace.go:873 +0x36
runtime.systemstack(0xc82016a4c0)
    /home/ksh/work/os-code/go/src/runtime/asm_amd64.s:291 +0x79
runtime.mstart()
    /home/ksh/work/os-code/go/src/runtime/proc.go:1048

goroutine 8 [syscall]:
syscall.Syscall(0x1, 0xb, 0xc8201a4000, 0x94, 0x43110d, 0xc82045f8f8, 0x4d5448)
    /home/ksh/work/os-code/go/src/syscall/asm_linux_amd64.s:18 +0x5 fp=0xc82045f8b0 sp=0xc82045f8a8
syscall.write(0xb, 0xc8201a4000, 0x94, 0x1000, 0x77, 0x0, 0x0)
    /home/ksh/work/os-code/go/src/syscall/zsyscall_linux_amd64.go:1064 +0x5f fp=0xc82045f8f0 sp=0xc82045f8b0
syscall.Write(0xb, 0xc8201a4000, 0x94, 0x1000, 0xc81ffe0a02, 0x0, 0x0)
    /home/ksh/work/os-code/go/src/syscall/syscall_unix.go:180 +0x4d fp=0xc82045f930 sp=0xc82045f8f0
net.(*netFD).Write(0xc82001a1c0, 0xc8201a4000, 0x94, 0x1000, 0x0, 0x0, 0x0)
    /home/ksh/work/os-code/go/src/net/fd_unix.go:328 +0x1c7 fp=0xc82045fa00 sp=0xc82045f930
net.(*conn).Write(0xc82002c050, 0xc8201a4000, 0x94, 0x1000, 0x0, 0x0, 0x0)
    /home/ksh/work/os-code/go/src/net/net.go:184 +0xe4 fp=0xc82045fa68 sp=0xc82045fa00
net/http.checkConnErrorWriter.Write(0xc8200e2380, 0xc8201a4000, 0x94, 0x1000, 0x0, 0x0, 0x0)
    /home/ksh/work/os-code/go/src/net/http/server.go:2538 +0x71 fp=0xc82045fab8 sp=0xc82045fa68
bufio.(*Writer).flush(0xc820058580, 0x0, 0x0)
    /home/ksh/work/os-code/go/src/bufio/bufio.go:562 +0xe0 fp=0xc82045fb80 sp=0xc82045fab8
bufio.(*Writer).Flush(0xc820058580, 0x0, 0x0)
    /home/ksh/work/os-code/go/src/bufio/bufio.go:551 +0x2d fp=0xc82045fba0 sp=0xc82045fb80
net/http.(*response).finishRequest(0xc8204ad110)
    /home/ksh/work/os-code/go/src/net/http/server.go:1251 +0xab fp=0xc82045fbd0 sp=0xc82045fba0
net/http.(*conn).serve(0xc8200e2380)
    /home/ksh/work/os-code/go/src/net/http/server.go:1474 +0xf68 fp=0xc82045ff98 sp=0xc82045fbd0
runtime.goexit()
    /home/ksh/work/os-code/go/src/runtime/asm_amd64.s:1998 +0x1 fp=0xc82045ffa0 sp=0xc82045ff98
created by net/http.(*Server).Serve
    /home/ksh/work/os-code/go/src/net/http/server.go:2135 +0x44e

goroutine 1 [IO wait]:
net.runtime_pollWait(0x7f74a44f1138, 0x72, 0x0)
    /home/ksh/work/os-code/go/src/runtime/netpoll.go:160 +0x60
net.(*pollDesc).Wait(0xc82013a300, 0x72, 0x0, 0x0)
    /home/ksh/work/os-code/go/src/net/fd_poll_runtime.go:73 +0x3a
net.(*pollDesc).WaitRead(0xc82013a300, 0x0, 0x0)
    /home/ksh/work/os-code/go/src/net/fd_poll_runtime.go:78 +0x36
net.(*netFD).accept(0xc82013a2a0, 0x0, 0x7f74a44f13f8, 0xc82010c8a0)
    /home/ksh/work/os-code/go/src/net/fd_unix.go:426 +0x27c
net.(*TCPListener).AcceptTCP(0xc820128058, 0x459440, 0x0, 0x0)
    /home/ksh/work/os-code/go/src/net/tcpsock_posix.go:254 +0x4d
net/http.tcpKeepAliveListener.Accept(0xc820128058, 0x0, 0x0, 0x0, 0x0)
    /home/ksh/work/os-code/go/src/net/http/server.go:2423 +0x41
net/http.(*Server).Serve(0xc82012a480, 0x7f74a44f15e0, 0xc820128058, 0x0, 0x0)
    /home/ksh/work/os-code/go/src/net/http/server.go:2115 +0x129
net/http.(*Server).ListenAndServe(0xc82012a480, 0x0, 0x0)
    /home/ksh/work/os-code/go/src/net/http/server.go:2096 +0x136
net/http.ListenAndServe(0x87ecd8, 0x5, 0x0, 0x0, 0x0, 0x0)
    /home/ksh/work/os-code/go/src/net/http/server.go:2193 +0x98
main.main()
    /home/ksh/work/go/src/github.com/kostya-sh/sandbox/tfb-go/app-files/src/hello/hello.go:147 +0x3aa

goroutine 17 [syscall, locked to thread]:
runtime.goexit()
    /home/ksh/work/os-code/go/src/runtime/asm_amd64.s:1998 +0x1

goroutine 34 [IO wait]:
net.runtime_pollWait(0x7f74a44f0ef8, 0x72, 0xc82013f000)
    /home/ksh/work/os-code/go/src/runtime/netpoll.go:160 +0x60
net.(*pollDesc).Wait(0xc82015e060, 0x72, 0x0, 0x0)
    /home/ksh/work/os-code/go/src/net/fd_poll_runtime.go:73 +0x3a
net.(*pollDesc).WaitRead(0xc82015e060, 0x0, 0x0)
    /home/ksh/work/os-code/go/src/net/fd_poll_runtime.go:78 +0x36
net.(*netFD).Read(0xc82015e000, 0xc82013f000, 0x1000, 0x1000, 0x0, 0x7f74a4530050, 0xc82000a1d0)
    /home/ksh/work/os-code/go/src/net/fd_unix.go:250 +0x23a
net.(*conn).Read(0xc820162000, 0xc82013f000, 0x1000, 0x1000, 0x0, 0x0, 0x0)
    /home/ksh/work/os-code/go/src/net/net.go:172 +0xe4
net/http.(*connReader).Read(0xc82010c840, 0xc82013f000, 0x1000, 0x1000, 0x0, 0x0, 0x0)
    /home/ksh/work/os-code/go/src/net/http/server.go:526 +0x196
bufio.(*Reader).fill(0xc82012e120)
    /home/ksh/work/os-code/go/src/bufio/bufio.go:97 +0x1e9
bufio.(*Reader).ReadSlice(0xc82012e120, 0xa, 0x0, 0x0, 0x0, 0x0, 0x0)
    /home/ksh/work/os-code/go/src/bufio/bufio.go:328 +0x21a
bufio.(*Reader).ReadLine(0xc82012e120, 0x0, 0x0, 0x0, 0x861800, 0x0, 0x0)
    /home/ksh/work/os-code/go/src/bufio/bufio.go:357 +0x53
net/textproto.(*Reader).readLineSlice(0xc82048d800, 0x0, 0x0, 0x0, 0x0, 0x0)
    /home/ksh/work/os-code/go/src/net/textproto/reader.go:55 +0x81
net/textproto.(*Reader).ReadLine(0xc82048d800, 0x0, 0x0, 0x0, 0x0)
    /home/ksh/work/os-code/go/src/net/textproto/reader.go:36 +0x40
net/http.readRequest(0xc82012e120, 0x0, 0xc8203940e0, 0x0, 0x0)
    /home/ksh/work/os-code/go/src/net/http/request.go:707 +0xb6
net/http.(*conn).readRequest(0xc820166000, 0x0, 0x0, 0x0)
    /home/ksh/work/os-code/go/src/net/http/server.go:703 +0x359
net/http.(*conn).serve(0xc820166000)
    /home/ksh/work/os-code/go/src/net/http/server.go:1423 +0x947
created by net/http.(*Server).Serve
    /home/ksh/work/os-code/go/src/net/http/server.go:2135 +0x44e

goroutine 18 [chan receive]:
database/sql.(*DB).connectionOpener(0xc820130000)
    /home/ksh/work/os-code/go/src/database/sql/sql.go:728 +0x45
created by database/sql.Open
    /home/ksh/work/os-code/go/src/database/sql/sql.go:494 +0x33f

goroutine 21 [runnable]:
net/textproto.(*Reader).ReadLine(0xc820410000, 0xc82029b7a0, 0xc820062c00, 0x457490, 0xc820062c00)
    /home/ksh/work/os-code/go/src/net/textproto/reader.go:35
net/http.readRequest(0xc82012e1e0, 0x0, 0xc82029b7a0, 0x0, 0x0)
    /home/ksh/work/os-code/go/src/net/http/request.go:707 +0xb6
net/http.(*conn).readRequest(0xc82012a700, 0x0, 0x0, 0x0)
    /home/ksh/work/os-code/go/src/net/http/server.go:703 +0x359
net/http.(*conn).serve(0xc82012a700)
    /home/ksh/work/os-code/go/src/net/http/server.go:1423 +0x947
created by net/http.(*Server).Serve
    /home/ksh/work/os-code/go/src/net/http/server.go:2135 +0x44e

goroutine 20 [trace reader (blocked)]:
runtime.ReadTrace(0x0, 0x0, 0x0)
    /home/ksh/work/os-code/go/src/runtime/trace.go:356 +0x1cc
runtime/trace.Start.func1(0x7f74a4534218, 0xc820128070)
    /home/ksh/work/os-code/go/src/runtime/trace/trace.go:28 +0x18
created by runtime/trace.Start
    /home/ksh/work/os-code/go/src/runtime/trace/trace.go:34 +0x78

goroutine 22 [runnable]:
net.(*pollDesc).PrepareWrite(0xc82013a4c0, 0x944138, 0xc82013a460)
    /home/ksh/work/os-code/go/src/net/fd_poll_runtime.go:68
net.(*netFD).Write(0xc82013a460, 0xc82015a000, 0x94, 0x1000, 0x0, 0x0, 0x0)
    /home/ksh/work/os-code/go/src/net/fd_unix.go:323 +0x105
net.(*conn).Write(0xc8201280b0, 0xc82015a000, 0x94, 0x1000, 0x0, 0x0, 0x0)
    /home/ksh/work/os-code/go/src/net/net.go:184 +0xe4
net/http.checkConnErrorWriter.Write(0xc82012a880, 0xc82015a000, 0x94, 0x1000, 0x0, 0x0, 0x0)
    /home/ksh/work/os-code/go/src/net/http/server.go:2538 +0x71
bufio.(*Writer).flush(0xc82011e7c0, 0x0, 0x0)
    /home/ksh/work/os-code/go/src/bufio/bufio.go:562 +0xe0
bufio.(*Writer).Flush(0xc82011e7c0, 0x0, 0x0)
    /home/ksh/work/os-code/go/src/bufio/bufio.go:551 +0x2d
net/http.(*response).finishRequest(0xc8203961a0)
    /home/ksh/work/os-code/go/src/net/http/server.go:1251 +0xab
net/http.(*conn).serve(0xc82012a880)
    /home/ksh/work/os-code/go/src/net/http/server.go:1474 +0xf68
created by net/http.(*Server).Serve
    /home/ksh/work/os-code/go/src/net/http/server.go:2135 +0x44e
@bradfitz bradfitz added this to the Go1.6Maybe milestone Jan 26, 2016
@aclements
Copy link
Member

It looks like traceEvent needs to take the stack lock, too. Sigh.

@aclements aclements modified the milestones: Go1.6, Go1.6Maybe Jan 26, 2016
@aclements
Copy link
Member

@kostya-sh, https://go-review.googlesource.com/18973 should fix this. Can you give it a spin?

@gopherbot
Copy link

CL https://golang.org/cl/18973 mentions this issue.

@kostya-sh
Copy link
Contributor Author

@aclements, thank you. Works like a charm! I haven't been able to reproduce the panic with this patch applied.

@golang golang locked and limited conversation to collaborators Feb 3, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants