travisjeffery / jocko

Kafka implemented in Golang with built-in coordination (No ZK dep, single binary install, Cloud Native)
https://twitter.com/travisjeffery
MIT License
4.93k stars 362 forks source link

panic: runtime error: slice bounds out of range #40

Open gooops opened 7 years ago

gooops commented 7 years ago

2017-04-13 22:23:45 [DEBUG] jocko: broker/apply cmd [0] 2017-04-13 22:23:46 [DEBUG] jocko: correlation id [6], request size [29], key [3] 2017-04-13 22:23:46 [DEBUG] jocko: correlation id [0], request size [61], key [1] 2017-04-13 22:23:48 [DEBUG] jocko: correlation id [7], request size [29], key [3] 2017-04-13 22:23:48 [DEBUG] jocko: correlation id [1], request size [61], key [1] 2017-04-13 22:23:50 [DEBUG] jocko: correlation id [8], request size [29], key [3] 2017-04-13 22:23:50 [DEBUG] jocko: correlation id [2], request size [61], key [1] 2017-04-13 22:23:52 [DEBUG] jocko: correlation id [9], request size [29], key [3] 2017-04-13 22:23:52 [DEBUG] jocko: correlation id [3], request size [61], key [1] 2017-04-13 22:23:54 [DEBUG] jocko: correlation id [10], request size [29], key [3] 2017-04-13 22:23:54 [DEBUG] jocko: correlation id [4], request size [61], key [1] 2017-04-13 22:23:54 [DEBUG] jocko: correlation id [0], request size [20], key [3] 2017-04-13 22:23:54 [DEBUG] jocko: correlation id [1], request size [29], key [3] 2017-04-13 22:23:54 [DEBUG] jocko: correlation id [0], request size [238], key [0] panic: runtime error: slice bounds out of range

goroutine 48 [running]: github.com/travisjeffery/jocko/commitlog.(index).WriteAt(0xc4201f43c0, 0xc4201ed0c0, 0x8, 0x40, 0xa00000, 0x0) /mygo/src/github.com/travisjeffery/jocko/commitlog/index.go:137 +0xf8 github.com/travisjeffery/jocko/commitlog.(index).WriteEntry(0xc4201f43c0, 0x12, 0x0, 0xbf, 0xbf) /mygo/src/github.com/travisjeffery/jocko/commitlog/index.go:102 +0x159 github.com/travisjeffery/jocko/commitlog.(CommitLog).Append(0xc420072600, 0xc420092a33, 0xbf, 0xbf, 0x7, 0xc420066e48, 0xc42012e0b8) /mygo/src/github.com/travisjeffery/jocko/commitlog/commitlog.go:130 +0x10f github.com/travisjeffery/jocko.(Partition).Append(0xc420072580, 0xc420092a33, 0xbf, 0xbf, 0xc420072501, 0x0, 0x0) /mygo/src/github.com/travisjeffery/jocko/jocko.go:120 +0x52 github.com/travisjeffery/jocko/server.(Server).handleProduce(0xc420056f00, 0xcd0420, 0xc42000e348, 0xc4201d8f68, 0xc4201f3b60, 0xc420206500, 0x0) /mygo/src/github.com/travisjeffery/jocko/server/server.go:428 +0x2db github.com/travisjeffery/jocko/server.(Server).handleRequest(0xc420056f00, 0xcd0420, 0xc42000e348) /mygo/src/github.com/travisjeffery/jocko/server/server.go:143 +0x8c7 created by github.com/travisjeffery/jocko/server.(*Server).Start.func1 /mygo/src/github.com/travisjeffery/jocko/server/server.go:75 +0x119

mrcrgl commented 7 years ago

It seem to rely on an issue within the commitlog index.

Can be reproduced by:

The issue is propably, that the index is fully allocated at start and persist in a file. This file of the hole size of the index. After reading the file, the index is set to the size of the file. I'll try to get in to understand it correctly.

@travisjeffery do you have some idea of how to set the correct position of the index correctly?