-
Notifications
You must be signed in to change notification settings - Fork 1k
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
autonat: infinity loop on dial_back error #5816
Comments
Thank you for debugging and reporting this issue!
We should stop performing
Sounds good to me. |
Thanks @elenaf9 !! I have talked to Hannes and he said he will look at this issue in the next days. So, out of politeness, I will wait for him to confirm since its his code. If he does not have the time to do it by monday or tuesday, we will do this solution. I think it makes sense 😊 Thank you very much nonetheless. |
@elenaf9 is right |
Summary
The code of
perform_dial_back
goes into an infinity loop when an error occurs. I did found out where the error is coming from but I am not sure on how it should be fixed.rust-libp2p/protocols/autonat/src/v2/client/handler/dial_back.rs
Lines 100 to 136 in 9d3688d
The problem is that, when a result is received from
receiver.await
, if this result is an error, then the stream fires anErr
event but don't do anything to either reset theoneshot
channel that was just used, or to terminate the stream.In my opinion, there is two possible solutions:
1. Terminate the stream
When
receiver.await
returnsErr
(meaning the channel is closed), we returnNone
effectively closing the stream.2. Reset the
oneshot
channelWe
take
thestate.oneshot
, which will garantee that areceiver
can only be polled once.I am not sure on what is the expected behaviour in such cases, that is why, @umgefahren, if you could look at this and tell me what you think it would be amazing. I will open a PR as soon as I know what is the expected behaviour: stop performing dial_back when any error occurs, or if an error occurs, restart from the beginning.
Expected behavior
Do not got into an infinity loop.
Actual behavior
Goes into an infinity loop.
Relevant log output
Possible Solution
No response
Version
Master.
Would you like to work on fixing this bug?
Yes
The text was updated successfully, but these errors were encountered: