Skip to content

runtime: fatal error: stack not a power of 2 when using go 1.4.2 #12192

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

Closed
tsgan opened this issue Aug 19, 2015 · 13 comments
Closed

runtime: fatal error: stack not a power of 2 when using go 1.4.2 #12192

tsgan opened this issue Aug 19, 2015 · 13 comments
Milestone

Comments

@tsgan
Copy link

tsgan commented Aug 19, 2015

go test passes for Linux but crashes on FreeBSD:

tsgan@bsd:~/go/src/github.com/g3rk6/gopensslproxy % go test -a
fatal error: stack not a power of 2

runtime stack:
runtime.throw(0xc44084)
    /home/tsgan/go1.4/src/runtime/panic.go:491 +0xad
runtime.stackfree(0x802c83170, 0xc2080d6000)
    /home/tsgan/go1.4/src/runtime/stack.c:272 +0x55
gfput(0xc208012000, 0xc2080018c0)
    /home/tsgan/go1.4/src/runtime/proc.c:2266 +0x84
goexit0(0xc2080018c0)
    /home/tsgan/go1.4/src/runtime/proc.c:1716 +0x169
runtime.mcall(0x43d534)
    /home/tsgan/go1.4/src/runtime/asm_amd64.s:186 +0x5a

goroutine 1 [runnable]:
testing.RunTests(0x907040, 0xc31bc0, 0x18, 0x18, 0x1)
    /home/tsgan/go1.4/src/testing/testing.go:556 +0xad6
testing.(*M).Run(0xc20809a5a0, 0xc54a00)
    /home/tsgan/go1.4/src/testing/testing.go:485 +0x6c
main.main()
    github.com/g3rk6/gopensslproxy/_test/_testmain.go:100 +0x1d5

goroutine 5 [syscall]:
os/signal.loop()
    /home/tsgan/go1.4/src/os/signal/signal_unix.go:21 +0x1f
created by os/signal.init·1
    /home/tsgan/go1.4/src/os/signal/signal_unix.go:27 +0x35

goroutine 11 [IO wait]:
net.(*pollDesc).Wait(0xc2080ac450, 0x72, 0x0, 0x0)
    /home/tsgan/go1.4/src/net/fd_poll_runtime.go:84 +0x47
net.(*pollDesc).WaitRead(0xc2080ac450, 0x0, 0x0)
    /home/tsgan/go1.4/src/net/fd_poll_runtime.go:89 +0x43
net.(*netFD).accept(0xc2080ac3f0, 0x0, 0x800c83de0, 0xc20800ba38)
    /home/tsgan/go1.4/src/net/fd_unix.go:419 +0x40b
net.(*TCPListener).AcceptTCP(0xc20804e018, 0x0, 0x0, 0x0)
    /home/tsgan/go1.4/src/net/tcpsock_posix.go:234 +0x4e
net.(*TCPListener).Accept(0xc20804e018, 0x0, 0x0, 0x0, 0x0)
    /home/tsgan/go1.4/src/net/tcpsock_posix.go:244 +0x4c
net/http/httptest.(*historyListener).Accept(0xc2080c5c50, 0x0, 0x0, 0x0, 0x0)
    /home/tsgan/go1.4/src/net/http/httptest/server.go:48 +0x7a
net/http.(*Server).Serve(0xc2080b5140, 0x800c85b68, 0xc2080c5c50, 0x0, 0x0)
    /home/tsgan/go1.4/src/net/http/server.go:1728 +0x92
created by net/http/httptest.(*Server).Start
    /home/tsgan/go1.4/src/net/http/httptest/server.go:109 +0x35e

goroutine 10 [IO wait]:
net.(*pollDesc).Wait(0xc2080acd10, 0x72, 0x0, 0x0)
    /home/tsgan/go1.4/src/net/fd_poll_runtime.go:84 +0x47
net.(*pollDesc).WaitRead(0xc2080acd10, 0x0, 0x0)
    /home/tsgan/go1.4/src/net/fd_poll_runtime.go:89 +0x43
net.(*netFD).accept(0xc2080accb0, 0x0, 0x800c83de0, 0xc20800b9b8)
    /home/tsgan/go1.4/src/net/fd_unix.go:419 +0x40b
net.(*TCPListener).AcceptTCP(0xc20804e1d8, 0x0, 0x0, 0x0)
    /home/tsgan/go1.4/src/net/tcpsock_posix.go:234 +0x4e
net.(*TCPListener).Accept(0xc20804e1d8, 0x0, 0x0, 0x0, 0x0)
    /home/tsgan/go1.4/src/net/tcpsock_posix.go:244 +0x4c
crypto/tls.(*listener).Accept(0xc2080abd40, 0x0, 0x0, 0x0, 0x0)
    /home/tsgan/go1.4/src/crypto/tls/tls.go:46 +0x6b
net/http/httptest.(*historyListener).Accept(0xc2080c5bc0, 0x0, 0x0, 0x0, 0x0)
    /home/tsgan/go1.4/src/net/http/httptest/server.go:48 +0x7a
