-
Notifications
You must be signed in to change notification settings - Fork 181
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: AsyncUdpSocket
backpressure when connection type is *not* mixed
#3117
base: main
Are you sure you want to change the base?
Conversation
AsyncUdpSocket
backpressure when connection type is mixedAsyncUdpSocket
backpressure when connection type is *not* mixed
Documentation for this PR has been generated and is available at: https://n0-computer.github.io/iroh/pr/3117/docs/iroh/ Last updated: 2025-01-10T14:28:53Z |
Netsim numbers:
vs. latest merged PR:
|
I haven't managed to get the This means we practically (?) never run into the I still think this code is more correct, but it really doesn't make much of a difference. |
AsyncUdpSocket
backpressure when connection type is *not* mixedAsyncUdpSocket
backpressure when connection type is *not* mixed
I had previously held off this because I was worried that you do not know the next packet that is going to be sent. But I think my logic was wrong: you do know the next packet: it will be the same one. So I think it's interesting to try this out. However, does it make #3067 more critical? Looking at the perf numbers I assume this has no impact and is all just noise? You might have more luck seeing the blocked metric go up if you test relay-only since then you have a single path. You can even go further and setup a relay server which rate-limits client connections so it is easier to fill up the magicsock pipes. I think it makes some sense that this is difficult to trigger, because Quinn is using congestion control and packet pacing to control the speed at which packets are being sent as well. Before WouldBlock comes into the picture. So you need to have a place where your flow control, congestion control and packet pacing all allow for more then the internal magicsock buffers are able to flush. |
iroh/src/magicsock.rs
Outdated
|
||
let has_path = udp_addr.is_some() || relay_url.is_some(); | ||
|
||
if udp_pending && relay_pending && has_path { |
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.
Is this the right logic?
- assume relay-only path
- udp_addr is none
- so udp_pending is false
- relay_url is some
- relay_pending is true (assuming it blocked)
- has_path is true
- udp_pending (false) && .... well, doesn't matter anymore. this is false now and it won't block?
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.
- udp_addr is none
- so udp_pending is false
Yeah - Ugh, I force-pushed a change that made this implication true (originally I had the logic correct).
Will fix.
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.
Updated.
Tried relay-only with rate limits. No effect :/ |
But then why return |
Description
With the previous logic, when
relay_url
isNone
, thenrelay_pending
isfalse
.The same is true with
udp_addr
andudp_pending
.However, we only ever report
WouldBlock
ifudp_pending
andrelay_pending
.So this means we only ever report
WouldBlock
ifrelay_url
isn'tNone
andudp_addr
isn'tNone
, so when we're in mixed connection mode.Because in e.g. direct connection mode,
relay_url
isNone
, thusrelay_pending
isfalse
and we never returnErr(WouldBlock)
.Notes & open questions
I'm curious about netsim numbers.No changesMaybe this should have a test.
Change checklist
[ ] Documentation updates following the style guide, if relevant.