Skip to content

fix(redis sink): treat PUBLISH with 0 subscribers as success#25378

Open
gl-pup wants to merge 2 commits intovectordotdev:masterfrom
productsupcom:fix/redis-channel-publish-zero-subscribers-v2
Open

fix(redis sink): treat PUBLISH with 0 subscribers as success#25378
gl-pup wants to merge 2 commits intovectordotdev:masterfrom
productsupcom:fix/redis-channel-publish-zero-subscribers-v2

Conversation

@gl-pup
Copy link
Copy Markdown

@gl-pup gl-pup commented May 6, 2026

Summary

The redis sink using data_type: channel enters an infinite retry loop when a PUBLISH command returns 0 (no subscribers currently connected).

Root cause

Redis PUBLISH returns the number of subscribers that received the message as an integer. When no subscribers are connected, Redis returns :0\r\n. redis-rs deserializes this integer as bool false into Vec<bool>, causing is_successful() to return false, which triggers should_retry_response to return Retry — even though the connection and Redis server are both healthy.

This is fundamentally different from List and SortedSet operations, where a 0 response would indicate a genuine failure (LPUSH/RPUSH always returns the new list length ≥ 1 on success).

Fix

Short-circuit is_successful() to true for DataType::Channel. A zero-subscriber publish is a valid transient state in pub/sub (the consumer may have momentarily dropped its subscription) and must not be treated as an error.

List and SortedSet behavior is unchanged.

Test plan

  • Added redis_channel_publish_zero_subscribers_is_successful: verifies that is_successful() returns true for DataType::Channel when event_status contains false (0 subscribers)
  • Added redis_list_and_sorted_set_still_check_event_status: verifies that List and SortedSet still treat false event status as failure
  • All 8 existing redis sink unit tests continue to pass

@gl-pup gl-pup requested a review from a team as a code owner May 6, 2026 09:40
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 6, 2026

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@github-actions github-actions Bot added the domain: sinks Anything related to the Vector's sinks label May 6, 2026
gl-pup added 2 commits May 6, 2026 16:42
For Channel data_type, Redis PUBLISH returns the number of subscribers
that received the message. When no subscribers are connected (e.g. the
consumer momentarily dropped its subscription), Redis returns 0.

redis-rs deserializes this integer 0 as bool false into Vec<bool>,
causing is_successful() to return false and Vector to retry the same
request indefinitely — even though the connection and Redis are healthy.

Fix: short-circuit is_successful() to true for DataType::Channel.
A zero-subscriber publish is a valid outcome in pub/sub, not an error.
@gl-pup gl-pup force-pushed the fix/redis-channel-publish-zero-subscribers-v2 branch from cc51551 to 39a711c Compare May 6, 2026 09:42
@gl-pup
Copy link
Copy Markdown
Author

gl-pup commented May 6, 2026

I have read the CLA Document and I hereby sign the CLA.

@tanji
Copy link
Copy Markdown

tanji commented May 6, 2026

I have read the CLA Document and I hereby sign the CLA

@gl-pup
Copy link
Copy Markdown
Author

gl-pup commented May 6, 2026

recheck

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

domain: sinks Anything related to the Vector's sinks

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants