Add Redis Pub/Sub bug tracking and test endpoint#85
Closed
sohankshirsagar wants to merge 1 commit intomainfrom
Closed
Add Redis Pub/Sub bug tracking and test endpoint#85sohankshirsagar wants to merge 1 commit intomainfrom
sohankshirsagar wants to merge 1 commit intomainfrom
Conversation
Found 1 confirmed bug: PubSub.execute_command() is not patched by the Redis instrumentation. The PubSub class has its own execute_command() method separate from Redis.execute_command(), so pub/sub operations (subscribe, get_message, listen) bypass instrumentation entirely. During replay, PubSub operations attempt real network connections which fail. Tested 19 potential bug scenarios across all Redis data types and patterns including: pipelines, scan iterators, blocking ops, Lua scripts, async operations, streams, geo, sets, sorted sets, locks, from_url clients, hash mappings, large payloads, and more. Only the pub/sub pattern failed replay. https://claude.ai/code/session_015MZ4GuLMi8eqzUVffB2hxa
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
| def subscriber_thread(): | ||
| """Subscribe in a separate thread to receive messages.""" | ||
| sub_client = redis.Redis( | ||
| host=os.getenv("REDIS_HOST", "localhost"), |
There was a problem hiding this comment.
Subscriber uses wrong default Redis host
Medium Severity
The sub_client in subscriber_thread defaults to "localhost" for REDIS_HOST, while every other Redis client in this file (lines 20, 150, 185) defaults to "redis". In any environment where REDIS_HOST is not explicitly set (e.g., outside Docker), the subscriber connects to a different host than the publisher, causing message delivery to silently fail.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Summary
This PR adds comprehensive bug tracking documentation for Redis instrumentation testing and introduces a new test endpoint that exposes a bug in Pub/Sub message handling during replay mode.
Key Changes
Added BUG_TRACKING.md: Comprehensive test results document covering 19 test scenarios for Redis instrumentation, including:
Added
/test/pubsub-publishendpoint: New test endpoint that demonstrates the Pub/Sub instrumentation bug:Redis.execute_command()(which is patched)PubSub.execute_command()(which is NOT patched)Updated test_requests.py: Added call to the new Pub/Sub test endpoint in the test suite
Notable Implementation Details
The identified bug occurs because:
Redis.execute_command(),Pipeline.execute(), and their async variantsPubSubclass has its own separateexecute_command()method that manages a persistent connection for receiving messagesThe bug affects any code that creates a PubSub subscriber within a request handler context during replay mode.