net/http.(*Server).Serve(0xc2080b5e60, 0x800c85b68, 0xc2080c5bc0, 0x0, 0x0)
    /home/tsgan/go1.4/src/net/http/server.go:1728 +0x92
created by net/http/httptest.(*Server).StartTLS
    /home/tsgan/go1.4/src/net/http/httptest/server.go:142 +0x887

goroutine 17 [syscall, locked to thread]:
runtime.goexit()
    /home/tsgan/go1.4/src/runtime/asm_amd64.s:2232 +0x1

goroutine 12 [IO wait]:
net.(*pollDesc).Wait(0xc2080ac4c0, 0x72, 0x0, 0x0)
    /home/tsgan/go1.4/src/net/fd_poll_runtime.go:84 +0x47
net.(*pollDesc).WaitRead(0xc2080ac4c0, 0x0, 0x0)
    /home/tsgan/go1.4/src/net/fd_poll_runtime.go:89 +0x43
net.(*netFD).accept(0xc2080ac460, 0x0, 0x800c83de0, 0xc20800ba68)
    /home/tsgan/go1.4/src/net/fd_unix.go:419 +0x40b
net.(*TCPListener).AcceptTCP(0xc20804e020, 0x0, 0x0, 0x0)
    /home/tsgan/go1.4/src/net/tcpsock_posix.go:234 +0x4e
net.(*TCPListener).Accept(0xc20804e020, 0x0, 0x0, 0x0, 0x0)
    /home/tsgan/go1.4/src/net/tcpsock_posix.go:244 +0x4c
net/http/httptest.(*historyListener).Accept(0xc2080c5ce0, 0x0, 0x0, 0x0, 0x0)
    /home/tsgan/go1.4/src/net/http/httptest/server.go:48 +0x7a
net/http.(*Server).Serve(0xc2080b51a0, 0x800c85b68, 0xc2080c5ce0, 0x0, 0x0)
    /home/tsgan/go1.4/src/net/http/server.go:1728 +0x92
created by net/http/httptest.(*Server).Start
    /home/tsgan/go1.4/src/net/http/httptest/server.go:109 +0x35e

goroutine 14 [IO wait]:
net.(*pollDesc).Wait(0xc2080ac610, 0x72, 0x0, 0x0)
    /home/tsgan/go1.4/src/net/fd_poll_runtime.go:84 +0x47
net.(*pollDesc).WaitRead(0xc2080ac610, 0x0, 0x0)
    /home/tsgan/go1.4/src/net/fd_poll_runtime.go:89 +0x43
net.(*netFD).accept(0xc2080ac5b0, 0x0, 0x800c83de0, 0xc20800bc18)
    /home/tsgan/go1.4/src/net/fd_unix.go:419 +0x40b
net.(*TCPListener).AcceptTCP(0xc20804e210, 0xc2080b60e0, 0x0, 0x0)
    /home/tsgan/go1.4/src/net/tcpsock_posix.go:234 +0x4e
net.(*TCPListener).Accept(0xc20804e210, 0x0, 0x0, 0x0, 0x0)
    /home/tsgan/go1.4/src/net/tcpsock_posix.go:244 +0x4c
github.com/g3rk6/openssl.(*listener).Accept(0xc2080abf00, 0x0, 0x0, 0x0, 0x0)
    /home/tsgan/go/src/github.com/g3rk6/openssl/net.go:28 +0x68
net/http.(*Server).Serve(0xc2080b5380, 0x800c85d78, 0xc2080abf00, 0x0, 0x0)
    /home/tsgan/go1.4/src/net/http/server.go:1728 +0x92
created by github.com/g3rk6/gopensslproxy.TestSignerTLS
    /home/tsgan/go/src/github.com/g3rk6/gopensslproxy/signer_test.go:80 +0x596
exit status 2
FAIL    github.com/g3rk6/gopensslproxy  2.272s
tsgan@bsd:~/go/src/github.com/g3rk6/gopensslproxy %
@ianlancetaylor ianlancetaylor changed the title fatal error: stack not a power of 2 when using go 1.4.2 runtime: fatal error: stack not a power of 2 when using go 1.4.2 Aug 19, 2015
@ianlancetaylor
Copy link
Member

Does this happen consistently?

Would it be possible for you to try the 1.5 release candidate?

@ianlancetaylor ianlancetaylor added this to the Go1.6 milestone Aug 19, 2015
@tsgan
Copy link
Author

tsgan commented Aug 19, 2015

It is consistent. With go version devel +3c43158 Mon Aug 17 06:58:16 2015 +0000 freebsd/amd64:

fatal error: bad stack size
--- FAIL: TestSignerTLS (2.05s)
    signer_test.go:17: RoundTrip malformed HTTP status code "\xedO\xa6\"gq\xb6LZ\xa3@\xd1\xf2\xe5GKZ\xb6\x8e\x15\x03\x03\x00\x1a\xf9n\xf2\xfbE`R\xb9\xea\xebvC\x86\x82e\xba\xeci\u009f\x978\xe6\x10\xf1\xab"

