Skip to content
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

CallOption does not have Sync #548

Closed
Ten0 opened this issue Sep 21, 2021 · 1 comment · Fixed by #551
Closed

CallOption does not have Sync #548

Ten0 opened this issue Sep 21, 2021 · 1 comment · Fixed by #551

Comments

@Ten0
Copy link
Contributor

Ten0 commented Sep 21, 2021

https://docs.rs/grpcio/0.9.0/grpcio/struct.CallOption.html#impl-Sync

This is weird that we can't clone it from several threads, given that xxx_opt takes ownership when making a call anyway so there may not be any issue within gRPC Core.

What is the technical limitation that prevents us from having Sync on CallOption?

@BusyJay
Copy link
Member

BusyJay commented Sep 22, 2021

I totally agree that it should be Send and Sync. The reason it's not Sync is just we don't impl Sync for it explicilty. Rustc can explain more:

    = help: within `grpcio::CallOption`, the trait `Sync` is not implemented for `*mut grpcio_sys::bindings::grpc_metadata`
    = note: required because it appears within the type `grpcio_sys::bindings::grpc_metadata_array`
    = note: required because it appears within the type `grpcio::Metadata`
    = note: required because it appears within the type `std::option::Option<grpcio::Metadata>`
    = note: required because it appears within the type `grpcio::CallOption`

Implement Send and Sync for Metadata should solve the problem. I'm happy to accept a PR if you want to.

Ten0 added a commit to Ten0/grpc-rs that referenced this issue Oct 6, 2021
Ten0 added a commit to Ten0/grpc-rs that referenced this issue Oct 6, 2021
Fixes tikv#548

Signed-off-by: Thomas BESSOU <thomas.bessou@hotmail.fr>
BusyJay pushed a commit that referenced this issue Oct 8, 2021
Fixes #548

Signed-off-by: Thomas BESSOU <thomas.bessou@hotmail.fr>
christian-oudard pushed a commit to mobilecoinofficial/grpc-rs that referenced this issue Oct 20, 2021
Fixes tikv#548

Signed-off-by: Thomas BESSOU <thomas.bessou@hotmail.fr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants