tower-rs / tower-grpc

A gRPC client & server implementation.
MIT License
562 stars 73 forks source link

Futures from `tokio-postgres` block with tower + hyper #193

Closed nevi-me closed 5 years ago

nevi-me commented 5 years ago

I'm filing this here because it's a change in behaviour after I updated my repos to tower-grpc:0.1.0.

I noticed that after upgrading from pre-0.1 tower-grpc, which used tower-h2, my futures from tokio-postgres:0.4.0-rc.3 block indefinitely when I .wait() on the futures. Could this be something related to a change between tower-h2 and tower-hyper? All my other projects that don't use tokio-postgres work on both h2 and hyper.

nevi-me commented 5 years ago

@sfackler would you have an idea of what the issue could be?

nevi-me commented 5 years ago

I've managed to reproduce the issue at https://github.com/nevi-me/tower-grpc/commit/022a954ad0c1b6d57cf3680c5e10ba2ac3a2599a

I used the helloworld examples, when I run the client, the call to the server never completes

sfackler commented 5 years ago

You shouldn't be using wait() inside of nonblocking code: https://github.com/nevi-me/tower-grpc/commit/022a954ad0c1b6d57cf3680c5e10ba2ac3a2599a#diff-83208c391c48d78c3e7f2585906b0ff9R34.

nevi-me commented 5 years ago

I'm getting help in https://gitter.im/tokio-rs/tokio?at=5d31ce6498514166872f9c4b. I'm still struggling with futures, so I often wait() when I find myself stuck inside nested Future<Future<Future<...>>> because of combinators.

I'll close this, but now I wonder why my code used to work before. Thanks @sfackler