runtime stack:
runtime.throw(0x8c1be0, 0xe)
    /home/tsgan/golang/go/src/runtime/panic.go:527 +0x90
runtime.stackfree(0x802c361a0, 0xc820041fc0, 0x2000)
    /home/tsgan/golang/go/src/runtime/stack1.go:285 +0x13c
runtime.gfput(0xc820019500, 0xc820001c80)
    /home/tsgan/golang/go/src/runtime/proc1.go:2316 +0x8e
runtime.goexit0(0xc820001c80)
    /home/tsgan/golang/go/src/runtime/proc1.go:1764 +0x19d
runtime.mcall(0x43a800)
    /home/tsgan/golang/go/src/runtime/asm_amd64.s:204 +0x5b

goroutine 1 [runnable]:
syscall.Syscall(0x4, 0x1, 0xc820174000, 0xea, 0xea, 0xea, 0x0)
    /home/tsgan/golang/go/src/syscall/asm_freebsd_amd64.s:21 +0x5
syscall.write(0x1, 0xc820174000, 0xea, 0xf0, 0x0, 0x0, 0x0)
    /home/tsgan/golang/go/src/syscall/zsyscall_freebsd_amd64.go:1270 +0x5f
syscall.Write(0x1, 0xc820174000, 0xea, 0xf0, 0x97b179, 0x0, 0x0)
    /home/tsgan/golang/go/src/syscall/syscall_unix.go:176 +0x4d
os.(*File).write(0xc820024010, 0xc820174000, 0xea, 0xf0, 0x0, 0x0, 0x0)
    /home/tsgan/golang/go/src/os/file_unix.go:232 +0xd0
os.(*File).Write(0xc820024010, 0xc820174000, 0xea, 0xf0, 0x4, 0x0, 0x0)
    /home/tsgan/golang/go/src/os/file.go:139 +0x8a
fmt.Fprintf(0x801b1e4b8, 0xc820024010, 0x8feb30, 0x12, 0xc82010bbf8, 0x4, 0x4, 0x417430, 0x0, 0x0)
    /home/tsgan/golang/go/src/fmt/print.go:189 +0xb2
fmt.Printf(0x8feb30, 0x12, 0xc82010bbf8, 0x4, 0x4, 0x2, 0x0, 0x0)
    /home/tsgan/golang/go/src/fmt/print.go:197 +0x94
testing.(*T).report(0xc8200ea3f0)
    /home/tsgan/golang/go/src/testing/testing.go:512 +0x2ed
testing.RunTests(0x97dfc8, 0xcd4d20, 0x18, 0x18, 0x8b4a01)
    /home/tsgan/golang/go/src/testing/testing.go:570 +0x929
testing.(*M).Run(0xc82010bee8, 0x0)
    /home/tsgan/golang/go/src/testing/testing.go:494 +0x70
main.main()
    github.com/g3rk6/gopensslproxy/_test/_testmain.go:102 +0x116

goroutine 17 [syscall, locked to thread]:
runtime.goexit()
    /home/tsgan/golang/go/src/runtime/asm_amd64.s:1696 +0x1

goroutine 5 [syscall]:
os/signal.loop()
    /home/tsgan/golang/go/src/os/signal/signal_unix.go:22 +0x18
created by os/signal.init.1
    /home/tsgan/golang/go/src/os/signal/signal_unix.go:28 +0x37

goroutine 9 [IO wait]:
net.runtime_pollWait(0x801b1fb80, 0x72, 0xc82000a1e0)
    /home/tsgan/golang/go/src/runtime/netpoll.go:157 +0x60
net.(*pollDesc).Wait(0xc820113640, 0x72, 0x0, 0x0)
    /home/tsgan/golang/go/src/net/fd_poll_runtime.go:73 +0x3a
net.(*pollDesc).WaitRead(0xc820113640, 0x0, 0x0)
    /home/tsgan/golang/go/src/net/fd_poll_runtime.go:78 +0x36
net.(*netFD).accept(0xc8201135e0, 0x0, 0x801b5a000, 0xc8200b20c0)
    /home/tsgan/golang/go/src/net/fd_unix.go:408 +0x27c
net.(*TCPListener).AcceptTCP(0xc820024160, 0x3, 0x0, 0x0)
    /home/tsgan/golang/go/src/net/tcpsock_posix.go:254 +0x4d
net.(*TCPListener).Accept(0xc820024160, 0x0, 0x0, 0x0, 0x0)
    /home/tsgan/golang/go/src/net/tcpsock_posix.go:264 +0x3d
net/http/httptest.(*historyListener).Accept(0xc82011b3e0, 0x0, 0x0, 0x0, 0x0)
    /home/tsgan/golang/go/src/net/http/httptest/server.go:48 +0x63
net/http.(*Server).Serve(0xc820117bc0, 0x801b1fd38, 0xc82011b3e0, 0x0, 0x0)
    /home/tsgan/golang/go/src/net/http/server.go:1887 +0xb3
created by net/http/httptest.(*Server).Start
    /home/tsgan/golang/go/src/net/http/httptest/server.go:109 +0x380

goroutine 8 [IO wait]:
net.runtime_pollWait(0x801b1fc40, 0x72, 0xc82000a1e0)
    /home/tsgan/golang/go/src/runtime/netpoll.go:157 +0x60
net.(*pollDesc).Wait(0xc8200f3f70, 0x72, 0x0, 0x0)
    /home/tsgan/golang/go/src/net/fd_poll_runtime.go:73 +0x3a
net.(*pollDesc).WaitRead(0xc8200f3f70, 0x0, 0x0)
    /home/tsgan/golang/go/src/net/fd_poll_runtime.go:78 +0x36
net.(*netFD).accept(0xc8200f3f10, 0x0, 0x801b5a000, 0xc8200b20e0)
    /home/tsgan/golang/go/src/net/fd_unix.go:408 +0x27c
net.(*TCPListener).AcceptTCP(0xc820024158, 0xc800000001, 0x0, 0x0)
    /home/tsgan/golang/go/src/net/tcpsock_posix.go:254 +0x4d
net.(*TCPListener).Accept(0xc820024158, 0x0, 0x0, 0x0, 0x0)
    /home/tsgan/golang/go/src/net/tcpsock_posix.go:264 +0x3d
crypto/tls.(*listener).Accept(0xc820122420, 0x0, 0x0, 0x0, 0x0)
    /home/tsgan/golang/go/src/crypto/tls/tls.go:46 +0x60
net/http/httptest.(*historyListener).Accept(0xc82011b350, 0x0, 0x0, 0x0, 0x0)
    /home/tsgan/golang/go/src/net/http/httptest/server.go:48 +0x63
net/http.(*Server).Serve(0xc8200f5aa0, 0x801b1fd38, 0xc82011b350, 0x0, 0x0)
    /home/tsgan/golang/go/src/net/http/server.go:1887 +0xb3
created by net/http/httptest.(*Server).StartTLS
    /home/tsgan/golang/go/src/net/http/httptest/server.go:142 +0x839

goroutine 10 [IO wait]:
net.runtime_pollWait(0x801b1fac0, 0x72, 0xc82000a1e0)
    /home/tsgan/golang/go/src/runtime/netpoll.go:157 +0x60
net.(*pollDesc).Wait(0xc8201136b0, 0x72, 0x0, 0x0)
    /home/tsgan/golang/go/src/net/fd_poll_runtime.go:73 +0x3a
net.(*pollDesc).WaitRead(0xc8201136b0, 0x0, 0x0)
    /home/tsgan/golang/go/src/net/fd_poll_runtime.go:78 +0x36
net.(*netFD).accept(0xc820113650, 0x0, 0x801b5a000, 0xc8200b2100)
    /home/tsgan/golang/go/src/net/fd_unix.go:408 +0x27c
net.(*TCPListener).AcceptTCP(0xc820024168, 0x0, 0x0, 0x0)
    /home/tsgan/golang/go/src/net/tcpsock_posix.go:254 +0x4d
net.(*TCPListener).Accept(0xc820024168, 0x0, 0x0, 0x0, 0x0)
    /home/tsgan/golang/go/src/net/tcpsock_posix.go:264 +0x3d
net/http/httptest.(*historyListener).Accept(0xc82011b470, 0x0, 0x0, 0x0, 0x0)
    /home/tsgan/golang/go/src/net/http/httptest/server.go:48 +0x63
net/http.(*Server).Serve(0xc820117c20, 0x801b1fd38, 0xc82011b470, 0x0, 0x0)
    /home/tsgan/golang/go/src/net/http/server.go:1887 +0xb3
created by net/http/httptest.(*Server).Start
    /home/tsgan/golang/go/src/net/http/httptest/server.go:109 +0x380

goroutine 12 [IO wait]:
net.runtime_pollWait(0x801b1fa00, 0x72, 0xc82000a1e0)
    /home/tsgan/golang/go/src/runtime/netpoll.go:157 +0x60
net.(*pollDesc).Wait(0xc820113800, 0x72, 0x0, 0x0)
    /home/tsgan/golang/go/src/net/fd_poll_runtime.go:73 +0x3a
net.(*pollDesc).WaitRead(0xc820113800, 0x0, 0x0)
    /home/tsgan/golang/go/src/net/fd_poll_runtime.go:78 +0x36
net.(*netFD).accept(0xc8201137a0, 0x0, 0x801b5a000, 0xc8200b2520)
    /home/tsgan/golang/go/src/net/fd_unix.go:408 +0x27c
net.(*TCPListener).AcceptTCP(0xc8200241a8, 0xc820156048, 0x0, 0x0)
    /home/tsgan/golang/go/src/net/tcpsock_posix.go:254 +0x4d
net.(*TCPListener).Accept(0xc8200241a8, 0x0, 0x0, 0x0, 0x0)
    /home/tsgan/golang/go/src/net/tcpsock_posix.go:264 +0x3d
github.com/g3rk6/openssl.(*listener).Accept(0xc8201225c0, 0x0, 0x0, 0x0, 0x0)
    /home/tsgan/go/src/github.com/g3rk6/openssl/net.go:28 +0x5d
