Description
We need a way to either create a bucket synchronously or for the client to recognize a bucket is still being created and wait for it to finish before completing the bucket connection process. See the crash dump below and the test file I have attached to re-create the scenario.
panic: runtime error: integer divide by zero
[signal 0x8 code=0x7 addr=0xc817c pc=0xc817c]
goroutine 1 [running]:
github.com/couchbaselabs/gocb/gocbcore.(*Agent).routeRequest(0xc208052870, 0xc20804c630, 0xc20800aed0)
/Users/mikewied/open_source/go_workspace/src/github.com/couchbaselabs/gocb/gocbcore/agentrouting.go:324 +0x19c
github.com/couchbaselabs/gocb/gocbcore.(*Agent).dispatchDirect(0xc208052870, 0xc20804c630, 0x0, 0x0)
/Users/mikewied/open_source/go_workspace/src/github.com/couchbaselabs/gocb/gocbcore/agentrouting.go:340 +0x44
github.com/couchbaselabs/gocb/gocbcore.(*Agent).dispatchOp(0xc208052870, 0xc20804c630, 0x0, 0x0, 0x0, 0x0)
/Users/mikewied/open_source/go_workspace/src/github.com/couchbaselabs/gocb/gocbcore/agentops.go:29 +0x56
github.com/couchbaselabs/gocb/gocbcore.(*Agent).store(0xc208052870, 0x2, 0xc20800ac98, 0x4, 0x8, 0xc20807c024, 0x7, 0x40, 0xc202000000, 0x0, ...)
/Users/mikewied/open_source/go_workspace/src/github.com/couchbaselabs/gocb/gocbcore/agentops.go:293 +0x376
github.com/couchbaselabs/gocb/gocbcore.(*Agent).Add(0xc208052870, 0xc20800ac98, 0x4, 0x8, 0xc20807c024, 0x7, 0x40, 0x2000000, 0xc20801e620, 0x0, ...)
/Users/mikewied/open_source/go_workspace/src/github.com/couchbaselabs/gocb/gocbcore/agentops.go:297 +0xdd
github.com/couchbaselabs/gocb.func·012(0xc20801e620, 0x0, 0x0, 0x0, 0x0)
/Users/mikewied/open_source/go_workspace/src/github.com/couchbaselabs/gocb/bucket_crud.go:173 +0xee
github.com/couchbaselabs/gocb.(*Bucket).hlpCasExec(0xc208052050, 0xc208091e50, 0x0, 0x0, 0x0)
/Users/mikewied/open_source/go_workspace/src/github.com/couchbaselabs/gocb/bucket_crud.go:51 +0x175
github.com/couchbaselabs/gocb.(*Bucket).Insert(0xc208052050, 0xc20800ab90, 0x4, 0x25e260, 0xc20803aa80, 0x0, 0x0, 0x0, 0x0)
/Users/mikewied/open_source/go_workspace/src/github.com/couchbaselabs/gocb/bucket_crud.go:175 +0x156
main.loadData(0x1388)
/Users/mikewied/open_source/go_workspace/src/github.com/mikewied/backup/cmd/test/main.go:28 +0x4c0
main.main()
/Users/mikewied/open_source/go_workspace/src/github.com/mikewied/backup/cmd/test/main.go:75 +0x35
goroutine 6 [IO wait]:
net.(*pollDesc).Wait(0xc208011720, 0x72, 0x0, 0x0)
/usr/local/Cellar/go/1.4/libexec/src/net/fd_poll_runtime.go:84 +0x47
net.(*pollDesc).WaitRead(0xc208011720, 0x0, 0x0)
/usr/local/Cellar/go/1.4/libexec/src/net/fd_poll_runtime.go:89 +0x43
net.(*netFD).Read(0xc2080116c0, 0xc20800f000, 0x1000, 0x1000, 0x0, 0x58e9e0, 0xc20800add8)
/usr/local/Cellar/go/1.4/libexec/src/net/fd_unix.go:242 +0x40f
net.(*conn).Read(0xc20802c080, 0xc20800f000, 0x1000, 0x1000, 0x0, 0x0, 0x0)
/usr/local/Cellar/go/1.4/libexec/src/net/net.go:121 +0xdc
net/http.noteEOFReader.Read(0x58fed8, 0xc20802c080, 0xc20807c108, 0xc20800f000, 0x1000, 0x1000, 0x2a53c0, 0x0, 0x0)
/usr/local/Cellar/go/1.4/libexec/src/net/http/transport.go:1270 +0x6e
net/http.(*noteEOFReader).Read(0xc20801e900, 0xc20800f000, 0x1000, 0x1000, 0xc208012000, 0x0, 0x0)
<autogenerated>:125 +0xd4
bufio.(*Reader).fill(0xc2080503c0)
/usr/local/Cellar/go/1.4/libexec/src/bufio/bufio.go:97 +0x1ce
bufio.(*Reader).Peek(0xc2080503c0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0)
/usr/local/Cellar/go/1.4/libexec/src/bufio/bufio.go:132 +0xf0
net/http.(*persistConn).readLoop(0xc20807c0b0)
/usr/local/Cellar/go/1.4/libexec/src/net/http/transport.go:842 +0xa4
created by net/http.(*Transport).dialConn
/usr/local/Cellar/go/1.4/libexec/src/net/http/transport.go:660 +0xc9f
goroutine 7 [select]:
net/http.(*persistConn).writeLoop(0xc20807c0b0)
/usr/local/Cellar/go/1.4/libexec/src/net/http/transport.go:945 +0x41d
created by net/http.(*Transport).dialConn
/usr/local/Cellar/go/1.4/libexec/src/net/http/transport.go:661 +0xcbc
goroutine 9 [IO wait]:
net.(*pollDesc).Wait(0xc208086fb0, 0x72, 0x0, 0x0)
/usr/local/Cellar/go/1.4/libexec/src/net/fd_poll_runtime.go:84 +0x47
net.(*pollDesc).WaitRead(0xc208086fb0, 0x0, 0x0)
/usr/local/Cellar/go/1.4/libexec/src/net/fd_poll_runtime.go:89 +0x43
net.(*netFD).Read(0xc208086f50, 0xc208083000, 0x1000, 0x1000, 0x0, 0x58e9e0, 0xc20800a8d0)
/usr/local/Cellar/go/1.4/libexec/src/net/fd_unix.go:242 +0x40f
net.(*conn).Read(0xc20802c110, 0xc208083000, 0x1000, 0x1000, 0x0, 0x0, 0x0)
/usr/local/Cellar/go/1.4/libexec/src/net/net.go:121 +0xdc
net/http.noteEOFReader.Read(0x58fed8, 0xc20802c110, 0xc20807c318, 0xc208083000, 0x1000, 0x1000, 0xc20802a300, 0x0, 0x0)
/usr/local/Cellar/go/1.4/libexec/src/net/http/transport.go:1270 +0x6e
net/http.(*noteEOFReader).Read(0xc20801ef80, 0xc208083000, 0x1000, 0x1000, 0xc208012000, 0x0, 0x0)
<autogenerated>:125 +0xd4
bufio.(*Reader).fill(0xc208050900)
/usr/local/Cellar/go/1.4/libexec/src/bufio/bufio.go:97 +0x1ce
bufio.(*Reader).Peek(0xc208050900, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0)
/usr/local/Cellar/go/1.4/libexec/src/bufio/bufio.go:132 +0xf0
net/http.(*persistConn).readLoop(0xc20807c2c0)
/usr/local/Cellar/go/1.4/libexec/src/net/http/transport.go:842 +0xa4
created by net/http.(*Transport).dialConn
/usr/local/Cellar/go/1.4/libexec/src/net/http/transport.go:660 +0xc9f
goroutine 10 [select]:
net/http.(*persistConn).writeLoop(0xc20807c2c0)
/usr/local/Cellar/go/1.4/libexec/src/net/http/transport.go:945 +0x41d
created by net/http.(*Transport).dialConn
/usr/local/Cellar/go/1.4/libexec/src/net/http/transport.go:661 +0xcbc
goroutine 12 [IO wait]:
net.(*pollDesc).Wait(0xc2080879c0, 0x72, 0x0, 0x0)
/usr/local/Cellar/go/1.4/libexec/src/net/fd_poll_runtime.go:84 +0x47
net.(*pollDesc).WaitRead(0xc2080879c0, 0x0, 0x0)
/usr/local/Cellar/go/1.4/libexec/src/net/fd_poll_runtime.go:89 +0x43
net.(*netFD).Read(0xc208087960, 0xc208089000, 0x1000, 0x1000, 0x0, 0x58e9e0, 0xc20800b0c0)
/usr/local/Cellar/go/1.4/libexec/src/net/fd_unix.go:242 +0x40f
net.(*conn).Read(0xc20802c0e8, 0xc208089000, 0x1000, 0x1000, 0x0, 0x0, 0x0)
/usr/local/Cellar/go/1.4/libexec/src/net/net.go:121 +0xdc
net/http.noteEOFReader.Read(0x58fed8, 0xc20802c0e8, 0xc20807c3c8, 0xc208089000, 0x1000, 0x1000, 0xd9, 0x0, 0x0)
/usr/local/Cellar/go/1.4/libexec/src/net/http/transport.go:1270 +0x6e
net/http.(*noteEOFReader).Read(0xc20801eac0, 0xc208089000, 0x1000, 0x1000, 0x0, 0x0, 0x0)
<autogenerated>:125 +0xd4
bufio.(*Reader).fill(0xc208050b40)
/usr/local/Cellar/go/1.4/libexec/src/bufio/bufio.go:97 +0x1ce
bufio.(*Reader).ReadSlice(0xc208050b40, 0xa, 0x0, 0x0, 0x0, 0x0, 0x0)
/usr/local/Cellar/go/1.4/libexec/src/bufio/bufio.go:295 +0x257
net/http/internal.readLine(0xc208050b40, 0x0, 0x0, 0x0, 0x0, 0x0)
/usr/local/Cellar/go/1.4/libexec/src/net/http/internal/chunked.go:110 +0x5a
net/http/internal.(*chunkedReader).beginChunk(0xc20803b1a0)
/usr/local/Cellar/go/1.4/libexec/src/net/http/internal/chunked.go:47 +0x46
net/http/internal.(*chunkedReader).Read(0xc20803b1a0, 0xc20809d004, 0xdfc, 0xdfc, 0x0, 0x0, 0x0)
/usr/local/Cellar/go/1.4/libexec/src/net/http/internal/chunked.go:77 +0xbb
net/http.(*body).readLocked(0xc20802a8c0, 0xc20809d004, 0xdfc, 0xdfc, 0xffffffff, 0x0, 0x0)
/usr/local/Cellar/go/1.4/libexec/src/net/http/transfer.go:584 +0x7a
net/http.(*body).Read(0xc20802a8c0, 0xc20809d004, 0xdfc, 0xdfc, 0x0, 0x0, 0x0)
/usr/local/Cellar/go/1.4/libexec/src/net/http/transfer.go:579 +0x115
net/http.(*bodyEOFSignal).Read(0xc20802a900, 0xc20809d004, 0xdfc, 0xdfc, 0x0, 0x0, 0x0)
/usr/local/Cellar/go/1.4/libexec/src/net/http/transport.go:1193 +0x285
encoding/json.(*Decoder).readValue(0xc20809e000, 0xc901b, 0x0, 0x0)
/usr/local/Cellar/go/1.4/libexec/src/encoding/json/stream.go:124 +0x5e1
encoding/json.(*Decoder).Decode(0xc20809e000, 0x2c5780, 0xc20801e000, 0x0, 0x0)
/usr/local/Cellar/go/1.4/libexec/src/encoding/json/stream.go:44 +0x7b
github.com/couchbaselabs/gocb/gocbcore.(*Agent).httpLooper(0xc208052870, 0xc20801e9c0)
/Users/mikewied/open_source/go_workspace/src/github.com/couchbaselabs/gocb/gocbcore/agenthttpcfg.go:119 +0xef5
created by github.com/couchbaselabs/gocb/gocbcore.(*Agent).connect
/Users/mikewied/open_source/go_workspace/src/github.com/couchbaselabs/gocb/gocbcore/agent.go:188 +0xa80
goroutine 16 [chan receive]:
github.com/couchbaselabs/gocb/gocbcore.func·006()
/Users/mikewied/open_source/go_workspace/src/github.com/couchbaselabs/gocb/gocbcore/agenthttpcfg.go:111 +0x56
created by github.com/couchbaselabs/gocb/gocbcore.(*Agent).httpLooper
/Users/mikewied/open_source/go_workspace/src/github.com/couchbaselabs/gocb/gocbcore/agenthttpcfg.go:114 +0xdd1
goroutine 14 [select]:
net/http.(*persistConn).readLoop(0xc20807c370)
/usr/local/Cellar/go/1.4/libexec/src/net/http/transport.go:928 +0x9ce
created by net/http.(*Transport).dialConn
/usr/local/Cellar/go/1.4/libexec/src/net/http/transport.go:660 +0xc9f
goroutine 15 [select]:
net/http.(*persistConn).writeLoop(0xc20807c370)
/usr/local/Cellar/go/1.4/libexec/src/net/http/transport.go:945 +0x41d
created by net/http.(*Transport).dialConn
/usr/local/Cellar/go/1.4/libexec/src/net/http/transport.go:661 +0xcbc
goroutine 17 [runnable]:
github.com/couchbaselabs/gocb/gocbcore.func·021()
/Users/mikewied/open_source/go_workspace/src/github.com/couchbaselabs/gocb/gocbcore/agentrouting.go:257
created by github.com/couchbaselabs/gocb/gocbcore.(*Agent).applyConfig
/Users/mikewied/open_source/go_workspace/src/github.com/couchbaselabs/gocb/gocbcore/agentrouting.go:264 +0xc5c