-
Notifications
You must be signed in to change notification settings - Fork 171
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(iroh-net): return Poll::Read(Ok(n))
when we have no relay URL or direct addresses in poll_send
#2322
Conversation
Poll::Pending
when we have no relay URL or direct addresses …Poll::Pending
when we have no relay URL or direct addresses in poll_send
We won't ever call a waker in that case, so I'm wondering if not maybe Would have to check the quinn source though to see how this behaves for each variant I guess. Edit: alternatively, if discovery moved into the MagicSock, we could actually store the waker here and wake once we discovered a relay or direct addr. That's more future thoughts though, let's first fix the current "killing the endpoint" situatio. |
Thank you, yes, you are right. But I am confused/concerned about one thing. If we never end up sending those messages and keep returning My more aggressive thought would be that we should keep the error since ending up in a state where we have no address for the given node ID should never happen. And when it does happen, people will file bug reports because an error occurred 😂
I've actually been converted to "We shouldn't move discovery into MagicSock". My reasoning is two-fold:
I wrote more thoughts about this here: https://www.notion.so/number-zero/Connections-Discovery-and-Migration-9c34bad7dba24f80b20275ac78bdf202 Edits made for grammar |
We can't unfortunately because this error kills the quinn endpoint, not only the connection. I will check the quinn source what it does if we return Ready(Ok(0)). If that leads to retrying in a loop, then we should likely report the data as sent even though it isn't - this will then make the connection time out after 10s. |
We do prune unused addresses while running. |
I think I'm going down the "pretend we sent it, but it got lost somewhere in the internet tubes". With pending you indeed never install a waker. IIUC correctly Quinn quinn has a per-endpoint send buffer (per connection in 0.11), so returning pending will block everything in that buffer, including other connections. |
I know 😈
In all seriousness though—it does retry in a loop, so then reporting the data as sent is the way to go. TY!!! |
Ahh yes, let me rephrase: we never prune to 0. This only matters if we have zero addrs for a node id. |
Poll::Pending
when we have no relay URL or direct addresses in poll_send
Poll::Read(Ok(n))
when we have no relay URL or direct addresses in poll_send
Description
If we have no relay URL or addresses to send transmits for a NodeID in
poll_send
, what do we do?Returning
Polling::Ready(Err(e))
causes the endpoint to error, which causes all connections to fail.If we return
Polling::Pending
(in this case), we have no mechanism for waking the waker once thepoll_send
is returned. Also, even if we wake up and continue to poll, we will attempt to send the same transmits that we know we cannot send.If we return
Polling::Ready(Ok(0))
, we will get into a loop in Quinn that attempts to keep re-sending the same transmits.However, if we report back to Quinn that we have sent those transmits (by returning
Polling::Ready(Ok(n))
), then Quinn will move on and attempt to send new transmits. QUIC mechanisms might cause those transmits to be re-sent when we get no ACKs for them, but eventually, the connection will time out.closes #2226
Change checklist