andelf / go-curl

golang curl(libcurl) binding.
Apache License 2.0
478 stars 130 forks source link

go test failed !!! #15

Closed wangtuanjie closed 10 years ago

wangtuanjie commented 11 years ago

go test failed , maebe because callback function!! below is info :go test 不过。

go版本 go version go1.1.1 linux/amd64

~/workspace/golang/src/github.com/andelf/go-curl/ [master] go test

unexpected fault address 0xfffff8250c8b4864 fatal error: fault [signal 0xb code=0x1 addr=0xfffff8250c8b4864 pc=0xfffff8250c8b4864]

goroutine 8 [running]: [fp=0x7ff0fdd7ed10] runtime.throw(0x9c79f7) /usr/local/go/src/pkg/runtime/panic.c:473 +0x67 [fp=0x7ff0fdd7ed28] runtime.sigpanic() /usr/local/go/src/pkg/runtime/os_linux.c:239 +0xe7 created by testing.RunTests /usr/local/go/src/pkg/testing/testing.go:433 +0x86b

goroutine 1 [chan receive]: testing.RunTests(0x6c9ec8, 0x9c6300, 0x7, 0x7, 0x66cb01, ...) /usr/local/go/src/pkg/testing/testing.go:434 +0x88e testing.Main(0x6c9ec8, 0x9c6300, 0x7, 0x7, 0x9dc6e0, ...) /usr/local/go/src/pkg/testing/testing.go:365 +0x8a main.main() github.com/andelf/go-curl/_test/_testmain.go:55 +0x9a

goroutine 2 [syscall]:

goroutine 9 [IO wait]: net.runtime_pollWait(0x7ff0fdf17f00, 0x72, 0x0) /usr/local/go/src/pkg/runtime/znetpoll_linux_amd64.c:118 +0x82 net.(_pollDesc).WaitRead(0xc2000bc3e0, 0xb, 0xc2000b2db0) /usr/local/go/src/pkg/net/fd_poll_runtime.go:75 +0x31 net.(_netFD).accept(0xc2000bc360, 0x6c9fd8, 0x0, 0xc2000b2db0, 0xb, ...) /usr/local/go/src/pkg/net/fd_unix.go:385 +0x2c1 net.(_TCPListener).AcceptTCP(0xc200000410, 0x41b278, 0x9ddc30, 0xc2000e9000) /usr/local/go/src/pkg/net/tcpsock_posix.go:229 +0x45 net.(_TCPListener).Accept(0xc200000410, 0x7ff0fdd7dfb0, 0x41b123, 0x6ca008, 0x7ff0fde9bf00, ...) /usr/local/go/src/pkg/net/tcpsock_posix.go:239 +0x25 net/http/httptest.(_historyListener).Accept(0xc2000e32d0, 0x0, 0x0, 0x0, 0x0, ...) /usr/local/go/src/pkg/net/http/httptest/server.go:48 +0x54 net/http.(_Server).Serve(0xc2000a35f0, 0xc20009fc40, 0xc2000e32d0, 0x0, 0x0, ...) /usr/local/go/src/pkg/net/http/server.go:1542 +0x85 created by net/http/httptest.(*Server).Start /usr/local/go/src/pkg/net/http/httptest/server.go:109 +0x21a

