Skip to content

deps: pebble crashes when using zstd #1706

@nicktrav

Description

@nicktrav

When upgrading the version of zstd, Pebble crashes at runtime with the following:

panic: pebble: Value has already been added to the cache: refs=0 [recovered]
        panic: pebble: Value has already been added to the cache: refs=0

goroutine 208 [running]:
testing.tRunner.func1.2({0x44b2ac0, 0xc000300100})
        /nix/store/0bh8m4vqb7c7n4sn73ka53yn45yj3zd0-go-1.18.2/share/go/src/testing/testing.go:1389 +0x24e
testing.tRunner.func1()
        /nix/store/0bh8m4vqb7c7n4sn73ka53yn45yj3zd0-go-1.18.2/share/go/src/testing/testing.go:1392 +0x39f
panic({0x44b2ac0, 0xc000300100})
        /nix/store/0bh8m4vqb7c7n4sn73ka53yn45yj3zd0-go-1.18.2/share/go/src/runtime/panic.go:838 +0x207
github.com/cockroachdb/pebble/internal/cache.(*shard).Set(0xc0000d3b68?, 0x4310c25?, 0x600001710040?, 0x1b?, 0x16?)
        /Users/nickt/Development/pebble/internal/cache/clockpro.go:136 +0x365
github.com/cockroachdb/pebble/internal/cache.(*Cache).Set(0x5772c48?, 0x600001710007?, 0x600001710060?, 0x17?, 0x1c?)
        /Users/nickt/Development/pebble/internal/cache/clockpro.go:750 +0x46
github.com/cockroachdb/pebble/sstable.(*Reader).readBlock(0xc0000dd8c0, {0x0?, 0x17?}, 0x0, 0xc00019e5f8)
        /Users/nickt/Development/pebble/sstable/reader.go:2372 +0x617
github.com/cockroachdb/pebble/sstable.(*singleLevelIterator).readBlockWithStats(0xc00019e380, {0x2?, 0x2?}, 0x430699f?)
        /Users/nickt/Development/pebble/sstable/reader.go:406 +0x2f
github.com/cockroachdb/pebble/sstable.(*singleLevelIterator).loadBlock(0xc00019e380)
        /Users/nickt/Development/pebble/sstable/reader.go:388 +0x22a
github.com/cockroachdb/pebble/sstable.(*singleLevelIterator).firstInternal(0xc00019e380)
        /Users/nickt/Development/pebble/sstable/reader.go:786 +0xe7
github.com/cockroachdb/pebble/sstable.(*singleLevelIterator).First(0x0?)
        /Users/nickt/Development/pebble/sstable/reader.go:768 +0x27
github.com/cockroachdb/pebble/sstable.(*compactionIterator).First(0xc0003c02a0)
        /Users/nickt/Development/pebble/sstable/reader.go:1127 +0x58
github.com/cockroachdb/pebble/sstable.testBytesIteratedWithCompression(0xc000511a00, 0x40551ff?, 0x1, {0xc00002c8a0, 0x5, 0x100000001?}, {0xc0000d3f38, 0x5, 0x3351bd6b84e6e?})
        /Users/nickt/Development/pebble/sstable/reader_test.go:495 +0x223
github.com/cockroachdb/pebble/sstable.TestBytesIterated.func3(0x0?)
        /Users/nickt/Development/pebble/sstable/reader_test.go:531 +0x85
testing.tRunner(0xc000511a00, 0xc000088060)
        /nix/store/0bh8m4vqb7c7n4sn73ka53yn45yj3zd0-go-1.18.2/share/go/src/testing/testing.go:1439 +0x102
created by testing.(*T).Run
        /nix/store/0bh8m4vqb7c7n4sn73ka53yn45yj3zd0-go-1.18.2/share/go/src/testing/testing.go:1486 +0x35f

This blocks upgrading the version of zstd that we use.

See #1704 for the diff and reproducer. Note that the issue may have been introduced in a version prior to v1.5.2 (Pebble at the time of writing is at version v1.4.5). I only tested against the latest.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions