Skip to content

panic "runtime error: slice bounds out of range" on select commit_message #288

Closed
@akafred

Description

@akafred

This query works fine: select commit_hash from commits: Returned 7564 rows (1.405 seconds)

This query crashes: select commit_hash, commit_message from commits: Query Failed - Internal Server Error

gitbase log says:

time="2018-11-20T21:13:37Z" level=info msg="NewConnection: client 52"
time="2018-11-20T21:13:37Z" level=debug msg="executing query" query="select commit_hash, commit_message\nfrom commits"
time="2018-11-20T21:13:38Z" level=info msg="ConnectionClosed: client 52"

gitbase-web log says:

time="2018-11-20T21:13:38.7156196Z" level=error msg="request complete" http_method=POST http_proto="HTTP/1.1" http_scheme=http panic="runtime error: slice bounds out of range" remote_addr="172.17.0.1:55284" resp_bytes_length=22 resp_elapsed_ms=853.74 resp_status=500 stack="goroutine 242 [running]:
runtime/debug.Stack(0xc420f89588, 0xaad3e0, 0x16251c0)
	/usr/local/go/src/runtime/debug/stack.go:24 +0xa7
github.com/src-d/gitbase-web/vendor/github.com/pressly/lg.RequestLogger.func1.1.1(0xc4201aec40, 0xd90c20, 0xc422c32180, 0xbef53c207358a740, 0x2ecece7dbed, 0x1a80980)
	/go/src/github.com/src-d/gitbase-web/vendor/github.com/pressly/lg/request_logger.go:30 +0x154
panic(0xaad3e0, 0x16251c0)
	/usr/local/go/src/runtime/panic.go:502 +0x229
bytes.(*Buffer).Next(...)
	/usr/local/go/src/bytes/buffer.go:325
github.com/src-d/gitbase-web/server/service.UnmarshalUAST(0xc420aed7b0, 0xe, 0x10, 0xc420aed7b0, 0xe, 0x10, 0xd86760, 0xc421624cc0)
	/go/src/github.com/src-d/gitbase-web/server/service/uast.go:73 +0x5df
github.com/src-d/gitbase-web/server/handler.columnsData(0xc42010afc0, 0x2, 0x2, 0xc42010afe0, 0x2, 0x2, 0xc42010b000, 0x2, 0x2, 0xc422ce2ba0, ...)
	/go/src/github.com/src-d/gitbase-web/server/handler/query.go:229 +0x816
github.com/src-d/gitbase-web/server/handler.Query.func1(0xc420156200, 0x0, 0x0, 0x0)
	/go/src/github.com/src-d/gitbase-web/server/handler/query.go:114 +0x6ae
github.com/src-d/gitbase-web/server/handler.APIHandlerFunc.func1(0x7fb2da5b1880, 0xc422c32180, 0xc420156200)
	/go/src/github.com/src-d/gitbase-web/server/handler/render.go:22 +0x33
net/http.HandlerFunc.ServeHTTP(0xc420a20f30, 0x7fb2da5b1880, 0xc422c32180, 0xc420156200)
	/usr/local/go/src/net/http/server.go:1947 +0x44
github.com/src-d/gitbase-web/vendor/github.com/go-chi/chi.(*Mux).routeHTTP(0xc420a422a0, 0x7fb2da5b1880, 0xc422c32180, 0xc420156200)
	/go/src/github.com/src-d/gitbase-web/vendor/github.com/go-chi/chi/mux.go:424 +0x289
github.com/src-d/gitbase-web/vendor/github.com/go-chi/chi.(*Mux).(github.com/src-d/gitbase-web/vendor/github.com/go-chi/chi.routeHTTP)-fm(0x7fb2da5b1880, 0xc422c32180, 0xc420156200)
	/go/src/github.com/src-d/gitbase-web/vendor/github.com/go-chi/chi/mux.go:368 +0x48
net/http.HandlerFunc.ServeHTTP(0xc420a20f40, 0x7fb2da5b1880, 0xc422c32180, 0xc420156200)
	/usr/local/go/src/net/http/server.go:1947 +0x44
github.com/src-d/gitbase-web/vendor/github.com/pressly/lg.RequestLogger.func1.1(0xd8d5e0, 0xc4215e8000, 0xc420156200)
	/go/src/github.com/src-d/gitbase-web/vendor/github.com/pressly/lg/request_logger.go:39 +0x1c6
net/http.HandlerFunc.ServeHTTP(0xc420a3c6c0, 0xd8d5e0, 0xc4215e8000, 0xc420156100)
	/usr/local/go/src/net/http/server.go:1947 +0x44
github.com/src-d/gitbase-web/vendor/github.com/rs/cors.(*Cors).Handler.func1(0xd8d5e0, 0xc4215e8000, 0xc420156100)
	/go/src/github.com/src-d/gitbase-web/vendor/github.com/rs/cors/cors.go:200 +0xfe
net/http.HandlerFunc.ServeHTTP(0xc420a3c6e0, 0xd8d5e0, 0xc4215e8000, 0xc420156100)
	/usr/local/go/src/net/http/server.go:1947 +0x44
github.com/src-d/gitbase-web/vendor/github.com/go-chi/chi/middleware.Recoverer.func1(0xd8d5e0, 0xc4215e8000, 0xc420156100)
	/go/src/github.com/src-d/gitbase-web/vendor/github.com/go-chi/chi/middleware/recoverer.go:35 +0x9f
net/http.HandlerFunc.ServeHTTP(0xc420a3c700, 0xd8d5e0, 0xc4215e8000, 0xc420156100)
	/usr/local/go/src/net/http/server.go:1947 +0x44
github.com/src-d/gitbase-web/vendor/github.com/go-chi/chi.(*Mux).ServeHTTP(0xc420a422a0, 0xd8d5e0, 0xc4215e8000, 0xc420156e00)
	/go/src/github.com/src-d/gitbase-web/vendor/github.com/go-chi/chi/mux.go:81 +0x221
net/http.serverHandler.ServeHTTP(0xc420a395f0, 0xd8d5e0, 0xc4215e8000, 0xc420156e00)
	/usr/local/go/src/net/http/server.go:2697 +0xbc
net/http.(*conn).serve(0xc42019b2c0, 0xd8dee0, 0xc423a46640)
	/usr/local/go/src/net/http/server.go:1830 +0x651
created by net/http.(*Server).Serve
	/usr/local/go/src/net/http/server.go:2798 +0x27b
" uri="http://localhost:8080/query" user_agent="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3432.0 Safari/537.36"

Steps to reproduce (on Mac):

  1. Install Docker for Mac
  2. Download https://github.com/src-d/engine/releases/download/v0.2.0/engine_v0.2.0_darwin_amd64.tar.gz (on Mac)
  3. Unzip srcd file and put it on PATH
  4. git clone https://github.com/digibib/ls.ext.git
  5. cd ls.ext
  6. srcd init
  7. srcd web sql
  8. in gitbase web verify that select commit_hash from commits works
  9. in gitbase web see select commit_hash, commit_message from commits fails

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions