Skip to content
Closed
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
8 changes: 4 additions & 4 deletions arrow-flight/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,17 @@ license = "Apache-2.0"
[dependencies]
arrow = { path = "../arrow", version = "7.0.0-SNAPSHOT" }
base64 = "0.13"
tonic = "0.5"
tonic = "0.6"
bytes = "1"
prost = "0.8"
prost-derive = "0.8"
prost = "0.9"
prost-derive = "0.9"
tokio = { version = "1.0", features = ["macros", "rt", "rt-multi-thread"] }

[dev-dependencies]
futures = { version = "0.3", default-features = false, features = ["alloc"]}

[build-dependencies]
tonic-build = "0.5"
tonic-build = "0.6"
# Pin specific version of the tonic-build dependencies to avoid auto-generated
# (and checked in) arrow.flight.protocol.rs from changing
proc-macro2 = "=1.0.27"
Expand Down
11 changes: 2 additions & 9 deletions arrow-flight/src/arrow.flight.protocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ pub mod flight_service_client {
impl<T> FlightServiceClient<T>
where
T: tonic::client::GrpcService<tonic::body::BoxBody>,
T::ResponseBody: Body + Send + Sync + 'static,
T::ResponseBody: Body + Send + 'static,
T::Error: Into<StdError>,
<T::ResponseBody as Body>::Error: Into<StdError> + Send,
{
Expand Down Expand Up @@ -513,7 +513,6 @@ pub mod flight_service_server {
#[doc = "Server streaming response type for the Handshake method."]
type HandshakeStream: futures_core::Stream<Item = Result<super::HandshakeResponse, tonic::Status>>
+ Send
+ Sync
+ 'static;
#[doc = ""]
#[doc = " Handshake between client and server. Depending on the server, the"]
Expand All @@ -527,7 +526,6 @@ pub mod flight_service_server {
#[doc = "Server streaming response type for the ListFlights method."]
type ListFlightsStream: futures_core::Stream<Item = Result<super::FlightInfo, tonic::Status>>
+ Send
+ Sync
+ 'static;
#[doc = ""]
#[doc = " Get a list of available streams given a particular criteria. Most flight"]
Expand Down Expand Up @@ -567,7 +565,6 @@ pub mod flight_service_server {
#[doc = "Server streaming response type for the DoGet method."]
type DoGetStream: futures_core::Stream<Item = Result<super::FlightData, tonic::Status>>
+ Send
+ Sync
+ 'static;
#[doc = ""]
#[doc = " Retrieve a single stream associated with a particular descriptor"]
Expand All @@ -581,7 +578,6 @@ pub mod flight_service_server {
#[doc = "Server streaming response type for the DoPut method."]
type DoPutStream: futures_core::Stream<Item = Result<super::PutResult, tonic::Status>>
+ Send
+ Sync
+ 'static;
#[doc = ""]
#[doc = " Push a stream to the flight service associated with a particular"]
Expand All @@ -597,7 +593,6 @@ pub mod flight_service_server {
#[doc = "Server streaming response type for the DoExchange method."]
type DoExchangeStream: futures_core::Stream<Item = Result<super::FlightData, tonic::Status>>
+ Send
+ Sync
+ 'static;
#[doc = ""]
#[doc = " Open a bidirectional data channel for a given descriptor. This"]
Expand All @@ -612,7 +607,6 @@ pub mod flight_service_server {
#[doc = "Server streaming response type for the DoAction method."]
type DoActionStream: futures_core::Stream<Item = Result<super::Result, tonic::Status>>
+ Send
+ Sync
+ 'static;
#[doc = ""]
#[doc = " Flight services can support an arbitrary number of simple actions in"]
Expand All @@ -628,7 +622,6 @@ pub mod flight_service_server {
#[doc = "Server streaming response type for the ListActions method."]
type ListActionsStream: futures_core::Stream<Item = Result<super::ActionType, tonic::Status>>
+ Send
+ Sync
+ 'static;
#[doc = ""]
#[doc = " A flight service exposes all of the available action types that it has"]
Expand Down Expand Up @@ -674,7 +667,7 @@ pub mod flight_service_server {
impl<T, B> tonic::codegen::Service<http::Request<B>> for FlightServiceServer<T>
where
T: FlightService,
B: Body + Send + Sync + 'static,
B: Body + Send + 'static,
B::Error: Into<StdError> + Send + 'static,
{
type Response = http::Response<tonic::body::BoxBody>;
Expand Down
4 changes: 2 additions & 2 deletions integration-testing/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ async-trait = "0.1.41"
clap = "2.33"
futures = "0.3"
hex = "0.4"
prost = "0.8"
prost = "0.9"
serde = { version = "1.0", features = ["rc"] }
serde_derive = "1.0"
serde_json = { version = "1.0", features = ["preserve_order"] }
tokio = { version = "1.0", features = ["macros", "rt", "rt-multi-thread"] }
tonic = "0.5"
tonic = "0.6"
tracing-subscriber = { version = "0.2.15", optional = true }
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ impl FlightService for AuthBasicProtoScenarioImpl {
&self,
request: Request<FlightDescriptor>,
) -> Result<Response<SchemaResult>, Status> {
self.check_auth(request.metadata()).await?;
let metadata = request.metadata();
self.check_auth(metadata).await?;
Err(Status::unimplemented("Not yet implemented"))
}

Expand Down Expand Up @@ -191,7 +192,8 @@ impl FlightService for AuthBasicProtoScenarioImpl {
&self,
request: Request<Streaming<FlightData>>,
) -> Result<Response<Self::DoPutStream>, Status> {
self.check_auth(request.metadata()).await?;
let metadata = request.metadata();
self.check_auth(metadata).await?;
Err(Status::unimplemented("Not yet implemented"))
}

Expand Down Expand Up @@ -219,7 +221,8 @@ impl FlightService for AuthBasicProtoScenarioImpl {
&self,
request: Request<Streaming<FlightData>>,
) -> Result<Response<Self::DoExchangeStream>, Status> {
self.check_auth(request.metadata()).await?;
let metadata = request.metadata();
Copy link
Contributor Author

@tustvold tustvold Nov 1, 2021

Choose a reason for hiding this comment

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

Without this change you get a wonderful error message which arises because the boxed decoder on Streaming is not Sync

error: future cannot be sent between threads safely
   --> integration-testing/src/flight_server_scenarios/auth_basic_proto.rs:223:59
    |
223 |       ) -> Result<Response<Self::DoExchangeStream>, Status> {
    |  ___________________________________________________________^
224 | |         self.check_auth(request.metadata()).await?;
225 | |         Err(Status::unimplemented("Not yet implemented"))
226 | |     }
    | |_____^ future created by async block is not `Send`
    |
    = help: the trait `Sync` is not implemented for `(dyn tonic::codec::Decoder<Item = FlightData, Error = Status> + std::marker::Send + 'static)`
note: future is not `Send` as this value is used across an await
   --> integration-testing/src/flight_server_scenarios/auth_basic_proto.rs:224:9
    |
224 |         self.check_auth(request.metadata()).await?;
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ first, await occurs here, with `request` maybe used later...
note: `request` is later dropped here
   --> integration-testing/src/flight_server_scenarios/auth_basic_proto.rs:224:51
    |
224 |         self.check_auth(request.metadata()).await?;
    |                         -------                   ^
    |                         |
    |                         has type `&tonic::Request<Streaming<FlightData>>` which is not `Send`
help: consider moving this into a `let` binding to create a shorter lived borrow
   --> integration-testing/src/flight_server_scenarios/auth_basic_proto.rs:224:25
    |
224 |         self.check_auth(request.metadata()).await?;
    |                         ^^^^^^^^^^^^^^^^^^
    = note: required for the cast to the object type `dyn futures::Future<Output = std::result::Result<tonic::Response<Pin<Box<(dyn futures::Stream<Item = std::result::Result<FlightData, Status>> + Sync + std::marker::Send + 'static)>>>, Status>> + std::marker::Send`

self.check_auth(metadata).await?;
Err(Status::unimplemented("Not yet implemented"))
}
}