net/http.(*Server).Serve(0xc820117e00, 0x801b1ff48, 0xc8201225c0, 0x0, 0x0)
    /home/tsgan/golang/go/src/net/http/server.go:1887 +0xb3
created by github.com/g3rk6/gopensslproxy.TestSignerTLS
    /home/tsgan/go/src/github.com/g3rk6/gopensslproxy/signer_test.go:80 +0x599
exit status 2
FAIL    github.com/g3rk6/gopensslproxy  2.087s

@randall77
Copy link
Contributor

It looks like the stack entry of G structure is corrupted. When the G finishes and we try to free its stack, we trigger this failure.

Any cgo or unsafe used by this code? I don't see how this corruption might happen otherwise.

It looks like the corrupted part of the G is the first word. No deadead or anything else that might suggest GC involvement.

@tsgan
Copy link
Author

tsgan commented Aug 19, 2015

The code is open to try at github:

github.com/g3rk6/gopensslproxy

@davecheney
Copy link
Contributor

@tsgan your code has data races, please fix the races and see if the problem still occurs.

@tsgan
Copy link
Author

tsgan commented Aug 19, 2015

On Wed, Aug 19, 2015 at 12:57 PM, Dave Cheney notifications@github.com
wrote:

@tsgan https://github.com/tsgan your code has data races, please fix
the races and see if the problem still occurs.

Well, go test -race reports nothing.
Can you point me the places where the code may have races?

thanks a lot,


Reply to this email directly or view it on GitHub
#12192 (comment).

@davecheney
Copy link
Contributor

This is what I see when I run the tests with race enabled

lucky(~/src/github.com/g3rk6/gopensslproxy) % go test -race
2015/08/19 16:22:10 [003] WARN: Error copying to client: read tcp 127.0.0.1:59756->127.0.0.1:56087: read tcp 127.0.0.1:33158->127.0.0.1:36470: use of closed network connection
==================
WARNING: DATA RACE
Read by goroutine 103:
  github.com/g3rk6/gopensslproxy/transport.(*bodyEOFSignal).Close()
      /home/dfc/src/github.com/g3rk6/gopensslproxy/transport/transport.go:759 +0x45
  github.com/g3rk6/gopensslproxy/transport.(*persistConn).readLoop()
      /home/dfc/src/github.com/g3rk6/gopensslproxy/transport/transport.go:580 +0x49c

Previous write by goroutine 100:
  github.com/g3rk6/gopensslproxy/transport.(*bodyEOFSignal).Close()
      /home/dfc/src/github.com/g3rk6/gopensslproxy/transport/transport.go:762 +0x77
  github.com/g3rk6/gopensslproxy.(*ProxyHttpServer).ServeHTTP()
      /home/dfc/src/github.com/g3rk6/gopensslproxy/proxy.go:139 +0xecf
  net/http/httptest.(*waitGroupHandler).ServeHTTP()
      /home/dfc/go/src/net/http/httptest/server.go:200 +0xfe
  net/http.serverHandler.ServeHTTP()
      /home/dfc/go/src/net/http/server.go:1862 +0x206
  net/http.(*conn).serve()
      /home/dfc/go/src/net/http/server.go:1361 +0x117c

Goroutine 103 (running) created at:
  github.com/g3rk6/gopensslproxy/transport.(*Transport).getConn()
      /home/dfc/src/github.com/g3rk6/gopensslproxy/transport/transport.go:419 +0xbe3
  github.com/g3rk6/gopensslproxy/transport.(*Transport).DetailedRoundTrip()
      /home/dfc/src/github.com/g3rk6/gopensslproxy/transport/transport.go:163 +0x442
  github.com/g3rk6/gopensslproxy/transport.(*Transport).RoundTrip()
      /home/dfc/src/github.com/g3rk6/gopensslproxy/transport/transport.go:174 +0x46
  github.com/g3rk6/gopensslproxy.(*ProxyCtx).RoundTrip()
      /home/dfc/src/github.com/g3rk6/gopensslproxy/ctx.go:40 +0x121
  github.com/g3rk6/gopensslproxy.(*ProxyHttpServer).ServeHTTP()
      /home/dfc/src/github.com/g3rk6/gopensslproxy/proxy.go:115 +0x6ae
  net/http/httptest.(*waitGroupHandler).ServeHTTP()
      /home/dfc/go/src/net/http/httptest/server.go:200 +0xfe
  net/http.serverHandler.ServeHTTP()
      /home/dfc/go/src/net/http/server.go:1862 +0x206
  net/http.(*conn).serve()
      /home/dfc/go/src/net/http/server.go:1361 +0x117c

Goroutine 100 (running) created at:
  net/http.(*Server).Serve()
      /home/dfc/go/src/net/http/server.go:1910 +0x464
==================
2015/08/19 16:22:10 [001] WARN: Error copying to client: read tcp 127.0.0.1:44396->127.0.0.1:54014: read tcp 127.0.0.1:53066->127.0.0.1:43146: use of closed network connection
2015/08/19 16:22:10 [001] WARN: Cannot read TLS response from mitm'd server Host validation error
PASS
Found 1 data race(s)
exit status 66
FAIL    github.com/g3rk6/gopensslproxy  4.840s

