sourcegraph / go-webkit2

WebKit API bindings (WebKitGTK+ v2) for Go
https://sourcegraph.com/github.com/sourcegraph/go-webkit2
Other
313 stars 61 forks source link

panic: runtime error: invalid memory address or nil pointer dereference #6

Open FraBle opened 10 years ago

FraBle commented 10 years ago

Hi, I've got an error using webloop with go-webkit2. It happens, if I send a request to the renderer 2 times with a small pause.

panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0xf pc=0x4eacfe]

goroutine 7 [running]:
runtime.panic(0x6f1160, 0xd0bb28)
        /usr/local/go/src/pkg/runtime/panic.c:266 +0xb6
reflect.(*rtype).NumIn(0x0, 0x0)
        /usr/local/go/src/pkg/reflect/type.go:661 +0x1e
reflect.Value.call(0x0, 0xdeaddeaddeaddead, 0x130, 0x74d5b0, 0x4, ...)
        /usr/local/go/src/pkg/reflect/value.go:381 +0x16d
reflect.Value.Call(0x0, 0xdeaddeaddeaddead, 0x130, 0x7f8b7cf71e20, 0x1, ...)
        /usr/local/go/src/pkg/reflect/value.go:345 +0x9d
github.com/sourcegraph/go-webkit2/webkit2._go_gasyncreadycallback_call(0xc2101f8e20, 0x2e04100)
        /home/frable90/goprojects/thirdparty/src/github.com/sourcegraph/go-webkit2/webkit2/gasyncreadycallback.go:20 +0xd4
github.com/sqs/gotk3/gtk._Cfunc_gtk_main(0x484edf)
        github.com/sqs/gotk3/gtk/_obj/_cgo_defun.c:1915 +0x31
github.com/sqs/gotk3/gtk.Main()
        /home/frable90/goprojects/thirdparty/src/github.com/sqs/gotk3/gtk/gtk.go:355 +0x1a
github.com/sourcegraph/webloop.func·001()
        /home/frable90/goprojects/thirdparty/src/github.com/sourcegraph/webloop/static_renderer.go:63 +0x1f
created by github.com/sourcegraph/webloop.func·002
        /home/frable90/goprojects/thirdparty/src/github.com/sourcegraph/webloop/static_renderer.go:64 +0x32

goroutine 1 [IO wait]:
net.runtime_pollWait(0x7f8b8ee376d8, 0x72, 0x0)
        /usr/local/go/src/pkg/runtime/netpoll.goc:116 +0x6a
net.(*pollDesc).Wait(0xc2100a6140, 0x72, 0x7f8b8ee35f88, 0xb)
        /usr/local/go/src/pkg/net/fd_poll_runtime.go:81 +0x34
net.(*pollDesc).WaitRead(0xc2100a6140, 0xb, 0x7f8b8ee35f88)
        /usr/local/go/src/pkg/net/fd_poll_runtime.go:86 +0x30
net.(*netFD).accept(0xc2100a60e0, 0x808d30, 0x0, 0x7f8b8ee35f88, 0xb)
        /usr/local/go/src/pkg/net/fd_unix.go:382 +0x2c2
net.(*TCPListener).AcceptTCP(0xc2100002b0, 0x49a7eb, 0x7f8b7cf5bda0, 0x49a7eb)
        /usr/local/go/src/pkg/net/tcpsock_posix.go:233 +0x47
net.(*TCPListener).Accept(0xc2100002b0, 0x7f8b8ee37780, 0xc210000320, 0xc210058400, 0x0)
        /usr/local/go/src/pkg/net/tcpsock_posix.go:243 +0x27
net/http.(*Server).Serve(0xc21001ec30, 0x7f8b8ee36738, 0xc2100002b0, 0x0, 0x0)
        /usr/local/go/src/pkg/net/http/server.go:1622 +0x91
net/http.(*Server).ListenAndServe(0xc21001ec30, 0xc21001ec30, 0xc21001eaa0)
        /usr/local/go/src/pkg/net/http/server.go:1612 +0xa0
net/http.ListenAndServe(0x74c4d0, 0x5, 0x0, 0x0, 0xc210050a10, ...)
        /usr/local/go/src/pkg/net/http/server.go:1677 +0x6d
main.main()
        /home/frable90/goprojects/myprojects/src/socialvibes/server.go:59 +0x23e

goroutine 3 [syscall]:
runtime.cgocallbackg()
        /usr/local/go/src/pkg/runtime/cgocall.c:267 +0x89
runtime.cgocallback_gofunc(0x0, 0x0, 0x0)
        /usr/local/go/src/pkg/runtime/asm_amd64.s:711 +0x67
