-
Notifications
You must be signed in to change notification settings - Fork 191
Fix mplex stream reset handling to allow reading buffered data #1109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
acul71
wants to merge
16
commits into
main
Choose a base branch
from
fix/chromium-rust-v0_53_x_python-v0_4__ws__noise__mplex
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Fix mplex stream reset handling to allow reading buffered data #1109
acul71
wants to merge
16
commits into
main
from
fix/chromium-rust-v0_53_x_python-v0_4__ws__noise__mplex
Conversation
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
Fixes #1108 Previously, when a stream reset was received, the code would immediately raise MplexStreamReset without checking if there was buffered data available. This caused issues in interop tests with rust-libp2p where reset messages could arrive concurrently with ping data. Changes: - Modified _do_read() to attempt reading buffered data before raising reset - Only raise reset exception if no data is available after draining channel - This allows reading data that arrives before or concurrently with reset This improves compatibility with rust-libp2p's ping protocol implementation.
- Added comprehensive debug logging to _do_read() and _do_write() methods in mplex_stream.py - Added debug logging throughout mplex.py for stream lifecycle events - Safely access peer_id using getattr to handle mock objects in tests - Fixed type checking errors (send_message return type, HeaderTags enum check) - Fixed all line length issues to comply with 88-character limit - Logging helps troubleshoot stream reset and data flow issues
- Added mplex logger names to debug logging configuration - This enables the debug logging added to mplex stream operations
- Added logging.basicConfig() when debug is enabled - Ensures debug messages from mplex loggers are actually displayed - Messages will appear on stderr with proper formatting
- Fixed line-too-long error in mplex.py __init__ debug logging - Fixed mypy type error in muxer_multistream.py by using different variable name - Fixed AttributeError in debug logging when transport_class is a mock object - All tests pass (1809 passed, 15 skipped)
- Restored basicConfig in ping_test.py to ensure debug messages are displayed - Added debug logging to swarm.py for muxed_conn.start() tracking - Added muxer_multistream logger to debug configuration
- Fixed line length issues in multiselect_client.py, swarm.py, upgrader.py, and mplex.py - Fixed mypy type error in muxer_multistream.py by using different variable name - Fixed AttributeError in debug logging by safely accessing __name__ attribute - All tests pass (1809 passed, 15 skipped)
- Created local interop test infrastructure without Docker/Redis - Added Python listener that writes address to file - Added HTTP coordinator server as Redis proxy - Created local Rust project for WASM ping dialer - Added browser console log capture to debug WASM errors - Enabled debug logging for Python and Rust components - Fixed Rust compilation issues and updated toolchain - All logs written to /tmp/ for easy debugging
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.
Description
This PR fixes an issue where mplex streams would immediately raise
MplexStreamResetwhen a reset message was received, without checking if there was buffered data available to read first.Problem
Fixes #1108
The interop test between chromium-rust-v0.53 and python-v0.4 using websocket, noise, and mplex was failing because:
MplexStreamResetwithout checking for buffered dataSolution
Modified
_do_read()inmplex_stream.pyto:Changes
libp2p/stream_muxer/mplex/mplex_stream.py: Modified read logic to check for buffered data before raising resetlibp2p/stream_muxer/mplex/mplex.py: Updated comment for claritynewsfragments/1108.bugfix.rst: Added release notes entryTesting
This improves compatibility with rust-libp2p's ping protocol implementation where reset messages may arrive concurrently with data.