Skip to content

Upgrade tonic dependencies to 0.13.0 version #7377

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/arrow_flight.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ jobs:
uses: ./.github/actions/setup-builder
- name: Test
run: |
cargo test -p arrow-flight
cargo test -p arrow-flight --features=router
- name: Test --all-features
run: |
cargo test -p arrow-flight --all-features
- name: Test --examples
run: |
cargo test -p arrow-flight --features=flight-sql-experimental,tls --examples
cargo test -p arrow-flight --features=flight-sql-experimental,tls,router --examples

vendor:
name: Verify Vendored Code
Expand Down
16 changes: 9 additions & 7 deletions arrow-flight/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ bytes = { version = "1", default-features = false }
futures = { version = "0.3", default-features = false, features = ["alloc"] }
once_cell = { version = "1", optional = true }
paste = { version = "1.0" , optional = true }
prost = { version = "0.13.1", default-features = false, features = ["prost-derive"] }
prost = { version = "0.13.5", default-features = false, features = ["prost-derive"] }
# For Timestamp type
prost-types = { version = "0.13.1", default-features = false }
prost-types = { version = "0.13.5", default-features = false }
tokio = { version = "1.0", default-features = false, features = ["macros", "rt", "rt-multi-thread"], optional = true }
tonic = { version = "0.12.3", default-features = false, features = ["transport", "codegen", "prost"] }
tonic = { version = "0.13.0", default-features = false, features = ["transport", "codegen", "prost"] }

# CLI-related dependencies
anyhow = { version = "1.0", optional = true }
Expand All @@ -62,7 +62,8 @@ all-features = true
[features]
default = []
flight-sql-experimental = ["dep:arrow-arith", "dep:arrow-data", "dep:arrow-ord", "dep:arrow-row", "dep:arrow-select", "dep:arrow-string", "dep:once_cell", "dep:paste"]
tls = ["tonic/tls"]
tls = ["tonic/_tls-any"]
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we can simply remove this feature and let users enable it directly on tonic. Since it doesn't work even when users enable this feature, they still need to enable ring or aws-lc directly on tonic anyway.

We should document this behavior change.

router = ["tonic/router"]
# Enable CLI tools
cli = ["arrow-array/chrono-tz", "arrow-cast/prettyprint", "tonic/tls-webpki-roots", "dep:anyhow", "dep:clap", "dep:tracing-log", "dep:tracing-subscriber"]

Expand All @@ -73,6 +74,7 @@ http = "1.1.0"
http-body = "1.0.0"
hyper-util = "0.1"
pin-project-lite = "0.2"
rustls = { version = "0.23", default-features = false, features = ["ring"] }
Copy link
Member

@Xuanwo Xuanwo May 9, 2025

Choose a reason for hiding this comment

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

We should enable it using tonic = { .., features = ["transport", "codegen", "prost", "tls-ring"]} instead of relying directly on rustls.

Tricks happened at

https://docs.rs/tonic/latest/src/tonic/transport/channel/service/tls.rs.html#48-57

#[allow(unreachable_patterns)]
let builder = match crypto::CryptoProvider::get_default() {
    Some(provider) => with_provider(provider.clone()),
    #[cfg(feature = "tls-ring")]
    None => with_provider(Arc::new(crypto::ring::default_provider())),
    #[cfg(feature = "tls-aws-lc")]
    None => with_provider(Arc::new(crypto::aws_lc_rs::default_provider())),
    // somehow tls is enabled, but neither of the crypto features are enabled.
    _ => ClientConfig::builder(),
};

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't really have any knowledge / preference -- but it would be nice to get this PR ready to merge

@MichaelScofield has a slightly different proposal here:

tempfile = "3.3"
tracing-log = { version = "0.2" }
tracing-subscriber = { version = "0.3.1", default-features = false, features = ["ansi", "env-filter", "fmt"] }
Expand All @@ -83,7 +85,7 @@ uuid = { version = "1.10.0", features = ["v4"] }

[[example]]
name = "flight_sql_server"
required-features = ["flight-sql-experimental", "tls"]
required-features = ["flight-sql-experimental", "tls", "router"]

[[bin]]
name = "flight_sql_client"
Expand All @@ -92,9 +94,9 @@ required-features = ["cli", "flight-sql-experimental", "tls"]
[[test]]
name = "flight_sql_client"
path = "tests/flight_sql_client.rs"
required-features = ["flight-sql-experimental", "tls"]
required-features = ["flight-sql-experimental", "tls", "router"]

[[test]]
name = "flight_sql_client_cli"
path = "tests/flight_sql_client_cli.rs"
required-features = ["cli", "flight-sql-experimental", "tls"]
required-features = ["cli", "flight-sql-experimental", "tls", "router"]
2 changes: 1 addition & 1 deletion arrow-flight/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ that demonstrate how to build a Flight server implemented with [tonic](https://d
- `flight-sql-experimental`: Enables experimental support for
[Apache Arrow FlightSQL], a protocol for interacting with SQL databases.

- `tls`: Enables `tls` on `tonic`
- `tls`: Enables `_tls-any` on `tonic`
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you please also add dos about the "router" feature?

Copy link
Member

Choose a reason for hiding this comment

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

As mentioned in previous comments, we should encourage users to enable correct tonic's feature instead.

Or we can re-export the same feature flags.


## CLI

Expand Down
5 changes: 4 additions & 1 deletion arrow-flight/examples/flight_sql_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -813,7 +813,7 @@ mod tests {
async fn bind_tcp() -> (TcpIncoming, SocketAddr) {
let listener = TcpListener::bind("0.0.0.0:0").await.unwrap();
let addr = listener.local_addr().unwrap();
let incoming = TcpIncoming::from_listener(listener, true, None).unwrap();
let incoming = TcpIncoming::from(listener);
(incoming, addr)
}

Expand Down Expand Up @@ -917,6 +917,9 @@ mod tests {

let svc = FlightServiceServer::new(FlightSqlServiceImpl {});

// Set dafault crypto provider to use
// See: https://docs.rs/rustls/latest/rustls/crypto/struct.CryptoProvider.html#using-the-per-process-default-cryptoprovider
rustls::crypto::ring::default_provider();
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe you need to call

let _ = rustls::crypto::ring::default_provider().install_default();

Copy link
Member

Choose a reason for hiding this comment

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

As explained in previous comments.

let serve_future = Server::builder()
.tls_config(tls_config)
.unwrap()
Expand Down
2 changes: 1 addition & 1 deletion arrow-flight/gen/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ publish = false
# Pin specific version of the tonic-build dependencies to avoid auto-generated
# (and checked in) arrow.flight.protocol.rs from changing
prost-build = { version = "=0.13.5", default-features = false }
tonic-build = { version = "=0.12.3", default-features = false, features = ["transport", "prost"] }
tonic-build = { version = "=0.13.0", default-features = false, features = ["transport", "prost"] }
14 changes: 8 additions & 6 deletions arrow-flight/src/arrow.flight.protocol.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion arrow-integration-testing/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ prost = { version = "0.13", default-features = false }
serde = { version = "1.0", default-features = false, features = ["rc", "derive"] }
serde_json = { version = "1.0", default-features = false, features = ["std"] }
tokio = { version = "1.0", default-features = false, features = [ "rt-multi-thread"] }
tonic = { version = "0.12", default-features = false }
tonic = { version = "0.13", default-features = false, features = ["router"] }
tracing-subscriber = { version = "0.3.1", default-features = false, features = ["fmt"], optional = true }
flate2 = { version = "1", default-features = false, features = ["rust_backend"] }

Expand Down
Loading