@tsgan
Copy link
Author

tsgan commented Aug 19, 2015

Just some update on Mac OS X.
(Darwin Tsagaankhuus-MacBook-Pro.local 14.4.0 Darwin Kernel Version 14.4.0: Thu May 28 11:35:04 PDT 2015; root:xnu-2782.30.5~1/RELEASE_X86_64 x86_64
Tsagaankhuus-MacBook-Pro:gopensslproxy tsgan$ go version
go version devel +b0b1a66 Mon Apr 27 12:49:54 2015 +0000 darwin/amd64)

Tsagaankhuus-MacBook-Pro:gopensslproxy tsgan$ go test -race
fatal error: unexpected signal during runtime execution
[signal 0xb code=0x1 addr=0x0 pc=0x40056ee]

runtime stack:
runtime.throw(0x4682d30, 0x2a)
    /Users/tsgan/go/src/runtime/panic.go:543 +0x96
runtime.sigpanic()
    /Users/tsgan/go/src/runtime/sigpanic_unix.go:12 +0x5d

goroutine 14 [syscall, locked to thread]:
runtime.cgocall_errno(0x4026080, 0xc20803bd30, 0x0)
    /Users/tsgan/go/src/runtime/cgocall.go:125 +0xc6 fp=0xc20803bd10 sp=0xc20803bce8
github.com/g3rk6/openssl._Cfunc_BIO_new(0x4854b60, 0x0)
    ??:0 +0x5b fp=0xc20803bd30 sp=0xc20803bd10
github.com/g3rk6/openssl.(*readBio).MakeCBIO(0xc2080ef0e0, 0x0)
    /Users/tsgan/goproj/src/github.com/g3rk6/openssl/bio.go:313 +0x3a fp=0xc20803bd50 sp=0xc20803bd30
github.com/g3rk6/openssl.newConn(0x6b05f28, 0xc20802a270, 0xc2080f2500, 0xc20802a270, 0x0, 0x0)
    /Users/tsgan/goproj/src/github.com/g3rk6/openssl/conn.go:140 +0x1d6 fp=0xc20803be20 sp=0xc20803bd50
github.com/g3rk6/openssl.Server(0x6b05f28, 0xc20802a270, 0xc2080f2500, 0x0, 0x0, 0x0)
    /Users/tsgan/goproj/src/github.com/g3rk6/openssl/conn.go:192 +0x56 fp=0xc20803be70 sp=0xc20803be20
github.com/g3rk6/openssl.(*listener).Accept(0xc2080f1be0, 0x6b05f28, 0xc20802a270, 0x0, 0x0)
    /Users/tsgan/goproj/src/github.com/g3rk6/openssl/net.go:32 +0xff fp=0xc20803bed0 sp=0xc20803be70
net/http.(*Server).Serve(0xc2080d3f80, 0x6b05ef0, 0xc2080f1be0, 0x0, 0x0)
    /Users/tsgan/go/src/net/http/server.go:1779 +0xa6 fp=0xc20803bfb8 sp=0xc20803bed0
runtime.goexit()
    /Users/tsgan/go/src/runtime/asm_amd64.s:1674 +0x1 fp=0xc20803bfc0 sp=0xc20803bfb8
created by github.com/g3rk6/gopensslproxy.TestSignerTLS
    /Users/tsgan/goproj/src/github.com/g3rk6/gopensslproxy/signer_test.go:80 +0x6f9

goroutine 1 [chan receive]:
testing.RunTests(0x46eadd8, 0x485b900, 0x18, 0x18, 0x4038b01)
    /Users/tsgan/go/src/testing/testing.go:561 +0xcf2
testing.(*M).Run(0xc2080e1b80, 0x52196c0)
    /Users/tsgan/go/src/testing/testing.go:490 +0xe8
main.main()
    github.com/g3rk6/gopensslproxy/_test/_testmain.go:102 +0x28d

goroutine 17 [syscall, locked to thread]:
runtime.goexit()
    /Users/tsgan/go/src/runtime/asm_amd64.s:1674 +0x1

goroutine 5 [syscall]:
os/signal.loop()
    /Users/tsgan/go/src/os/signal/signal_unix.go:22 +0x2d
created by os/signal.init.1
    /Users/tsgan/go/src/os/signal/signal_unix.go:28 +0x4d

goroutine 10 [IO wait]:
net.runtime_pollWait(0x6b05ad8, 0x72, 0x8)
    /Users/tsgan/go/src/runtime/netpoll.go:157 +0x66
net.(*pollDesc).Wait(0xc2080cfe20, 0x72, 0x0, 0x0)
    /Users/tsgan/go/src/net/fd_poll_runtime.go:73 +0x5d
net.(*pollDesc).WaitRead(0xc2080cfe20, 0x0, 0x0)
    /Users/tsgan/go/src/net/fd_poll_runtime.go:78 +0x4b
net.(*netFD).accept(0xc2080cfdc0, 0x0, 0x6b00050, 0xc20800a200)
    /Users/tsgan/go/src/net/fd_unix.go:386 +0x259
