dragonflydb / dragonflydb/dragonfly

P3 — FLUSHSLOTS TOCTOU between the validation and action hops of a woken multi-stream read

Open
#8,074 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
C++
Stars
31.5k
Forks
1.3k
Avg merge
1d 10h
Merged PRs (30d)
137

Description

The woken blocked read runs a cross-shard validation hop and then an action hop that
revalidates only the wake-key shard (`stream_family.cc:3117-3137`, `3156-3164`);
`FlushSlotsFb()` deletes slot keys in a detached fiber without transaction locks and
yields between chunks (`db_slice.cc:955-985`). A flush landing between the two hops can
delete a sibling stream after it passed validation, so the client is served data from the
ready stream although the other requested group no longer exists.

Impact is benign in practice: under cluster mode both streams share a slot (CROSSSLOT), the
reply legally serializes before the flush acknowledgment, and there is no crash or
replication divergence — listed for completeness. A deterministic test would need a latch
between the two hops.

Contributor guide

Open the contributing guide

Research direction

Read stream_family.cc:3117-3137 and 3156-3164 to trace the validation and action hops, then inspect db_slice.cc:955-985 for FlushSlotsFb()'s detached-fiber behavior. Add a latch between the hops to make the flush race deterministic, and use the test result to establish whether a sibling stream can be served after deletion.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
databases, distributed-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.