goroutine 7 [runnable]: net.runtime_pollWait(0x7ff0fdf17e60, 0x72, 0x0) /usr/local/go/src/pkg/runtime/znetpoll_linux_amd64.c:118 +0x82 net.(_pollDesc).WaitRead(0xc2000bc230, 0xb, 0xc2000b2db0) /usr/local/go/src/pkg/net/fd_poll_runtime.go:75 +0x31 net.(_netFD).Read(0xc2000bc1b0, 0xc2000e2000, 0x1000, 0x1000, 0x0, ...) /usr/local/go/src/pkg/net/fd_unix.go:195 +0x2b3 net.(_conn).Read(0xc200000390, 0xc2000e2000, 0x1000, 0x1000, 0xa, ...) /usr/local/go/src/pkg/net/net.go:123 +0xc3 net/http.(_liveSwitchReader).Read(0xc2000bc268, 0xc2000e2000, 0x1000, 0x1000, 0x1, ...) /usr/local/go/src/pkg/net/http/server.go:205 +0x91 io.(_LimitedReader).Read(0xc2000bb660, 0xc2000e2000, 0x1000, 0x1000, 0x666240, ...) /usr/local/go/src/pkg/io/io.go:394 +0xc0 net/http.(_switchReader).Read(0xc200084820, 0xc2000e2000, 0x1000, 0x1000, 0x0, ...) /usr/local/go/src/pkg/net/http/chunked.go:0 +0x62 bufio.(_Reader).fill(0xc2000c6360) /usr/local/go/src/pkg/bufio/bufio.go:79 +0x10c bufio.(_Reader).ReadSlice(0xc2000c6360, 0x40e20a, 0x0, 0x0, 0x0, ...) /usr/local/go/src/pkg/bufio/bufio.go:262 +0x202 bufio.(_Reader).ReadLine(0xc2000c6360, 0x0, 0x0, 0x0, 0x7ff0fdd6ec00, ...) /usr/local/go/src/pkg/bufio/bufio.go:293 +0x61 net/textproto.(_Reader).readLineSlice(0xc2000e3030, 0xe004a42bb, 0x422a4f, 0xc2000a6680, 0x654500, ...) /usr/local/go/src/pkg/net/textproto/reader.go:55 +0x51 net/textproto.(_Reader).ReadLine(0xc2000e3030, 0xc2000a6680, 0x7ff0fdd6ed6f, 0x10, 0xc200084520, ...) /usr/local/go/src/pkg/net/textproto/reader.go:36 +0x25 net/http.ReadRequest(0xc2000c6360, 0xc2000a6680, 0x0, 0x0) /usr/local/go/src/pkg/net/http/request.go:510 +0x86 net/http.(_conn).readRequest(0xc2000bc240, 0x0, 0x0, 0x0) /usr/local/go/src/pkg/net/http/server.go:547 +0x1bc net/http.(_conn).serve(0xc2000bc240) /usr/local/go/src/pkg/net/http/server.go:1052 +0x398 created by net/http.(_Server).Serve /usr/local/go/src/pkg/net/http/server.go:1564 +0x266

goroutine 10 [runnable]: syscall.Syscall() /usr/local/go/src/pkg/syscall/asm_linux_amd64.s:36 +0x64 syscall.write(0x9, 0xc2000e8000, 0x85, 0x1000, 0x0, ...) /usr/local/go/src/pkg/syscall/zerrors_linux_amd64.go:2717 +0x70 syscall.Write(0x9, 0xc2000e8000, 0x85, 0x1000, 0xc2000e3120, ...) /usr/local/go/src/pkg/syscall/syscall_unix.go:143 +0x5a net.(_netFD).Write(0xc2000bc3f0, 0xc2000e8000, 0x85, 0x1000, 0x0, ...) /usr/local/go/src/pkg/net/fd_unix.go:286 +0x24e net.(_conn).Write(0xc200000448, 0xc2000e8000, 0x85, 0x1000, 0x7ff0fdd7de10, ...) /usr/local/go/src/pkg/net/net.go:131 +0xc3 net/http.(_switchWriter).Write(0xc2000849a0, 0xc2000e8000, 0x85, 0x1000, 0x10, ...) /usr/local/go/src/pkg/net/http/chunked.go:0 +0x62 bufio.(_Writer).Flush(0xc20009fec0, 0xc2000848a0, 0x0) /usr/local/go/src/pkg/bufio/bufio.go:465 +0xb9 net/http.(_response).finishRequest(0xc2000bea10) /usr/local/go/src/pkg/net/http/server.go:931 +0x9c net/http.(_conn).serve(0xc2000bc480) /usr/local/go/src/pkg/net/http/server.go:1100 +0x796 created by net/http.(*Server).Serve /usr/local/go/src/pkg/net/http/server.go:1564 +0x266 exit status 2 FAIL github.com/andelf/go-curl 0.039s

andelf commented 11 years ago

在我这里也是 fail的,跟踪了下发现是perform()执行,然后httptest server handler也被调用,但是这个时候回调函数没被执行。

andelf commented 11 years ago

怀疑是cgo回调go的时候阻塞了go的运行。考虑用别的方式搞搞。。。

davecheney commented 10 years ago

go-curl is broken under Go 1.1 because the function representation is now a two word structure, not just a straight pointer.

anrope commented 10 years ago

There was some discussion on #go-nuts irc, https://botbot.me/freenode/go-nuts/msg/4551111/, leading to a (temporary?) fix: http://pastie.org/8148641

I haven't tested to see if this breaks go 1.0 compatibility.

andelf commented 10 years ago

@anrope @davecheney thank you, I'll try fixing it.

andelf commented 10 years ago

fixed. now works.