Skip to content

fix(overlaybd): probe p2p before remote runtime initialization - #172

Open
WindSongShaoGe wants to merge 1 commit into
kvcache-ai:mainfrom
WindSongShaoGe:fix/p2p-probe-before-remote-runtime
Open

fix(overlaybd): probe p2p before remote runtime initialization#172
WindSongShaoGe wants to merge 1 commit into
kvcache-ai:mainfrom
WindSongShaoGe:fix/p2p-probe-before-remote-runtime

Conversation

@WindSongShaoGe

Copy link
Copy Markdown
Contributor

Summary

  • Probe the local P2P facade before initializing the shared remote runtime.
  • Prevent the first remote layer reads from initializing the runtime without P2P acceleration.
  • Use an unaccelerated registry path for P2P UUID probing to avoid recursively routing the probe through the P2P HTTP facade.
  • Add regression coverage for remote runtime initialization order.

Problem

The remote runtime is stored in a OnceCell. Previously, P2P acceleration was only probed from create_image_file. If another call initialized the remote runtime first, the runtime permanently captured an empty acceleration address, so subsequent layer reads bypassed P2P acceleration.

Validation

  • OverlayBD library tests: 310 passed, 0 failed, 1 ignored
  • Clippy passed with warnings denied
  • Rust formatting check passed
  • git diff --check passed

Refs #138

@github-actions

github-actions Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

🔍 OpenCodeReview found 1 issue(s) in this PR.

  • ✅ Successfully posted inline: 1 comment(s)

// Probe before the OnceCell captures this runtime. Otherwise a caller
// that reaches `remote_runtime` before `create_image_file` freezes an
// empty acceleration address into the first burst of remote reads.
self.enable_acceleration();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

performance · medium
enable_acceleration() performs synchronous DNS resolution and TcpStream::connect_timeout calls (up to one second per resolved address). Calling it directly while initializing this async OnceCell can block a Tokio worker whenever any remote-open path first initializes the runtime, delaying unrelated tasks. Run the probe via tokio::task::spawn_blocking (or replace it with an async, bounded probe) before setting the registry address.

Suggestion:

Suggested change
self.enable_acceleration();
let service = self.clone();
tokio::task::spawn_blocking(move || service.enable_acceleration())
.await
.context("join acceleration probe task")?;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant