fix: address critical thread leak and stream corruption bugs#77
Open
ImDevinC wants to merge 1 commit into
Open
fix: address critical thread leak and stream corruption bugs#77ImDevinC wants to merge 1 commit into
ImDevinC wants to merge 1 commit into
Conversation
Critical Fixes: - Thread leak: polling threads now properly joined on disconnect with 3s timeout - Stream corruption: socket timeouts now raise EOFError instead of returning None - Connection state: is_connected() now checks actual socket state Medium Priority Fixes: - Add authentication state checks to all RPC API methods - Restore warning logs for better debuggability on connection/auth failures - Reduce socket timeout from 2s to 0.5s for faster shutdown Additional Improvements: - Add proper thread safety with _setup_lock for client initialization - Remove dead code calling non-existent backend callback methods - Add missing VOICE_SETTINGS_UPDATE event handler - Simplify socket implementation from select-based to blocking with timeout Co-authored-by: opencode <noreply@opencode.com>
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 addresses critical bugs identified in the Discord RPC plugin that could cause thread accumulation and socket stream corruption, along with several medium-priority improvements.
Critical Fixes
Thread Leak (asyncdiscord.py)
Stream Corruption (sockets.py)
Medium Priority Fixes
Authentication State Checks (backend.py)
Warning Logs Restored (backend.py)
Connection State Check (asyncdiscord.py)
Socket Timeout Reduction (constants.py)
Additional Improvements
Testing Recommendations
Breaking Changes
None - all changes are internal improvements and bug fixes.