runtime.goexit()
        /usr/local/go/src/pkg/runtime/proc.c:1394

goroutine 4 [IO wait]:
net.runtime_pollWait(0x7f8b8ee37630, 0x72, 0x0)
        /usr/local/go/src/pkg/runtime/netpoll.goc:116 +0x6a
net.(*pollDesc).Wait(0xc2100a6300, 0x72, 0x7f8b8ee35f88, 0xb)
        /usr/local/go/src/pkg/net/fd_poll_runtime.go:81 +0x34
net.(*pollDesc).WaitRead(0xc2100a6300, 0xb, 0x7f8b8ee35f88)
        /usr/local/go/src/pkg/net/fd_poll_runtime.go:86 +0x30
net.(*netFD).Read(0xc2100a62a0, 0xc2100a8000, 0x1000, 0x1000, 0x0, ...)
        /usr/local/go/src/pkg/net/fd_unix.go:204 +0x2a0
net.(*conn).Read(0xc2100002d0, 0xc2100a8000, 0x1000, 0x1000, 0xd0fae2, ...)
        /usr/local/go/src/pkg/net/net.go:122 +0xc5
net/http.(*liveSwitchReader).Read(0xc2100583a8, 0xc2100a8000, 0x1000, 0x1000, 0xd0fae2, ...)
        /usr/local/go/src/pkg/net/http/server.go:204 +0xa5
io.(*LimitedReader).Read(0xc21004a860, 0xc2100a8000, 0x1000, 0x1000, 0xd0fae2, ...)
        /usr/local/go/src/pkg/io/io.go:398 +0xbb
bufio.(*Reader).fill(0xc2100385a0)
        /usr/local/go/src/pkg/bufio/bufio.go:91 +0x110
bufio.(*Reader).ReadSlice(0xc2100385a0, 0x10a, 0x0, 0x0, 0x0, ...)
        /usr/local/go/src/pkg/bufio/bufio.go:274 +0x204
bufio.(*Reader).ReadLine(0xc2100385a0, 0x0, 0x0, 0x0, 0x0, ...)
        /usr/local/go/src/pkg/bufio/bufio.go:305 +0x63
net/textproto.(*Reader).readLineSlice(0xc21001df90, 0x7f8b8ee2d000, 0x65d220, 0x7f8b7cf77ce8, 0x43e552, ...)
        /usr/local/go/src/pkg/net/textproto/reader.go:55 +0x61
net/textproto.(*Reader).ReadLine(0xc21001df90, 0xc2100d80d0, 0x0, 0xc2100a9000, 0x7f8b7cf77b6f)
        /usr/local/go/src/pkg/net/textproto/reader.go:36 +0x27
net/http.ReadRequest(0xc2100385a0, 0xc2100d80d0, 0x0, 0x0)
        /usr/local/go/src/pkg/net/http/request.go:526 +0x88
net/http.(*conn).readRequest(0xc210058380, 0x0, 0x0, 0x0)
        /usr/local/go/src/pkg/net/http/server.go:575 +0x1bb
net/http.(*conn).serve(0xc210058380)
        /usr/local/go/src/pkg/net/http/server.go:1123 +0x3b4
created by net/http.(*Server).Serve
        /usr/local/go/src/pkg/net/http/server.go:1644 +0x28b

goroutine 5 [IO wait]:
net.runtime_pollWait(0x7f8b8ee37588, 0x72, 0x0)
        /usr/local/go/src/pkg/runtime/netpoll.goc:116 +0x6a
net.(*pollDesc).Wait(0xc2100a64c0, 0x72, 0x7f8b8ee35f88, 0xb)
        /usr/local/go/src/pkg/net/fd_poll_runtime.go:81 +0x34
net.(*pollDesc).WaitRead(0xc2100a64c0, 0xb, 0x7f8b8ee35f88)
        /usr/local/go/src/pkg/net/fd_poll_runtime.go:86 +0x30
net.(*netFD).Read(0xc2100a6460, 0xc2100ad000, 0x1000, 0x1000, 0x0, ...)
        /usr/local/go/src/pkg/net/fd_unix.go:204 +0x2a0
net.(*conn).Read(0xc210000320, 0xc2100ad000, 0x1000, 0x1000, 0x0, ...)
        /usr/local/go/src/pkg/net/net.go:122 +0xc5
net/http.(*liveSwitchReader).Read(0xc210058428, 0xc2100ad000, 0x1000, 0x1000, 0x0, ...)
        /usr/local/go/src/pkg/net/http/server.go:204 +0xa5
io.(*LimitedReader).Read(0xc21004a8a0, 0xc2100ad000, 0x1000, 0x1000, 0x0, ...)
        /usr/local/go/src/pkg/io/io.go:398 +0xbb
bufio.(*Reader).fill(0xc210038600)
        /usr/local/go/src/pkg/bufio/bufio.go:91 +0x110
bufio.(*Reader).ReadSlice(0xc210038600, 0xa, 0x0, 0x0, 0x0, ...)
        /usr/local/go/src/pkg/bufio/bufio.go:274 +0x204
bufio.(*Reader).ReadLine(0xc210038600, 0x0, 0x0, 0x0, 0x0, ...)
        /usr/local/go/src/pkg/bufio/bufio.go:305 +0x63
net/textproto.(*Reader).readLineSlice(0xc21001d2d0, 0x7f8b8ee2d000, 0x703f20, 0xc21001d2d0, 0x43e552, ...)
        /usr/local/go/src/pkg/net/textproto/reader.go:55 +0x61
net/textproto.(*Reader).ReadLine(0xc21001d2d0, 0xc210036820, 0x0, 0x0, 0x0)
        /usr/local/go/src/pkg/net/textproto/reader.go:36 +0x27
net/http.ReadRequest(0xc210038600, 0xc210036820, 0x0, 0x0)
        /usr/local/go/src/pkg/net/http/request.go:526 +0x88
net/http.(*conn).readRequest(0xc210058400, 0x0, 0x0, 0x0)
        /usr/local/go/src/pkg/net/http/server.go:575 +0x1bb
net/http.(*conn).serve(0xc210058400)
        /usr/local/go/src/pkg/net/http/server.go:1123 +0x3b4
created by net/http.(*Server).Serve
        /usr/local/go/src/pkg/net/http/server.go:1644 +0x28b

goroutine 6 [select]:
github.com/sourcegraph/webloop.(*View).EvaluateJavaScript(0xc2100af180, 0x7b7b90, 0x19, 0x0, 0x0, ...)
        /home/frable90/goprojects/thirdparty/src/github.com/sourcegraph/webloop/webloop.go:124 +0x23d
github.com/sourcegraph/webloop.(*StaticRenderer).ServeHTTP(0xc21004f540, 0x7f8b8ee379d0, 0xc21004aa80, 0xc210036a90)
        /home/frable90/goprojects/thirdparty/src/github.com/sourcegraph/webloop/static_renderer.go:105 +0x7f5
main.GalleryAggregator(0xc21004f413, 0x1b)
        /home/frable90/goprojects/myprojects/src/socialvibes/server.go:186 +0x2c5
created by main.GalleryHandler
        /home/frable90/goprojects/myprojects/src/socialvibes/server.go:72 +0x74

goroutine 8 [syscall]:
runtime.goexit()
        /usr/local/go/src/pkg/runtime/proc.c:1394

goroutine 9 [select]:
github.com/sourcegraph/webloop.(*View).EvaluateJavaScript(0xc2100dc6c0, 0x7b7b90, 0x19, 0x0, 0x0, ...)
        /home/frable90/goprojects/thirdparty/src/github.com/sourcegraph/webloop/webloop.go:124 +0x23d
github.com/sourcegraph/webloop.(*StaticRenderer).ServeHTTP(0xc21004f600, 0x7f8b8ee379d0, 0xc2100dbb40, 0xc2100d81a0)
        /home/frable90/goprojects/thirdparty/src/github.com/sourcegraph/webloop/static_renderer.go:105 +0x7f5
main.GalleryAggregator(0xc21004f5d3, 0x1b)
        /home/frable90/goprojects/myprojects/src/socialvibes/server.go:186 +0x2c5
created by main.GalleryHandler
        /home/frable90/goprojects/myprojects/src/socialvibes/server.go:72 +0x74
FraBle commented 10 years ago

Seems to be related to #2 . I tried again and get the error of #2 .

sqs commented 10 years ago

Hmm. My guess--without having looked at the code in a few weeks--is that it's GCing or removing one of the callback function pointers. I'll try to look into it further this weekend. Let me know if you figure out anything in the meantime.

FraBle commented 10 years ago

:+1: for the fast response, I hope there will be a solution soon :)

FraBle commented 10 years ago

Any update? :)

sqs commented 10 years ago

Really sorry--I have been busy and let this drop. Do you have a consistent repro of this issue? I wasn't able to repro the issue I posted in #2 (but nothing has changed there, so I am certain the issue still exists).

FraBle commented 10 years ago

If I call GalleryAggregator() too often, it just crashes :( [1] https://github.com/FraBle/SocialVibes-ComputeEngine/blob/master/aggregation/aggregator.go

sqs commented 10 years ago

What's the stack trace?

FraBle commented 10 years ago

the stack trace is given in the original post.

sqs commented 10 years ago

Oh, got it.