-
Notifications
You must be signed in to change notification settings - Fork 24
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
fix: Fix yamux close #309
fix: Fix yamux close #309
Conversation
e0c8b6f
to
474b6eb
Compare
Could you provide more context about the related design, how to reproduce the problem and how it is fixed? It's really hard for reviewers to catch up this fixing without understanding the whole design of yamux. |
474b6eb
to
74e8e94
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggest to add more detailed comments to explain how to close the session when the remote peer does not respond to our sent go away code.
In the current implementation, if the other party does not respond to go away, yamux will wait forever, causing a possible fd attack. Although this is a poorly maintained attack method, during the attack, it must respond to ping/pong messages, otherwise, it will be closed. We cannot be sure whether the remote implementation is fully compliant with the specification. At this time, there must be a shutdown strategy, which is to set a timeout time. When the remote timeout does not respond, the connection will be closed by itself.
Since yamux needs to be runtime independent, the only thing that can be done here is to instantly replace the ping timer, whether it exists or not, at the same time, due to the inconsistency of timer implementation, it is necessary to force the poll once and register it to the corresponding driver, otherwise, it may cause the problem of not being able to wake up(like this ci error)
For stream closing, the normal closing process is:
This is a closing process of a streaming connection with a semi-closed feature
The local close state only performed the fin operation sent to the remote and did not perform notification cleanup