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)
- The trait `Message` is not implemented HOT 1
- Remove trait bound on generated server struct
- NamedService makes it impossible to wrap individual services with non-intercept layers HOT 2
- After tonic is updated from 0.8.3 to 0.11.0 in the csi driver, an error message "PROTOCOL_ERROR" is displayed when kubelet calls the get_info interface.
- Share tonic server port with other http routes HOT 3
- Protobuf bytes field incorrectly parsed as String when generating gRPC code with tonic_build HOT 1
- tonic-build can no longer build code with rust < 1.77.0, due to newer build-script syntax HOT 1
- Tonic v0.13 fails to build what worked on v0.12 HOT 1
- The tonic server process exit unexpected when the client get a wrong tls config HOT 3
- Implement prost::Name for message types
- 0.12 reports invalid cert where 0.11 succeeded HOT 4
- Version 12.2 still doesn't support rustc < 1.77.0
- `tonic-health` required services
- envoy wasm-proxy send grpc message to tonic server failed
- Calling ClientTlsConfig::with_enabled_roots deletes any previous config
- Handling error layer / converting fallible services/layers to infallible
- `.proto` files are licensed under `Apache-2.0` HOT 1
- Lameducking period for graceful shutdown / serve_with_shutdown
- attribute-based configuration of `transport` in `tonic-build`
- Allow usage of `ring` instead of `aws-lc-rs` in `tokio-rustls`
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.