fix: race condition - URL not available before relay connection - #437
fix: race condition - URL not available before relay connection#437lucksus wants to merge 2 commits into
Conversation
|
✔️ b075b1d - Conventional commits check succeeded. |
WalkthroughAdds a one-shot signal for the first discovered local URL during IrohTransport setup; Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
📜 Recent review detailsConfiguration used: Organization UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
✏️ Tip: You can disable this entire section by setting Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
The following will be added to the changelog [0.4.0-dev.3] - 2026-01-15Bug Fixes
|
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
crates/transport_iroh/src/lib.rs
🧰 Additional context used
🧬 Code graph analysis (1)
crates/transport_iroh/src/lib.rs (3)
crates/api/src/url.rs (2)
as_ref(74-76)addr(214-221)crates/api/src/transport.rs (1)
url(398-398)crates/transport_iroh/src/url.rs (1)
get_url_with_first_relay(5-21)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Cloudflare Pages
🔇 Additional comments (3)
crates/transport_iroh/src/lib.rs (3)
221-230: LGTM!The oneshot channel pattern is correctly implemented to signal URL readiness. The sender is properly passed to the spawned task, and the receiver will be awaited with a timeout.
275-284: LGTM!The function signature change is well-designed. Using
Option<...>maintains flexibility, and the mutable binding enables the.take()pattern for one-time signaling.
286-318: LGTM!The logic correctly identifies the first URL by checking
guard.is_none()before the update. The.take()pattern ensures one-time signaling, and releasing the write lock before signaling is good practice to avoid holding locks during async operations.
✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.
Deploying kitsune2 with
|
| Latest commit: |
0fcceb4
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://91089171.kitsune2.pages.dev |
| Branch Preview URL: | https://fix-url-race-condition.kitsune2.pages.dev |
|
This could be a useful change. I would simplify the main connection task and pass in the local URL instead of an option. But in the larger picture, this is something that kitsune should handle better. When a local URL is received from the relay, |
Waiting for the relay connection before completing initialization
While debugging ad4m integration with new Iroh transport, I saw calls to
TxImp::urlreturning none because they happened to early in some cases. This wasn't the root cause of our issues. I don't know if it's fine without this fix in all cases, but it makes the initialization more deterministic and adds debug logs.Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.