net.(*TCPListener).AcceptTCP(0xc20802a208, 0x4005ba0, 0x0, 0x0)
    /Users/tsgan/go/src/net/tcpsock_posix.go:254 +0x7a
net.(*TCPListener).Accept(0xc20802a208, 0x0, 0x0, 0x0, 0x0)
    /Users/tsgan/go/src/net/tcpsock_posix.go:264 +0x4e
crypto/tls.(*listener).Accept(0xc2080f1a40, 0x0, 0x0, 0x0, 0x0)
    /Users/tsgan/go/src/crypto/tls/tls.go:46 +0x7f
net/http/httptest.(*historyListener).Accept(0xc2080eeb70, 0x0, 0x0, 0x0, 0x0)
    /Users/tsgan/go/src/net/http/httptest/server.go:48 +0x99
net/http.(*Server).Serve(0xc2080d3b00, 0x6b05ce0, 0xc2080eeb70, 0x0, 0x0)
    /Users/tsgan/go/src/net/http/server.go:1779 +0xa6
created by net/http/httptest.(*Server).StartTLS
    /Users/tsgan/go/src/net/http/httptest/server.go:142 +0xc69

goroutine 11 [IO wait]:
net.runtime_pollWait(0x6b05a18, 0x72, 0x8)
    /Users/tsgan/go/src/runtime/netpoll.go:157 +0x66
net.(*pollDesc).Wait(0xc2080ec220, 0x72, 0x0, 0x0)
    /Users/tsgan/go/src/net/fd_poll_runtime.go:73 +0x5d
net.(*pollDesc).WaitRead(0xc2080ec220, 0x0, 0x0)
    /Users/tsgan/go/src/net/fd_poll_runtime.go:78 +0x4b
net.(*netFD).accept(0xc2080ec1c0, 0x0, 0x6b00050, 0xc20800a200)
    /Users/tsgan/go/src/net/fd_unix.go:386 +0x259
net.(*TCPListener).AcceptTCP(0xc20802a210, 0x0, 0x0, 0x0)
    /Users/tsgan/go/src/net/tcpsock_posix.go:254 +0x7a
net.(*TCPListener).Accept(0xc20802a210, 0x0, 0x0, 0x0, 0x0)
    /Users/tsgan/go/src/net/tcpsock_posix.go:264 +0x4e
net/http/httptest.(*historyListener).Accept(0xc2080eec00, 0x0, 0x0, 0x0, 0x0)
    /Users/tsgan/go/src/net/http/httptest/server.go:48 +0x99
net/http.(*Server).Serve(0xc2080d3d40, 0x6b05ce0, 0xc2080eec00, 0x0, 0x0)
    /Users/tsgan/go/src/net/http/server.go:1779 +0xa6
created by net/http/httptest.(*Server).Start
    /Users/tsgan/go/src/net/http/httptest/server.go:109 +0x50d

goroutine 12 [IO wait]:
net.runtime_pollWait(0x6b05958, 0x72, 0x8)
    /Users/tsgan/go/src/runtime/netpoll.go:157 +0x66
net.(*pollDesc).Wait(0xc2080ec290, 0x72, 0x0, 0x0)
    /Users/tsgan/go/src/net/fd_poll_runtime.go:73 +0x5d
net.(*pollDesc).WaitRead(0xc2080ec290, 0x0, 0x0)
    /Users/tsgan/go/src/net/fd_poll_runtime.go:78 +0x4b
net.(*netFD).accept(0xc2080ec230, 0x0, 0x6b00050, 0xc20800a200)
    /Users/tsgan/go/src/net/fd_unix.go:386 +0x259
net.(*TCPListener).AcceptTCP(0xc20802a218, 0x0, 0x0, 0x0)
    /Users/tsgan/go/src/net/tcpsock_posix.go:254 +0x7a
net.(*TCPListener).Accept(0xc20802a218, 0x0, 0x0, 0x0, 0x0)
    /Users/tsgan/go/src/net/tcpsock_posix.go:264 +0x4e
net/http/httptest.(*historyListener).Accept(0xc2080eec90, 0x0, 0x0, 0x0, 0x0)
    /Users/tsgan/go/src/net/http/httptest/server.go:48 +0x99
net/http.(*Server).Serve(0xc2080d3da0, 0x6b05ce0, 0xc2080eec90, 0x0, 0x0)
    /Users/tsgan/go/src/net/http/server.go:1779 +0xa6
created by net/http/httptest.(*Server).Start
    /Users/tsgan/go/src/net/http/httptest/server.go:109 +0x50d

goroutine 13 [runnable]:
net.runtime_pollWait(0x6b057d8, 0x77, 0x8)
    /Users/tsgan/go/src/runtime/netpoll.go:157 +0x66
net.(*pollDesc).Wait(0xc2080ec530, 0x77, 0x0, 0x0)
    /Users/tsgan/go/src/net/fd_poll_runtime.go:73 +0x5d
