Skip to content

Fix/add timeout blocking commands#2052

Merged
PavelPashov merged 7 commits intoredis:mainfrom
manast:fix/add-timeout-blocking-commands
Jan 5, 2026
Merged

Fix/add timeout blocking commands#2052
PavelPashov merged 7 commits intoredis:mainfrom
manast:fix/add-timeout-blocking-commands

Conversation

@manast
Copy link
Contributor

@manast manast commented Dec 17, 2025

Fixes #1888

PavelPashov and others added 3 commits December 4, 2025 16:06
- Blocking commands (BLPOP, BRPOP, BZPOPMIN, XREAD, etc.) now resolve
  with `null` when their timeout expires without a response, matching
  Redis behavior and preventing indefinite hangs during undetectable
  network failures

- Added `blockingTimeout` option as a safety net for commands that
  block forever (timeout=0 / BLOCK 0)

- Automatically extracts and tracks timeout from command arguments,
  adding a 100ms grace period for finite timeouts

- Protects commands in both offline queue and command queue with
  absolute deadline tracking

- Simplified setBlockingTimeout API to resolve with null (no callback,
  no error rejection)
@PavelPashov
Copy link
Contributor

Hey @manast, thanks for creating this I’ll look it over when I have time and circle back

@PavelPashov
Copy link
Contributor

Hey @manast, this looks good, but I'm also investigating other possible solutions, I'll have more updates tomorrow and confirm once we have the best way to resolve #1888

Copy link
Member

@bobymicroby bobymicroby left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@PavelPashov PavelPashov merged commit 6ec78be into redis:main Jan 5, 2026
13 checks passed
github-actions bot pushed a commit that referenced this pull request Jan 5, 2026
# [5.9.0](v5.8.2...v5.9.0) (2026-01-05)

### Bug Fixes

* remove unnecessary case-sensitivity when working with commands ([#2036](#2036)) ([f33a2c8](f33a2c8))

### Features

* add timeout blocking commands ([#2052](#2052)) ([6ec78be](6ec78be))
* **cluster:** refactor sharded pub/sub v5 ([#2043](#2043)) ([a523f3a](a523f3a))
@github-actions
Copy link

github-actions bot commented Jan 5, 2026

🎉 This PR is included in version 5.9.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

This was referenced Feb 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BZPOPMIN will hang for ever when a short disconnection happens and the port is different from 6379

3 participants