Comments (8)
@NeoLegends sorry for the delay, this should be done! Let me know if you run into any issues. I plan to get a new release out soon.
from tonic.
@parasyte you're right...I'm not sure how to move forward on this one @seanmonstar any ideas?
from tonic.
In case you accept this I have already filed PR #82 that applies the necessary change. Feel free to close it otherwise.
from tonic.
@LucioFranco This new trait bound broke my code because hyper::client:ResponseFuture
is not Sync
.
error[E0277]: `(dyn core::future::future::Future<Output = std::result::Result<http::response::Response<hyper::body::body::Body>, hyper::error::Error>> + std::marker::Send + 'static)` cannot be shared between threads safely
--> src/lib.rs:153:26
|
153 | Ok(Response::new(Box::pin(outbound)
| ^^^^^^^^^^^^^^^^^^ `(dyn core::future::future::Future<Output = std::result::Result<http::response::Response<hyper::body::body::Body>, hyper::error::Error>> + std::marker::Send + 'static)` cannot be shared between threads safely
Still looking into a way to resolve this... Does hyper
need to be patched to add the trait bound to ResponseFuture
? Or can I wrap this future in something to make it Sync
, like futures::lock::Mutex
?
cc @seanmonstar Maybe you can help out here?
from tonic.
@parasyte maybe I'm missing something but what is the reason you are returning a future as the response type?
from tonic.
@LucioFranco Sorry for the confusion, I'm not returning Future
as a response type at all. It will help to have a full example to the issue. I'll get to that for you soon.
The short description is that I'm calling the get
method on a hyper::client::Client
in an async_stream::try_stream! {}
loop; the return type is a gRPC streaming response. E.g. Pin<Box<dyn Stream<Item = Result<Message, Status> + Send + Sync + 'static>>
Awaiting this non-Sync ResponseFuture
from the hyper client (and adding the necessary Sync
bound to my streaming response type) is what causes the compile error.
from tonic.
Hrm, is the problem that hyper::client::ResponseFuture
has a Box<dyn Future + Send>
inside it, and not Box<dyn Future + Send + Sync>
?
Oh wait, is this because it technically needs a Sync
because of await
being a jerk?
from tonic.
@seanmonstar More info in #117 Yes, I think it has to do with await
seeing the Sync
trait bound and expecting everything to be Sync
from tonic.
Related Issues (20)
- Current "uds" example does not compile HOT 3
- Release 0.12.0 HOT 6
- `tonic::transport::Channel` struct is not as safe to clone for parallel use HOT 2
- Error when building excamples
- how to manually fail a client streaming?
- Add debug spans for codec tracing
- test codec::prost::tests::encode_too_big panicks on 32-bit architectures
- Inserting metadata in a test panics with index out of bounds HOT 2
- Tonic 0.12.0 compiles tokio even when no features are enabled HOT 4
- Upgrading to tonic-reflection 0.12 breaks reflection HOT 2
- use of undeclared crate or module `tonic_reflection` HOT 2
- How does tonic library dynamically set up custom middleware HOT 1
- Naming collisions with std::marker::Sync/Send
- How to make tonic support tls HOT 3
- nit: inconsistent use of crate::Error vs Error in single transport src file
- calling grpc server hosted on cloud run with https fails with transport error HOT 2
- version 0.12.1 causes ClientTlsConfig to explode with invalid CryptoProvider HOT 1
- Configuring Timeout for Graceful Shutdown HOT 1
- How to get grpc-status in Layer?
- Make the TimeoutExpired a public tonic type rather than a transport type
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tonic.