Skip to content

Conversation

@Joshuahoky
Copy link
Collaborator

Motivation

Currently, volo-thrift supports shmipc transport for high-performance local communication but it may not be available or fail to connect. This PR introduces functionality which allows users to set a fallback address.

Solution

Added ShmipcMakeTransportWithFallback which wraps a DefaultMakeTransport

@Joshuahoky Joshuahoky requested review from a team as code owners February 9, 2026 06:36
self.default_mkt.make_transport(addr).await
}

fn set_connect_timeout(&mut self, timeout: Option<std::time::Duration>) {
Copy link
Member

Choose a reason for hiding this comment

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

shall we set the timeouts to shmipc_mkt too?

let shmipc_conn = self.shmipc_listener.accept().fuse();
let default_conn = self.default_incoming.accept().fuse();
futures::pin_mut!(shmipc_conn, default_conn);
match futures::future::select(shmipc_conn, default_conn).await {
Copy link
Member

Choose a reason for hiding this comment

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

When futures::future::select resolves, the other future is dropped. If the losing future was partway through accepting a connection, that connection may be lost.

Consider whether a tokio::select! with biased and cancellation-safe futures would be more appropriate, or at least document this trade-off?

@codecov
Copy link

codecov bot commented Feb 9, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 43.76%. Comparing base (01a614b) to head (0c35e94).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #639      +/-   ##
==========================================
- Coverage   43.77%   43.76%   -0.02%     
==========================================
  Files         161      161              
  Lines       19662    19662              
==========================================
- Hits         8608     8605       -3     
- Misses      11054    11057       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

pub fn address_with_fallback<A1: Into<Address>, A2: Into<Address>>(
self,
shmipc_addr: A1,
fallback_addr: A2,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is is better to only pass fallback_addr to the method? As a result, the client build code looks like:

volo_gen::thrift_gen::hello::HelloServiceClientBuilder::new("psm")
    .address()
    .shmipc_fallback_address()
    .build()

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants