Missing disk-backed overflow-key GET throws NullReferenceException · Issue #2255 · microsoft/garnet · GitHub
Skip to content

Missing disk-backed overflow-key GET throws NullReferenceException #2255

Open

Description

@kokolem

Describe the bug

Garnet 2.2.1 closes the client connection when a missing 1,024-byte key collides with a disk-backed key in the same index bucket and tag. The server logs System.NullReferenceException from ObjectAllocatorImpl.VerifyRecordFromDiskCallback at line 1260.

Steps to reproduce the bug

Start Garnet:

docker run --rm -p 127.0.0.1:6379:6379 \
  ghcr.io/microsoft/garnet:2.2.1 \
  --storage-tier true --index 1m --enable-debug-command yes

In another Bash shell:

prefix="synthetic:$(printf 'x%.0s' {1..982})"
stored="${prefix}87b7bf4eda4f44ccda64f1f5c40c5811"
missing="${prefix}fe6295bee3767698743c3edcf341e7cc"

redis-cli SET "$stored" value
redis-cli DEBUG FLUSHANDEVICT
redis-cli GET "$missing"

SET and DEBUG FLUSHANDEVICT succeed. GET reports:

Error: Server closed the connection

Expected behavior

GET should return a missing-key response without closing the connection.

Release version

2.2.1, official image ghcr.io/microsoft/garnet:2.2.1, digest sha256:05cb9eef041c9151b555eccbd62ce33b0661f8f9c02272cf0d604efb0ec2a143.

IDE

N/A

OS version

Linux x86_64, Docker.

Additional context

The base callback transfers ctx.record to ctx.diskLogRecord, and TransferFrom clears ctx.record. On an overflow-key mismatch, the derived callback then dereferences the cleared buffer.

It appears the previous address should instead be read from the owned record:

prevAddressToRead = ctx.diskLogRecord.Info.PreviousAddress;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions