allegro / allegro/bigcache

run bench happen panic

Abierto
#285 1 comentario 1 reacción 0 asignados Ver en GitHub
bug
Lenguaje dominante
Go
Estrellas
8.2k
Forks
614
Merge medio
5 d 12 h
PR fusionados (30 d)
1

Descripción

**What is the issue you are having?**

run bench happen panic
```
go test -bench=. -benchmem -benchtime=4s ./... -timeout 30m
```

**Minimal, Complete, and Verifiable Example**
```
E:\code\github\bigcache>go test -bench=. -benchmem -benchtime=4s ./... -timeout 30m
2021/07/28 00:33:28 Allocated new queue in 0s; Capacity: 256044
2021/07/28 00:33:28 Allocated new queue in 0s; Capacity: 512088
2021/07/28 00:33:28 Allocated new queue in 0s; Capacity: 1024176
2021/07/28 00:33:28 Allocated new queue in 0s; Capacity: 88
2021/07/28 00:33:28 Allocated new queue in 0s; Capacity: 585000
2021/07/28 00:33:28 Allocated new queue in 0s; Capacity: 1170000
goos: windows
goarch: amd64
pkg: github.com/allegro/bigcache/v3
cpu: Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz
BenchmarkWriteToCacheWith1Shard-8 7065433 975.0 ns/op 618 B/op 2 allocs/op
BenchmarkWriteToLimitedCacheWithSmallInitSizeAnd1Shard-8 10922888 434.0 ns/op 40 B/op 3 allocs/op
BenchmarkWriteToUnlimitedCacheWithSmallInitSizeAnd1Shard-8 4877270 3916 ns/op 2832 B/op 2 allocs/op
BenchmarkWriteToCache/1-shards-8 5296270 1024 ns/op 595 B/op 3 allocs/op
BenchmarkWriteToCache/512-shards-8 21498430 1795 ns/op 595 B/op 3 allocs/op
BenchmarkWriteToCache/1024-shards-8 1000000 4101 ns/op 619 B/op 3 allocs/op
BenchmarkWriteToCache/8192-shards-8 19716784 1304 ns/op 603 B/op 3 allocs/op
BenchmarkAppendToCache/1-shards-8 253966 20777 ns/op 14109 B/op 2 allocs/op
BenchmarkAppendToCache/512-shards-8 857107 34833 ns/op 14133 B/op 3 allocs/op
BenchmarkAppendToCache/1024-shards-8 211172 22244 ns/op 15587 B/op 3 allocs/op
BenchmarkAppendToCache/8192-shards-8 430000 23187 ns/op 19209 B/op 3 allocs/op
BenchmarkReadFromCache/1-shards-8 panic: runtime error: slice bounds out of range [16:0]

goroutine 654 [running]:
github.com/allegro/bigcache/v3.readKeyFromEntry(...)
E:/code/github/bigcache/encoding.go:62
github.com/allegro/bigcache/v3.(*cacheShard).get(0xc02cc727e0, 0xc0b6fbe4c0, 0x8, 0xa9902f30c0173fa6, 0x0, 0x0, 0x0, 0xc0b6fbe4c0, 0x8)
E:/code/github/bigcache/shard.go:69 +0x617
github.com/allegro/bigcache/v3.(*BigCache).Get(0xc0000201a0, 0xc0b6fbe4c0, 0x8, 0x8, 0x0, 0x0, 0xe81948, 0xc0000443f0)
E:/code/github/bigcache/bigcache.go:119 +0x92
github.com/allegro/bigcache/v3.readFromCache.func1(0xc0b6fbc000)
E:/code/github/bigcache/bigcache_bench_test.go:187 +0x14a
testing.(*B).RunParallel.func1(0xc0b71ca5e0, 0xc0b71ca5d8, 0xc0b71ca5d0, 0xc0a9026240, 0xc0006e2180)
C:/Program Files/Go/src/testing/benchmark.go:779 +0xa5
created by testing.(*B).RunParallel
C:/Program Files/Go/src/testing/benchmark.go:772 +0x19e
panic: runtime error: slice bounds out of range [16:0]

goroutine 653 [running]:
github.com/allegro/bigcache/v3.readKeyFromEntry(...)
E:/code/github/bigcache/encoding.go:62
github.com/allegro/bigcache/v3.(*cacheShard).get(0xc02cc727e0, 0xc0b7132600, 0x8, 0x5de30a872469a8a8, 0x0, 0x0, 0x0, 0xc0b7132600, 0x8)
E:/code/github/bigcache/shard.go:69 +0x617
github.com/allegro/bigcache/v3.(*BigCache).Get(0xc0000201a0, 0xc0b7132600, 0x8, 0x8, 0x0, 0x0, 0xe81948, 0xc0000443f0)
E:/code/github/bigcache/bigcache.go:119 +0x92
github.com/allegro/bigcache/v3.readFromCache.func1(0xc0b7130000)
E:/code/github/bigcache/bigcache_bench_test.go:187 +0x14a
testing.(*B).RunParallel.func1(0xc0b71ca5e0, 0xc0b71ca5d8, 0xc0b71ca5d0, 0xc0a9026240, 0xc0006e2180)
C:/Program Files/Go/src/testing/benchmark.go:779 +0xa5
created by testing.(*B).RunParallel
C:/Program Files/Go/src/testing/benchmark.go:772 +0x19e
panic: runtime error: slice bounds out of range [16:0]

goroutine 651 [running]:
github.com/allegro/bigcache/v3.readKeyFromEntry(...)
E:/code/github/bigcache/encoding.go:62
github.com/allegro/bigcache/v3.(*cacheShard).get(0xc02cc727e0, 0xc0b7044ac0, 0x8, 0x6184bb604bb7176f, 0x0, 0x0, 0x0, 0xc0b7044ac0, 0x8)
E:/code/github/bigcache/shard.go:69 +0x617
github.com/allegro/bigcache/v3.(*BigCache).Get(0xc0000201a0, 0xc0b7044ac0, 0x8, 0x8, 0x100, 0x100, 0x0, 0x0)
E:/code/github/bigcache/bigcache.go:119 +0x92
github.com/allegro/bigcache/v3.readFromCache.func1(0xc0b7042000)
E:/code/github/bigcache/bigcache_bench_test.go:187 +0x14a
testing.(*B).RunParallel.func1(0xc0b71ca5e0, 0xc0b71ca5d8, 0xc0b71ca5d0, 0xc0a9026240, 0xc0006e2180)
C:/Program Files/Go/src/testing/benchmark.go:779 +0xa5
created by testing.(*B).RunParallel
C:/Program Files/Go/src/testing/benchmark.go:772 +0x19e
panic: runtime error: slice bounds out of range [16:0]

goroutine 655 [running]:
github.com/allegro/bigcache/v3.readKeyFromEntry(...)
E:/code/github/bigcache/encoding.go:62
github.com/allegro/bigcache/v3.(*cacheShard).get(0xc02cc727e0, 0xc0b70be0c8, 0x8, 0x5eaad9c5baa7297, 0x0, 0x0, 0x0, 0xc0b70be0c8, 0x8)
E:/code/github/bigcache/shard.go:69 +0x617
github.com/allegro/bigcache/v3.(*BigCache).Get(0xc0000201a0, 0xc0b70be0c8, 0x8, 0x8, 0x0, 0x0, 0xe81948, 0xc0000443f0)
E:/code/github/bigcache/bigcache.go:119 +0x92
github.com/allegro/bigcache/v3.readFromCache.func1(0xc0b70bc000)
E:/code/github/bigcache/bigcache_bench_test.go:187 +0x14a
testing.(*B).RunParallel.func1(0xc0b71ca5e0, 0xc0b71ca5d8, 0xc0b71ca5d0, 0xc0a9026240, 0xc0006e2180)
C:/Program Files/Go/src/testing/benchmark.go:779 +0xa5
created by testing.(*B).RunParallel
C:/Program Files/Go/src/testing/benchmark.go:772 +0x19e
panic: runtime error: slice bounds out of range [16:0]

goroutine 652 [running]:
github.com/allegro/bigcache/v3.readKeyFromEntry(...)
E:/code/github/bigcache/encoding.go:62
github.com/allegro/bigcache/v3.(*cacheShard).get(0xc02cc727e0, 0xc0b6eee900, 0x8, 0x8935f021031cfad9, 0x0, 0x0, 0x0, 0xc0b6eee900, 0x8)
E:/code/github/bigcache/shard.go:69 +0x617
github.com/allegro/bigcache/v3.(*BigCache).Get(0xc0000201a0, 0xc0b6eee900, 0x8, 0x8, 0x100, 0x100, 0x0, 0x0)
E:/code/github/bigcache/bigcache.go:119 +0x92
github.com/allegro/bigcache/v3.readFromCache.func1(0xc000046440)
E:/code/github/bigcache/bigcache_bench_test.go:187 +0x14a
testing.(*B).RunParallel.func1(0xc0b71ca5e0, 0xc0b71ca5d8, 0xc0b71ca5d0, 0xc0a9026240, 0xc0006e2180)
C:/Program Files/Go/src/testing/benchmark.go:779 +0xa5
created by testing.(*B).RunParallel
C:/Program Files/Go/src/testing/benchmark.go:772 +0x19e
panic: runtime error: slice bounds out of range [16:0]

goroutine 650 [running]:
github.com/allegro/bigcache/v3.readKeyFromEntry(...)
E:/code/github/bigcache/encoding.go:62
github.com/allegro/bigcache/v3.(*cacheShard).get(0xc02cc727e0, 0xc0b6f5e740, 0x8, 0xc15c4a05184e2e9c, 0x0, 0x0, 0x0, 0xc0b6f5e740, 0x8)
E:/code/github/bigcache/shard.go:69 +0x617
github.com/allegro/bigcache/v3.(*BigCache).Get(0xc0000201a0, 0xc0b6f5e740, 0x8, 0x8, 0x0, 0x0, 0xe81948, 0xc0000443f0)
E:/code/github/bigcache/bigcache.go:119 +0x92
github.com/allegro/bigcache/v3.readFromCache.func1(0xc03ad58000)
E:/code/github/bigcache/bigcache_bench_test.go:187 +0x14a
testing.(*B).RunParallel.func1(0xc0b71ca5e0, 0xc0b71ca5d8, 0xc0b71ca5d0, 0xc0a9026240, 0xc0006e2180)
C:/Program Files/Go/src/testing/benchmark.go:779 +0xa5
created by testing.(*B).RunParallel
C:/Program Files/Go/src/testing/benchmark.go:772 +0x19e
panic: runtime error: slice bounds out of range [16:0]

goroutine 656 [running]:
github.com/allegro/bigcache/v3.readKeyFromEntry(...)
E:/code/github/bigcache/encoding.go:62
github.com/allegro/bigcache/v3.(*cacheShard).get(0xc02cc727e0, 0xc0b71cb2b8, 0x8, 0xe04c9623b5dbb2bb, 0x0, 0x0, 0x0, 0xc0b71cb2b8, 0x8)
E:/code/github/bigcache/shard.go:69 +0x617
github.com/allegro/bigcache/v3.(*BigCache).Get(0xc0000201a0, 0xc0b71cb2b8, 0x8, 0x8, 0x100, 0x100, 0x0, 0x0)
E:/code/github/bigcache/bigcache.go:119 +0x92
github.com/allegro/bigcache/v3.readFromCache.func1(0xc0006e21a0)
E:/code/github/bigcache/bigcache_bench_test.go:187 +0x14a
testing.(*B).RunParallel.func1(0xc0b71ca5e0, 0xc0b71ca5d8, 0xc0b71ca5d0, 0xc0a9026240, 0xc0006e2180)
C:/Program Files/Go/src/testing/benchmark.go:779 +0xa5
created by testing.(*B).RunParallel
C:/Program Files/Go/src/testing/benchmark.go:772 +0x19e
exit status 2
FAIL github.com/allegro/bigcache/v3 227.442s
2021/07/28 00:37:24 Allocated new queue in 0s; Capacity: 18
2021/07/28 00:37:24 Allocated new queue in 0s; Capacity: 18
PASS
ok github.com/allegro/bigcache/v3/queue 6.892s
2021/07/28 00:37:30 Entry not found
2021/07/28 00:37:31 stored "testkey" in cache.
2021/07/28 00:37:31 empty request.
2021/07/28 00:37:31 test read error
2021/07/28 00:37:31 empty request.
2021/07/28 00:37:31 not found.
2021/07/28 00:37:31 Entry not found
2021/07/28 00:37:31 stored "putKey" in cache.
2021/07/28 00:37:31 invalidDeleteKey not found.
2021/07/28 00:37:31 entry is bigger than max shard size
PASS
ok github.com/allegro/bigcache/v3/server 4.894s
FAIL

```

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.