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

SG panics if _bulk_docs is passed empty JSON object #1027

Closed
ajres opened this issue Aug 4, 2015 · 0 comments
Closed

SG panics if _bulk_docs is passed empty JSON object #1027

ajres opened this issue Aug 4, 2015 · 0 comments
Assignees
Labels
Milestone

Comments

@ajres
Copy link

ajres commented Aug 4, 2015

While trying to repo #1026, found that SG will panic if an empty JSON object is passed to _bulk_docs

curl -H "Content-Type: application/json" -d '{}' -X POST "http://localhost:4985/db/_bulk_docs?revs=true&attachments=true"
2015-08-04T14:55:56.292+01:00 HTTP:  #002: POST /db/_bulk_get?revs=true&attachments=true  (ADMIN)
2015/08/04 14:55:56 http: panic serving 127.0.0.1:55514: interface conversion: interface is nil, not []interface {}
goroutine 50 [running]:
net/http.func·011()
    /usr/local/go/src/net/http/server.go:1130 +0xbb
github.com/couchbase/sync_gateway/rest.func·005(0xc2081bcba0, 0x0, 0x0)
    /Users/andy/Projects/sync_gateway/src/github.com/couchbase/sync_gateway/rest/bulk_api.go:307 +0xf1
github.com/couchbase/sync_gateway/rest.(*handler).writeMultipart(0xc20805e1b0, 0x6ff8e0, 0x5, 0xc20827b8b8, 0x0, 0x0)
    /Users/andy/Projects/sync_gateway/src/github.com/couchbase/sync_gateway/rest/handler.go:463 +0x38d
github.com/couchbase/sync_gateway/rest.(*handler).handleBulkGet(0xc20805e1b0, 0x0, 0x0)
    /Users/andy/Projects/sync_gateway/src/github.com/couchbase/sync_gateway/rest/bulk_api.go:360 +0x1b0
github.com/couchbase/sync_gateway/rest.(*handler).invoke(0xc20805e1b0, 0x997560, 0x0, 0x0)
    /Users/andy/Projects/sync_gateway/src/github.com/couchbase/sync_gateway/rest/handler.go:159 +0x4b8
github.com/couchbase/sync_gateway/rest.func·015(0xe37c78, 0xc208228140, 0xc2080e80d0)
    /Users/andy/Projects/sync_gateway/src/github.com/couchbase/sync_gateway/rest/handler.go:86 +0x7d
net/http.HandlerFunc.ServeHTTP(0xc208199040, 0xe37c78, 0xc208228140, 0xc2080e80d0)
    /usr/local/go/src/net/http/server.go:1265 +0x41
github.com/gorilla/mux.(*Router).ServeHTTP(0xc2081664b0, 0xe37c78, 0xc208228140, 0xc2080e80d0)
    /Users/andy/Projects/sync_gateway/src/github.com/gorilla/mux/mux.go:86 +0x29e
github.com/couchbase/sync_gateway/rest.func·017(0xe37c78, 0xc208228140, 0xc2080e80d0)
    /Users/andy/Projects/sync_gateway/src/github.com/couchbase/sync_gateway/rest/routing.go:240 +0x32f
net/http.HandlerFunc.ServeHTTP(0xc208236100, 0xe37c78, 0xc208228140, 0xc2080e80d0)
    /usr/local/go/src/net/http/server.go:1265 +0x41
net/http.serverHandler.ServeHTTP(0xc208248000, 0xe37c78, 0xc208228140, 0xc2080e80d0)
    /usr/local/go/src/net/http/server.go:1703 +0x19a
net/http.(*conn).serve(0xc2082521e0)
    /usr/local/go/src/net/http/server.go:1204 +0xb57
created by net/http.(*Server).Serve
    /usr/local/go/src/net/http/server.go:1751 +0x35e
@ajres ajres changed the title panic is _bulk_docs is passed empty JSON object SG panics if _bulk_docs is passed empty JSON object Aug 4, 2015
@ajres ajres added the bug label Aug 4, 2015
@ajres ajres added this to the 1.1.1 milestone Aug 4, 2015
@ajres ajres self-assigned this Aug 4, 2015
@ajres ajres added review and removed in progress labels Aug 5, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants