tustvold commented on a change in pull request #898:
URL: https://github.com/apache/arrow-rs/pull/898#discussion_r740091688



##########
File path: integration-testing/src/flight_server_scenarios/auth_basic_proto.rs
##########
@@ -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();

Review comment:
       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`
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to