Menu

Redis SCAN Returned 1,973 Empty Pages and Found All 20 Keys
πŸ“°

Redis SCAN Returned 1,973 Empty Pages and Found All 20 Keys

DEV Community: redisΒ·Vladimir ChemerisΒ·about 2 hours ago
#CAg8z9zl
#devtoredis#devto#dev#keys#redis
Long article (1051 words) β€” no AI summary yet.
Reading 0:00
15s threshold

I build CacheDeck , an iPhone app for checking production Redis during an incident. Its key search had the bug this post measures, and version 1.4.9 fixes it. You won't need the app here: everything below runs in Docker with redis-cli .

I loaded 200,000 cache keys into a Redis container and hid 20 session:* keys among them. Then I asked SCAN for the sessions:

> SCAN 0 MATCH session:* COUNT 100 1 ) "79872" 2 ) ( empty array ) > SCAN 79872 MATCH session:* COUNT 100 1 ) "115200" 2 ) ( empty array ) > SCAN 115200 MATCH session:* COUNT 100 1 ) "173568" 2 ) ( empty array )

Enter fullscreen mode

Exit fullscreen mode

The full pass took 1,993 calls. Of those, 1,973 returned an empty array, and the pass found all 20 keys. A script that stops at the first empty page, or the sixteenth, reports that the keys don't exist.

My setup: the redis:8 image (Redis 8.10.3) in Docker on a Mac mini M4, runs on 18 and 20 November 2026.

An empty page means "call again"

SCAN walks the keyspace in slices.…

Continue reading β€” create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.