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

Hung server connection with tokio-rustls #147

Closed
haata opened this issue Sep 24, 2019 · 3 comments
Closed

Hung server connection with tokio-rustls #147

haata opened this issue Sep 24, 2019 · 3 comments

Comments

@haata
Copy link

haata commented Sep 24, 2019

I've been working on pycapnp (client) <-(TLS)-> capnproto-rust (server), which is basically working now except for (what I hope) is the final hurdle.

There was some sort of write IO change in tokio-rustls-0.9.1 -> tokio-rustls-0.9.2 that seems to block all capnproto wait requests after the first exchange (amusingly if I request a bunch of promises before waiting I can actually get all of them, but then next time I make a request it also hangs).

Here are 3 examples, the first one works, the 2nd one is the first version not working, the 3rd one is the latest version,
https://github.com/haata/capntls/tree/tokio-rustls-0.9.1

cargo run server localhost:12345 &
cargo run client localhost:12345
    Finished dev [unoptimized + debuginfo] target(s) in 0.24s
     Running `target/debug/capntls client 'localhost:12345'`
[email protected]:hello
[email protected]:helloa

vs.
https://github.com/haata/capntls/tree/tokio-rustls-0.9.2

cargo run server localhost:12345 &
cargo run client localhost:12345
    Finished dev [unoptimized + debuginfo] target(s) in 0.15s
     Running `target/debug/capntls client 'localhost:12345'`
[email protected]:hello
^C

and
https://github.com/haata/capntls/tree/tokio-rustls-0.10.1

cargo run server localhost:12345 &
cargo run client localhost:12345
    Finished dev [unoptimized + debuginfo] target(s) in 0.08s
     Running `target/debug/capntls client 'localhost:12345'`
[email protected]:hello
^C

The suggested "fix" from the tokio-rustls side is detailed here: quininer/tokio-rustls#37 unfortunately I'm not really sure how this change would fit into capnproto-rust (maybe somewhere in capnproto-futures?).

Anyways, I don't mind working on a patch though I might need some guidance on where to look.

@dwrensha
Copy link
Member

The "suggested fix" seems to be "call flush()", and capnp-futures is already doing that:

match writer.flush(){

So, at first glance, this looks to me like a bug somewhere other than capnproto-rust.

@haata
Copy link
Author

haata commented Sep 25, 2019

Thanks for pointing this out!

Hmmm, I'll have keep hunting.

I traced the hung transaction to that particular commit in tokio-rustls so something is amiss around writing of data.

I haven't finished tracing all the way, but it seems like the server stop here:
https://github.com/capnproto/capnproto-rust/blob/master/capnp-futures/src/write_queue.rs#L196

@haata
Copy link
Author

haata commented Sep 25, 2019

Turns out the issue was in tokio-rustls, quininer/tokio-rustls@fe8fafe

Thanks for your help @dwrensha

@haata haata closed this as completed Sep 25, 2019
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

No branches or pull requests

2 participants