net.(*pollDesc).WaitWrite(0xc2080ec530, 0x0, 0x0)
    /Users/tsgan/go/src/net/fd_poll_runtime.go:82 +0x4b
net.(*netFD).connect(0xc2080ec4d0, 0x0, 0x0, 0x6b04bb0, 0xc2080f1c80, 0x0, 0x0, 0x0, 0x0, 0x0)
    /Users/tsgan/go/src/net/fd_unix.go:114 +0x24d
net.(*netFD).dial(0xc2080ec4d0, 0x6b04b68, 0x0, 0x6b04b68, 0xc2080ef020, 0x0, 0x0, 0x0, 0x0, 0x0)
    /Users/tsgan/go/src/net/sock_posix.go:137 +0x426
net.socket(0x45f13e0, 0x3, 0x2, 0x1, 0x0, 0xc2080ef000, 0x6b04b68, 0x0, 0x6b04b68, 0xc2080ef020, ...)
    /Users/tsgan/go/src/net/sock_posix.go:89 +0x4f1
net.internetSocket(0x45f13e0, 0x3, 0x6b04b68, 0x0, 0x6b04b68, 0xc2080ef020, 0x0, 0x0, 0x0, 0x1, ...)
    /Users/tsgan/go/src/net/ipsock_posix.go:137 +0x15a
net.dialTCP(0x45f13e0, 0x3, 0x0, 0xc2080ef020, 0x0, 0x0, 0x0, 0x45fd900, 0x0, 0x0)
    /Users/tsgan/go/src/net/tcpsock_posix.go:176 +0x132
net.DialTCP(0x45f13e0, 0x3, 0x0, 0xc2080ef020, 0xc2080ef020, 0x0, 0x0)
    /Users/tsgan/go/src/net/tcpsock_posix.go:172 +0x2b3
github.com/g3rk6/gopensslproxy/transport.(*Transport).dial(0xc2080f24c0, 0x45f13e0, 0x3, 0x4632238, 0xe, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
    /Users/tsgan/goproj/src/github.com/g3rk6/gopensslproxy/transport/transport.go:324 +0x235
github.com/g3rk6/gopensslproxy/transport.(*Transport).getConn(0xc2080f24c0, 0xc2080eef60, 0xc2080eef60, 0x0, 0x0)
    /Users/tsgan/goproj/src/github.com/g3rk6/gopensslproxy/transport/transport.go:339 +0xf4
github.com/g3rk6/gopensslproxy/transport.(*Transport).DetailedRoundTrip(0xc2080f24c0, 0xc20809a680, 0x2, 0xc2080f25c0, 0x0, 0x0)
    /Users/tsgan/goproj/src/github.com/g3rk6/gopensslproxy/transport/transport.go:163 +0x462
github.com/g3rk6/gopensslproxy/transport.(*Transport).RoundTrip(0xc2080f24c0, 0xc20809a680, 0x0, 0x0, 0x0)
    /Users/tsgan/goproj/src/github.com/g3rk6/gopensslproxy/transport/transport.go:174 +0x4e
github.com/g3rk6/gopensslproxy.TestSignerTLS(0xc2080c63f0)
    /Users/tsgan/goproj/src/github.com/g3rk6/gopensslproxy/signer_test.go:89 +0x7ac
testing.tRunner(0xc2080c63f0, 0x485b900)
    /Users/tsgan/go/src/testing/testing.go:452 +0xfd
created by testing.RunTests
    /Users/tsgan/go/src/testing/testing.go:560 +0xc9c
exit status 2
FAIL    github.com/g3rk6/gopensslproxy  2.083s
Tsagaankhuus-MacBook-Pro:gopensslproxy tsgan$

@tsgan
Copy link
Author

tsgan commented Aug 20, 2015

When using go1.3.3 it doesn't crash, it crashes starting from go1.4

@rsc
Copy link
Contributor

rsc commented Nov 5, 2015

This is memory corruption. It is most likely caused by bugs in your program. I'm sorry we don't have a better way to pin down exactly what part of your program causes it, but the usual suspects are uses of unsafe, uses of cgo, uses of unsafe and cgo together, and data races.

At the least we need you to make go test -race work for your code before we can start looking for runtime bugs.

Thanks.

@rsc rsc closed this as completed Nov 5, 2015
@tsgan
Copy link
Author

tsgan commented Nov 5, 2015

Please educate me then why this works for go1.3.3?
thanks

@tsgan
Copy link
Author

tsgan commented Nov 5, 2015

Please educate me then why this works for go1.3.3?

thanks,

On Fri, Nov 6, 2015 at 1:22 AM, Russ Cox notifications@github.com wrote:

Closed #12192 #12192.


Reply to this email directly or view it on GitHub
#12192 (comment).

@ianlancetaylor
Copy link
Member

If the problem is due to some sort of memory corruption, then from our point of view it's not interesting why it works with Go 1.3.3. Memory corruption is unpredictable. Sometimes it works, sometimes it fails. You can track down the specific reason why it works with 1.3.3, but it won't be an interesting reason. It will amount to just being lucky.

@golang golang locked and limited conversation to collaborators Nov 4, 2016
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

6 participants