Commit 295a715
authored
fix(iroh): Correctly abandon paths when new are opened with worse RTT (#4296)
## Description
Locally, `test_paths_watcher` and `endpoint_two_direct_add_relay` fairly
consistently failed for me.
I dug into `test_paths_watcher`, this was what was going on:
1. A new connection is established via IP path
2. The test waits for both relay and IP path to be established with a 1s
timeout
3. The connection immediately tries to add a relay path after it was
established via IP path, but it can't yet because of missing remote
CIDs, so it schedules a later path open for the relay path.
4. <lots and lots of path open events, many many new paths opened and
immedaitely closed>
5. Scheduled path open for the relay path triggers, but it fails because
MaxPathIdReached. Unlike RemoteCidsExhausted, it doesn't re-schedule
this path open.
6. 1s timeout triggers
The weird thing was that the max path ID limit wasn't increased. This
was because the hole-punched paths that were opened were never cleaned
up - no path was ever abandoned.
Digging deeper I found out that our logic for abandoning redundant IP
paths wasn't triggered when the newly hole-punched path wasn't better
than our current paths.
This PR fixes that.
During investigation I also found out that we would never re-try opening
the relay path in case you get a `MaxPathIdReached` error, which seems
bad, so now we explicitly handle this case as well.
## Breaking Changes
None
## Notes & open questions
Arguably, we could also decide to not match on the particular error that
causes us to not be able to open a path and always re-schedule path
opening on error?
## Change checklist
<!-- Remove any that are not relevant. -->
- [x] Self-review.1 parent ee8b6a3 commit 295a715
2 files changed
Lines changed: 17 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1503 | 1503 | | |
1504 | 1504 | | |
1505 | 1505 | | |
1506 | | - | |
| 1506 | + | |
1507 | 1507 | | |
1508 | 1508 | | |
1509 | 1509 | | |
| |||
1532 | 1532 | | |
1533 | 1533 | | |
1534 | 1534 | | |
1535 | | - | |
| 1535 | + | |
1536 | 1536 | | |
1537 | 1537 | | |
1538 | 1538 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
666 | 666 | | |
667 | 667 | | |
668 | 668 | | |
669 | | - | |
670 | 669 | | |
671 | 670 | | |
672 | 671 | | |
| 672 | + | |
| 673 | + | |
673 | 674 | | |
674 | 675 | | |
675 | 676 | | |
| |||
679 | 680 | | |
680 | 681 | | |
681 | 682 | | |
682 | | - | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
683 | 690 | | |
684 | 691 | | |
685 | 692 | | |
686 | 693 | | |
687 | 694 | | |
688 | 695 | | |
689 | 696 | | |
690 | | - | |
| 697 | + | |
691 | 698 | | |
692 | 699 | | |
693 | 700 | | |
| |||
701 | 708 | | |
702 | 709 | | |
703 | 710 | | |
704 | | - | |
| 711 | + | |
705 | 712 | | |
706 | 713 | | |
707 | 714 | | |
| |||
725 | 732 | | |
726 | 733 | | |
727 | 734 | | |
728 | | - | |
| 735 | + | |
729 | 736 | | |
730 | 737 | | |
731 | 738 | | |
| |||
1045 | 1052 | | |
1046 | 1053 | | |
1047 | 1054 | | |
1048 | | - | |
| 1055 | + | |
| 1056 | + | |
1049 | 1057 | | |
1050 | 1058 | | |
1051 | 1059 | | |
1052 | | - | |
| 1060 | + | |
1053 | 1061 | | |
1054 | 1062 | | |
1055 | 1063 | | |
| |||
0 commit comments